From c2fd8fdcf4e488f5cf58029b34a5da936666c3c3 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Thu, 6 Jul 2023 17:03:50 -0700 Subject: [PATCH] Update `create_grid` args to improve usability (#507) * Refactors create_bounds from BoundsAccessor * Adds create_axis function * Deprecates create_grid's **kwargs and implements new x, y, z arguments * Fixes how create_grid creates the Dataset * Updates create_*_grid methods to use new create_grid * Fixes create_grid method signature * Removes old documentation * Adds proper deprecation notice to docstring * Updates vertical regrid example to use new create_grid * Apply suggestions from code review Co-authored-by: Tom Vo * Fixes converting standard name to cf axis * Fixes formatting * Adds additional suggested fixes --------- Co-authored-by: Tom Vo --- docs/api.rst | 1 + docs/examples/regridding-vertical.ipynb | 173 ++++++++++------- tests/test_regrid.py | 151 ++++++++++++++- xcdat/__init__.py | 1 + xcdat/bounds.py | 217 ++++++++++----------- xcdat/regridder/grid.py | 240 +++++++++++++++++++++--- 6 files changed, 574 insertions(+), 209 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 22b5d3a6..d93c3cbc 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -27,6 +27,7 @@ Below is a list of top-level API functions that are available in ``xcdat``. compare_datasets get_dim_coords get_dim_keys + create_axis create_gaussian_grid create_global_mean_grid create_grid diff --git a/docs/examples/regridding-vertical.ipynb b/docs/examples/regridding-vertical.ipynb index 30782822..5b34cc91 100644 --- a/docs/examples/regridding-vertical.ipynb +++ b/docs/examples/regridding-vertical.ipynb @@ -63,8 +63,10 @@ "name": "stderr", "output_type": "stream", "text": [ - "2023-05-10 18:28:47,580 [WARNING]: bounds.py(add_missing_bounds:184) >> The nlat coord variable has a 'units' attribute that is not in degrees.\n", - "2023-05-10 18:28:47,819 [WARNING]: bounds.py(add_missing_bounds:184) >> The nlat coord variable has a 'units' attribute that is not in degrees.\n" + "2023-06-21 18:06:09,973 [WARNING]: bounds.py(add_missing_bounds:184) >> The nlat coord variable has a 'units' attribute that is not in degrees.\n", + "2023-06-21 18:06:09,973 [WARNING]: bounds.py(add_missing_bounds:184) >> The nlat coord variable has a 'units' attribute that is not in degrees.\n", + "2023-06-21 18:06:10,651 [WARNING]: bounds.py(add_missing_bounds:184) >> The nlat coord variable has a 'units' attribute that is not in degrees.\n", + "2023-06-21 18:06:10,651 [WARNING]: bounds.py(add_missing_bounds:184) >> The nlat coord variable has a 'units' attribute that is not in degrees.\n" ] }, { @@ -465,7 +467,7 @@ " branch_time_in_child: 674885.0\n", " branch_method: standard\n", " further_info_url: https://furtherinfo.es-doc.org/CMIP6.NCA...\n", - " DODS_EXTRA.Unlimited_Dimension: time