-
Notifications
You must be signed in to change notification settings - Fork 10
Fix legacy code, typos, suppress run_time warnings, added further support for PyVista visualisations, flagged all kernel killing code raised in Issue #46 #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
harley-kelly
wants to merge
16
commits into
scitools-classroom:main
Choose a base branch
from
harley-kelly:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6f0212e
Corrected typos, grammar and also updated legacy
harley-kelly 98582cc
Fixed all legacy code. Added further support for PyVista interactive …
harley-kelly 497e23e
Fix: to suppress RuntimeWarning warning flags.
harley-kelly cf9f5b6
Update notebooks/Exercise_01.ipynb
harley-kelly 108e2f1
Update notebooks/Exercise_01.ipynb
harley-kelly cb369d2
Update notebooks/Exercise_01.ipynb
harley-kelly ff40113
Update notebooks/Exercise_01.ipynb
harley-kelly ff4d287
Update notebooks/Sec_01_Load_and_Examine.ipynb
harley-kelly 73157cc
Update notebooks/Sec_04_Regridding.ipynb
harley-kelly cb45c42
Update notebooks/Sec_04_Regridding.ipynb
harley-kelly 0e6df72
Update notebooks/Sec_04_Regridding.ipynb
harley-kelly cf41c15
Update notebooks/Sec_04_Regridding.ipynb
harley-kelly 2315033
Update notebooks/Sec_01_Load_and_Examine.ipynb
harley-kelly 2a301b8
Update notebooks/Sec_01_Load_and_Examine.ipynb
harley-kelly c993893
Apply suggestions from code review
harley-kelly 2da09be
Apply suggestions from code review
harley-kelly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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,20 +95,25 @@ | |||||
"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" | ||||||
] | ||||||
}, | ||||||
{ | ||||||
"cell_type": "markdown", | ||||||
"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. <span style=\"color:red; font-weight:bold;\">Currently does not show any data, just empty table</span>\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,22 +148,21 @@ | |||||
}, | ||||||
"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" | ||||||
] | ||||||
}, | ||||||
{ | ||||||
"cell_type": "markdown", | ||||||
"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)" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
] | ||||||
}, | ||||||
{ | ||||||
"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", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
"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, | ||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added in iris v3.11.1, you should add a minimum pin to the requirements and lock.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still needed!