diff --git a/src/ILAMB/Variable.py b/src/ILAMB/Variable.py index 1ec31b5..0d763f2 100644 --- a/src/ILAMB/Variable.py +++ b/src/ILAMB/Variable.py @@ -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) @@ -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