Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix unit error on ELM output and CLASS data std uncertainty #114

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
18 changes: 15 additions & 3 deletions src/ILAMB/Variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def __init__(self, **keywords):

# Add handling for some units which cf_units does not support
unit = unit.replace("psu", "1e-3")
unit = unit.replace("proportion", "1")

if not np.ma.isMaskedArray(data):
data = np.ma.masked_array(data)
Expand Down Expand Up @@ -1539,9 +1540,20 @@ def interpolate(
data = data.data[ind]
data = np.ma.masked_array(data, mask=mask)
if self.data_bnds is not None:
args.append([0, 1])
ind = np.ix_(*args)
data_bnds = self.data_bnds[ind]

if self.data_bnds.shape == self.data.shape:
ind = np.ix_(*args)
# one std?
data_bnds = np.ma.stack(
[self.data[ind]-self.data_bnds[ind],
self.data[ind]+self.data_bnds[ind]], axis=len(args))

self.data_bnds = data_bnds
else:
args.append([0, 1])
ind = np.ix_(*args)
data_bnds = self.data_bnds[ind]

np.seterr(under="ignore", over="ignore")
frac = self.area / il.CellAreas(
self.lat, self.lon, self.lat_bnds, self.lon_bnds
Expand Down