Skip to content

Commit

Permalink
notebooks: Use the netcdf from tests/data instead of downloading from…
Browse files Browse the repository at this point in the history
… the internet
  • Loading branch information
pmav99 committed May 12, 2023
1 parent c92c205 commit 067da77
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 47 deletions.
20 changes: 1 addition & 19 deletions notebooks/API.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,6 @@
"The most convenient way to apply this normalization process is to use the `api.open_dataset()` function which is a wrapper around `xr.open_dataset()`."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c34a0afe-9394-4f49-8edc-90418609a280",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"%%bash\n",
"if [[ ! -f /tmp/fort.63.nc ]]; then\n",
" pushd /tmp\n",
" wget --quiet https://github.com/ec-jrc/Thalassa/files/10867068/fort.63.zip \n",
" unzip -o fort.63.zip\n",
" popd\n",
"fi"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -118,7 +100,7 @@
},
"outputs": [],
"source": [
"filename = \"/tmp/fort.63.nc\"\n",
"filename = \"../tests/data/fort.63.nc\"\n",
"ds = api.open_dataset(filename)\n",
"ds"
]
Expand Down
52 changes: 24 additions & 28 deletions notebooks/BBox_filtering.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@
"from __future__ import annotations"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "98ba7fda-b961-450c-b885-75176c8609dc",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"# debug\n",
"import sys\n",
"\n",
"print(sys.executable)\n",
"print(sys.version_info)"
]
},
{
"cell_type": "markdown",
"id": "09b3a22a-1c7d-457b-973c-7ea35d65e22a",
Expand Down Expand Up @@ -59,16 +75,14 @@
},
"outputs": [],
"source": [
"import os\n",
"\n",
"os.environ['USE_PYGEOS'] = '0' # remove geopandas warnings\n",
"\n",
"import holoviews as hv\n",
"import numpy as np\n",
"import numpy_indexed as npi\n",
"import pandas as pd\n",
"import xarray as xr\n",
"\n",
"from thalassa import api\n",
"\n",
"hv.extension(\"bokeh\")"
]
},
Expand All @@ -81,25 +95,7 @@
"source": [
"### Sample file\n",
"\n",
"As an example let's download a netcdf file containing the output of an ADCIRC model.\n",
"\n",
"The file will be saved at `/tmp/fort.63.nc`:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e21e8260-7283-4094-b496-094834a5ad6f",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"%%bash\n",
"pushd /tmp\n",
"wget --quiet https://github.com/ec-jrc/Thalassa/files/10867068/fort.63.zip \n",
"unzip -o fort.63.zip\n",
"popd"
"As an example let's download a netcdf file containing the output of an ADCIRC model."
]
},
{
Expand All @@ -123,7 +119,7 @@
"source": [
"from thalassa import api\n",
"\n",
"filename = \"/tmp/fort.63.nc\"\n",
"filename = \"../tests/data/fort.63.nc\"\n",
"ds = api.open_dataset(filename)\n",
"ds"
]
Expand All @@ -135,9 +131,9 @@
"tags": []
},
"source": [
"As we can see the model has 3070 nodes and 5780 trifaces (i.e. triangles)\n",
"As we can see the model has 3070 `nodes` and 5780 `trifaces` (i.e. triangles)\n",
"\n",
"Note: The reason why the thalassa schema defines `triface` is because `face` might be referring to quad elements, too (in Schism models). `triface` always refers to triangles."
"Note: The reason why the thalassa schema defines `triface` is because `face` might be referring to quad elements, too (in Schism models; ADCIRC does not support them). `triface` always refers to triangles."
]
},
{
Expand Down Expand Up @@ -294,9 +290,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "thalassa2",
"display_name": "python3",
"language": "python",
"name": "thalassa2"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand Down

0 comments on commit 067da77

Please sign in to comment.