Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions om4labs/diags/seaice/seaice.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ def read(dictArgs):
ds["GEOLON"] = xr.DataArray(X, dims=["lat", "lon"])
ds["GEOLAT"] = xr.DataArray(Y, dims=["lat", "lon"])
_AREA = standard_grid_cell_area(_lat, _lon)
_MASK = np.array(dstatic["mask"].fillna(0.0).to_masked_array())
_AREA = _AREA * _MASK
ds["CELL_AREA"] = xr.DataArray(_AREA, dims=["lat", "lon"])
ds["AREA"] = xr.DataArray(_AREA, dims=["lat", "lon"])
# backward fill to zero NaNs on the antarctic continent (unmapped points)
_CELL_AREA = dstatic["CELL_AREA"].bfill(dim='lat')
# replace non-land values by result of analytical computation
ds["CELL_AREA"] = xr.where(_CELL_AREA == 0, 0, _AREA)
ds["AREA"] = ds["CELL_AREA"].copy()
ds = ds.rename({"lon": "x", "lat": "y"})
else:
ds["CELL_AREA"] = dstatic["CELL_AREA"]
Expand Down