-
Notifications
You must be signed in to change notification settings - Fork 173
Add NEMO and MITgcm test data to datasets.structured.circulation_models
#2014
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
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
23df950
Add structured.circulation_model.py
VeckoTheGecko 78598d2
Add stubs for circulation models, and docstrings for hycom and nemo
VeckoTheGecko 4aac872
Update docstrings
VeckoTheGecko 3e25a92
typo
VeckoTheGecko 1f69eef
Add nemo example data and comparison tooling
VeckoTheGecko cf58b8c
typo
VeckoTheGecko 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 |
|---|---|---|
| @@ -0,0 +1,216 @@ | ||
| import numpy as np | ||
| import pandas as pd | ||
| import xarray as xr | ||
|
|
||
| from . import T, X, Y, Z | ||
|
|
||
| __all__ = ["T", "X", "Y", "Z", "datasets"] | ||
|
|
||
|
|
||
| def _nemo_data() -> xr.Dataset: | ||
| """Dataset matching level 0 NEMO model output. | ||
|
|
||
| Example dataset is based off of data from the MOi GLO12 run. | ||
|
|
||
| https://www.mercator-ocean.eu/en/solutions-expertise/accessing-digital-data/product-details/?offer=4217979b-2662-329a-907c-602fdc69c3a3&system=d35404e4-40d3-59d6-3608-581c9495d86a | ||
| """ | ||
| # Using data from lorenz. | ||
| # Mesh file: /storage/shared/oceanparcels/input_data/MOi/domain_ORCA0083-N006/SY4V3R1_mesh_hgr.nc | ||
| # Data files: /storage/shared/oceanparcels/input_data/MOi/GLO12/psy4v3r1-daily_{U,V}_*.nc | ||
| # used modulefile for reference: "/storage/shared/oceanparcels/input_data/MOi/psy4v3r1/create_fieldset2D.py" | ||
|
|
||
| # scp "lorenz:/storage/shared/oceanparcels/input_data/MOi/GLO12/psy4v3r1-daily_{U,V,W,T}_2007-01-0{1,2}.nc" data-v4/nemo/field | ||
|
|
||
| time_counter_data = pd.date_range(start="2007-01-01T12:00:00", periods=T, freq="D") | ||
| y_data = np.arange(1, Y + 1) | ||
| x_data = np.arange(1, X + 1) | ||
| deptht_data = np.linspace(0.494, 5.728e03, Z) | ||
|
|
||
| # Create the dataset | ||
| return xr.Dataset( | ||
| data_vars={ | ||
| "sotkeavmu1": ( | ||
| ("time_counter", "y", "x"), | ||
| np.random.rand(T, Y, X).astype(np.float64), | ||
| { | ||
| "units": "m2 s-1", | ||
| "valid_min": np.float64(0.0), | ||
| "valid_max": np.float64(100.0), | ||
| "long_name": "Vertical Eddy Viscosity U 1m", | ||
| "standard_name": "ocean_vertical_eddy_viscosity_u_1m", | ||
| "short_name": "sotkeavmu1", | ||
| "online_operation": "N/A", | ||
| "interval_operation": np.int64(86400), | ||
| "interval_write": np.int64(86400), | ||
| "associate": "time_counter nav_lat nav_lon", | ||
| }, | ||
| ), | ||
| "sotkeavmu15": ( | ||
| ("time_counter", "y", "x"), | ||
| np.random.rand(T, Y, X).astype(np.float64), | ||
| { | ||
| "units": "m2 s-1", | ||
| "valid_min": np.float64(0.0), | ||
| "valid_max": np.float64(100.0), | ||
| "long_name": "Vertical Eddy Viscosity U 15m", | ||
| "standard_name": "ocean_vertical_eddy_viscosity_u_15m", | ||
| "short_name": "sotkeavmu15", | ||
| "online_operation": "N/A", | ||
| "interval_operation": np.int64(86400), | ||
| "interval_write": np.int64(86400), | ||
| "associate": "time_counter nav_lat nav_lon", | ||
| }, | ||
| ), | ||
| "sotkeavmu30": ( | ||
| ("time_counter", "y", "x"), | ||
| np.random.rand(T, Y, X).astype(np.float64), | ||
| { | ||
| "units": "m2 s-1", | ||
| "valid_min": np.float64(0.0), | ||
| "valid_max": np.float64(100.0), | ||
| "long_name": "Vertical Eddy Viscosity U 30m", | ||
| "standard_name": "ocean_vertical_eddy_viscosity_u_30m", | ||
| "short_name": "sotkeavmu30", | ||
| "online_operation": "N/A", | ||
| "interval_operation": np.int64(86400), | ||
| "interval_write": np.int64(86400), | ||
| "associate": "time_counter nav_lat nav_lon", | ||
| }, | ||
| ), | ||
| "sotkeavmu50": ( | ||
| ("time_counter", "y", "x"), | ||
| np.random.rand(T, Y, X).astype(np.float64), | ||
| { | ||
| "units": "m2 s-1", | ||
| "valid_min": np.float64(0.0), | ||
| "valid_max": np.float64(100.0), | ||
| "long_name": "Vertical Eddy Viscosity U 50m", | ||
| "standard_name": "ocean_vertical_eddy_viscosity_u_50m", | ||
| "short_name": "sotkeavmu50", | ||
| "online_operation": "N/A", | ||
| "interval_operation": np.int64(86400), | ||
| "interval_write": np.int64(86400), | ||
| "associate": "time_counter nav_lat nav_lon", | ||
| }, | ||
| ), | ||
| "vozocrtx": ( | ||
| ("time_counter", "deptht", "y", "x"), | ||
| np.random.rand(T, Z, Y, X).astype(np.float64), | ||
| { | ||
| "units": "m s-1", | ||
| "valid_min": np.float64(-10.0), | ||
| "valid_max": np.float64(10.0), | ||
| "long_name": "Zonal velocity", | ||
| "standard_name": "sea_water_x_velocity", | ||
| "short_name": "vozocrtx", | ||
| "online_operation": "N/A", | ||
| "interval_operation": np.int64(86400), | ||
| "interval_write": np.int64(86400), | ||
| "associate": "time_counter deptht nav_lat nav_lon", | ||
| }, | ||
| ), | ||
| }, | ||
| coords={ | ||
| "nav_lon": ( | ||
| ("y", "x"), | ||
| np.random.rand(Y, X).astype(np.float32), | ||
| { | ||
| "units": "degrees_east", | ||
| "valid_min": np.float32(-179.99984754002182), | ||
| "valid_max": np.float32(179.999842386314), | ||
| "long_name": "Longitude", | ||
| "nav_model": "Default grid", | ||
| "standard_name": "longitude", | ||
| }, | ||
| ), | ||
| "nav_lat": ( | ||
| ("y", "x"), | ||
| np.random.rand(Y, X).astype(np.float32), | ||
| { | ||
| "units": "degrees_north", | ||
| "valid_min": np.float32(-77.0104751586914), | ||
| "valid_max": np.float32(89.9591064453125), | ||
| "long_name": "Latitude", | ||
| "nav_model": "Default grid", | ||
| "standard_name": "latitude", | ||
| }, | ||
| ), | ||
| "x": (("x",), x_data, {"standard_name": "projection_x_coordinate", "axis": "X", "units": "1"}), | ||
| "y": (("y",), y_data, {"standard_name": "projection_y_coordinate", "axis": "Y", "units": "1"}), | ||
| "time_counter": ( | ||
| ("time_counter",), | ||
| time_counter_data, | ||
| {"standard_name": "time", "long_name": "Time axis", "axis": "T", "time_origin": "1950-JAN-01 00:00:00"}, | ||
| ), | ||
| "deptht": ( | ||
| ("deptht",), | ||
| deptht_data, | ||
| { | ||
| "units": "m", | ||
| "positive": "down", | ||
| "valid_min": np.float64(0.4940253794193268), | ||
| "valid_max": np.float64(5727.91650390625), | ||
| "long_name": "Vertical T levels", | ||
| "standard_name": "depth", | ||
| "axis": "Z", | ||
| }, | ||
| ), | ||
| }, | ||
| attrs={ | ||
| "Conventions": "CF-1.0", | ||
| "file_name": "ORCA12_LIM-T00_y2021m09d27_gridU.nc", | ||
| "institution": "MERCATOR OCEAN", | ||
| "source": "NEMO", | ||
| "TimeStamp": "2021-OCT-03 18:27:01 GMT-0000", | ||
| "references": "http://www.mercator-ocean.eu", | ||
| }, | ||
| ) | ||
|
|
||
|
|
||
| def _hycom_data() -> xr.Dataset: | ||
| """Dataset matching level 0 HYCOM model output. | ||
|
|
||
| Example dataset is based off of data from the GOFS 3.1: 41-layer HYCOM + NCODA Global 1/12° Analysis. | ||
|
|
||
| https://www.hycom.org/dataserver/gofs-3pt1/analysis | ||
| """ | ||
| ... | ||
|
|
||
|
|
||
| def _mitgcm_data() -> xr.Dataset: | ||
| """Dataset matching level 0 MITgcm model output. | ||
|
|
||
| Example dataset is based on the Pre-SWOT Level-4 Hourly MITgcm LLC4320 simulation, | ||
| which provides high-resolution (1/48°) global ocean state estimates with hourly outputs. | ||
|
|
||
| https://podaac.jpl.nasa.gov/dataset/MITgcm_LLC4320_Pre-SWOT_JPL_L4_ACC_SMST_v1.0 | ||
| """ | ||
| ... | ||
|
|
||
|
|
||
| def _pop_data() -> xr.Dataset: | ||
| """Dataset matching level 0 POP model output. | ||
|
|
||
| TODO: Identify a suitable public dataset to mimick. | ||
| """ | ||
| ... | ||
|
|
||
|
|
||
| def _ecco_data() -> xr.Dataset: | ||
| """Dataset matching level 0 ECCO model output. | ||
|
|
||
| TODO: Identify a suitable public dataset to mimick. | ||
|
|
||
| """ | ||
| ... | ||
|
|
||
|
|
||
| def _croco_data() -> xr.Dataset: | ||
| """Dataset matching level 0 CROCO model output. | ||
|
|
||
| TODO: Identify a suitable public dataset to mimick. | ||
| """ | ||
| ... | ||
|
|
||
|
|
||
| datasets = {} | ||
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 |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| """Datasets focussing on grid geometry""" | ||
|
|
||
| import numpy as np | ||
| import xarray as xr | ||
|
|
||
|
|
||
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.
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.
See https://ecco-v4-python-tutorial.readthedocs.io/ECCO_v4_Loading_LLC_compact_binary_files.html
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.
I just skimmed through it
does this mean that ECCO is a model built on top of MITgcm?
I'll take a more thorough look later
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.
Yep, that's correct. ECCO is an output of MITgcm, just like our MOi or Copernicus datasets are output datasets of NEMO. The interesting thing about ECCO, though, it that is has the tiled structure: see llc90 example at https://ecco-group.org/datasets.htm