Skip to content

Commit

Permalink
Merge pull request #15 from PCMDI/14_ljw_global_land_mask_era5
Browse files Browse the repository at this point in the history
Bug fix
  • Loading branch information
lee1043 authored Oct 3, 2023
2 parents a0ff612 + 7328874 commit 74d2ef6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pcmdi_utils/land_sea_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,16 @@ def generate_land_sea_mask__global_land_mask(ds, maskname="lsmask"):
"""

for key in list(ds.coords.keys()):
if key in ["lat", "latitude"] or ds[key].attrs["axis"] == "Y":
if key in ["lat", "latitude"]:
lat_key = key
elif key in ["lon", "longitude"] or ds[key].attrs["axis"] == "X":
elif key in ["lon", "longitude"]:
lon_key = key
else:
if "axis" in list(ds["latitude"].attrs.keys()):
if ds["latitude"].attrs["axis"] == "Y":
lat_key = key
elif ds["latitude"].attrs["axis"] == "X":
lon_key = key

lat = ds[lat_key].to_numpy()
lon = ds[lon_key].to_numpy()
Expand Down

0 comments on commit 74d2ef6

Please sign in to comment.