diff --git a/notebooks/Exercise_01.ipynb b/notebooks/Exercise_01.ipynb index 3c38480..ec78b84 100644 --- a/notebooks/Exercise_01.ipynb +++ b/notebooks/Exercise_01.ipynb @@ -49,8 +49,7 @@ "import iris\n", "from geovista import GeoPlotter\n", "from esmf_regrid.experimental.unstructured_scheme import MeshToGridESMFRegridder, GridToMeshESMFRegridder\n", - "from iris.experimental.ugrid.load import PARSE_UGRID_ON_LOAD\n", - "pv.rcParams[\"use_ipyvtk\"] = True\n", + "# pv.rcParams[\"use_ipyvtk\"] = True\n", "iris.FUTURE.datum_support = True # avoids some warnings" ] }, @@ -289,7 +288,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.13.2" }, "toc-autonumbering": true, "toc-showtags": false diff --git a/notebooks/Sec_01_Load_and_Examine.ipynb b/notebooks/Sec_01_Load_and_Examine.ipynb index 8279545..caa0354 100644 --- a/notebooks/Sec_01_Load_and_Examine.ipynb +++ b/notebooks/Sec_01_Load_and_Examine.ipynb @@ -20,17 +20,7 @@ "source": [ "## Iris unstructured loading\n", "\n", - "\"Unstructured\" data can be loaded from UGRID files (i.e. netCDF files containing a UGRID-style mesh). This is just like normal [Iris](https://scitools-iris.readthedocs.io/en/latest) loading, except that we must *enable* the interpretion of UGRID content like this:\n", - "\n", - "```python\n", - "with PARSE_UGRID_ON_LOAD.context():\n", - " cube_list = iris.load(path [, constraints])\n", - " # ..and/or..\n", - " single_cube = iris.load_cube(path [, constraints])\n", - " # ..and/or..\n", - " selected_cubes = iris.load_cubes(path, cube_constraints)\n", - "\n", - "```" + "\"Unstructured\" data can be loaded from UGRID files (i.e. netCDF files containing a UGRID-style mesh). This is just like normal [Iris](https://scitools-iris.readthedocs.io/en/latest) loading." ] }, { @@ -40,7 +30,7 @@ "source": [ "### Enable UGRID loading\n", "\n", - "To test loading of UGRID files, like demonstrated above, we need to import `iris`, and the `PARSE_UGRID_ON_LOAD` object from [iris.experimental.ugrid.load](https://scitools-iris.readthedocs.io/en/latest/generated/api/iris/experimental/ugrid/load.html#)\n" + "To test loading of UGRID files, like demonstrated above, we need to import `iris`." ] }, { @@ -52,9 +42,11 @@ }, "outputs": [], "source": [ - "import iris \n", + "import iris\n", "\n", - "from iris.experimental.ugrid.load import PARSE_UGRID_ON_LOAD" + "# This will suppress RuntimeWarning flags\n", + "import warnings\n", + "warnings.filterwarnings(\"ignore\")" ] }, { @@ -103,12 +95,14 @@ "outputs": [], "source": [ "print('loading...')\n", - "with PARSE_UGRID_ON_LOAD.context():\n", - " cubes = iris.load(lfric_filepth)\n", + "\n", + "iris.FUTURE.date_microseconds = True\n", + "\n", + "cubes = iris.load(lfric_filepth)\n", "\n", "print(f'\\n... Loaded {len(cubes)} cubes.')\n", - "print('Showing first 6:')\n", - "cubes[:6]" + "print('Showing them all:')\n", + "cubes" ] }, { @@ -116,7 +110,10 @@ "id": "604a48f9-8275-40e9-9d97-9294ce4e8ad7", "metadata": {}, "source": [ - "Putting just `cubes` at the end of the code above triggers noteboook printing output. You can click on each cube to expand it into detail view. Try this. Try also to use `print(cubes)` instead. To spot some structual differences between LFRic and UM data also load some cubes from `um_filepath` above. " + "Putting just `cubes` at the end of the code above triggers notebook printing output. You can click on each cube to expand it into detail view. Try this. Currently does not show any data, just empty table\n", + "\n", + "\n", + "Try also to use `print(cubes)` instead. To spot some structual differences between LFRic and UM data also load some cubes from `um_filepath` above. " ] }, { @@ -151,14 +148,13 @@ }, "outputs": [], "source": [ - "with PARSE_UGRID_ON_LOAD.context():\n", - " lfric_rh = iris.load_cube(lfric_filepth,'relative_humidity_wrt_water')\n", + "lfric_rh = iris.load_cube(lfric_filepth,'relative_humidity_wrt_water')\n", "\n", "# just uncomment to explore: \n", - "#print(lfric_rh)\n", - "#print(lfric_rh.mesh)\n", - "#print(lfric_rh.location)\n", - "#print(lfric_rh.mesh_dim)\n" + "# print(lfric_rh)\n", + "# print(lfric_rh.mesh)\n", + "# print(lfric_rh.location)\n", + "# print(lfric_rh.mesh_dim)\n" ] }, { @@ -166,7 +162,7 @@ "id": "ee291cd1-7009-43e1-b62a-2ab615d458f0", "metadata": {}, "source": [ - "If the cube is not a mesh cube these propertise are `None`, which we can demonstrate with a cube from the \"UM file\": " + "If the cube is not a mesh cube these properties are `None`, which we can demonstrate with a cube from the \"UM file\": " ] }, { @@ -179,8 +175,35 @@ "outputs": [], "source": [ "um_cube = iris.load_cube(um_filepth,'air_temperature')\n", - "#print(um_cube)\n", - "print(um_cube.mesh)\n" + "print('You can see the data here: \\n \\n', um_cube)" + ] + }, + { + "cell_type": "markdown", + "id": "3b558541", + "metadata": {}, + "source": [ + "It is clearly not a mesh.\n", + "\n", + "If we try to print the mesh property, then the output is as follows:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9cdbd267", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "None\n" + ] + } + ], + "source": [ + "print(um_cube.mesh)" ] }, { @@ -195,7 +218,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "everyday", "language": "python", "name": "python3" }, @@ -209,7 +232,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.13.2" } }, "nbformat": 4, diff --git a/notebooks/Sec_02_Meshes.ipynb b/notebooks/Sec_02_Meshes.ipynb index 80bd7a7..d0d1639 100644 --- a/notebooks/Sec_02_Meshes.ipynb +++ b/notebooks/Sec_02_Meshes.ipynb @@ -100,14 +100,6 @@ "## Next notebook\n", "See the next section: [03 - Plotting and Visualisation](./Sec_03_Plotting.ipynb)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "12005e21-9a61-44a2-85c1-01d11da5ade3", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/notebooks/Sec_03_Plotting.ipynb b/notebooks/Sec_03_Plotting.ipynb index 06499e8..ad5adf1 100644 --- a/notebooks/Sec_03_Plotting.ipynb +++ b/notebooks/Sec_03_Plotting.ipynb @@ -36,13 +36,36 @@ "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "a5beb54d2f9b43e2bc2f981ec63e4fe1", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Widget(value='