Skip to content

Commit

Permalink
resolve #1
Browse files Browse the repository at this point in the history
  • Loading branch information
David Kamm committed Jul 31, 2023
1 parent 72d1ca0 commit 940c4bd
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions xnemogcm/nemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,22 @@ 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 variable along i e.g. x, x_grid_U, x_grid_U_inner etc
try:
x_nme = [i for i in ds.dims.keys() if "x_grid" in i]
except IndexError:
# This means that the i-dimension must have the name 'x'
x_nme = ["x"]
# get the name of the variable along j e.g. y, y_grid_U, y_grid_U_inner etc
try:
y_nme = [i for i in ds.dims.keys() if "y_grid" in i]
except IndexError:
# This means that the j-dimension must have the name 'y'
y_nme = ["y"]

for x, y in zip(x_nme, y_nme):
to_rename.update({x: point.x, y: point.y})

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

0 comments on commit 940c4bd

Please sign in to comment.