Skip to content

Commit

Permalink
Merge pull request #57 from vopikamm/1-fix-bug-when-diagnosing-variab…
Browse files Browse the repository at this point in the history
…les-on-inner-grid

closes #34 . Enable diagnosing variables on inner grid
  • Loading branch information
rcaneill committed Jul 31, 2023
2 parents 72d1ca0 + 22c7184 commit 8bf290a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ the latest version of the code, and publish them to `example` when commiting to

## What's new

### not released yet
* Allow additional dimension names occurring when variables on inner grid are diagnosed, e.g. `x_grid_U_inner` or `x_grid_U`.

### v0.4.1 (2023-03-29)
* Allow to open files if time bounds are missing
* Minor bug correction for nemo 3.6
Expand Down
15 changes: 12 additions & 3 deletions xnemogcm/nemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,18 @@ def nemo_preprocess(ds, domcfg, point_type=None):
except IndexError:
# This means that there is no depth dependence of the data (surface data)
z_nme = None
x_nme = "x"
y_nme = "y"
to_rename.update({x_nme: point.x, y_nme: point.y})

# get the name of the dimension along i e.g. x, x_grid_U, x_grid_U_inner etc
x_nme = [i for i in ds.dims.keys() if "x_grid" in i or i == "x"]
# get the name of the dimension along j e.g. y, y_grid_U, y_grid_U_inner etc
y_nme = [i for i in ds.dims.keys() if "y_grid" in i or i == "y"]

for x in x_nme:
to_rename.update({x: point.x})

for y in y_nme:
to_rename.update({y: point.y})

points = [point.x, point.y]
if z_nme:
to_rename.update({z_nme: point.z})
Expand Down

0 comments on commit 8bf290a

Please sign in to comment.