Skip to content

Commit

Permalink
fix bug for unstandard dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
lee1043 committed Oct 10, 2023
1 parent 2630bbe commit d3aa079
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pcmdi_utils/land_sea_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,15 +465,15 @@ def generate_land_sea_mask__global_land_mask(ds, maskname="lsmask"):
"""

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

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

0 comments on commit d3aa079

Please sign in to comment.