Skip to content

Commit 3131bbc

Browse files
author
Emma Ai
committed
flexible to the case that numpy change convention
1 parent 4d0732b commit 3131bbc

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

odc/stats/plugins/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def native_transform(self, xx: xr.Dataset) -> xr.Dataset:
5353
xx[var].attrs.get("nodata") is None
5454
and np.dtype(xx[var].dtype).kind == "f"
5555
):
56-
xx[var].attrs["nodata"] = np.nan
56+
xx[var].attrs["nodata"] = xx[var].dtype.type(None)
5757
return xx
5858

5959
def fuser(self, xx: xr.Dataset) -> xr.Dataset:

odc/stats/plugins/lc_veg_class_a1.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,14 @@ def l3_class(self, xx: xr.Dataset):
200200

201201
# Mask nans with NODATA
202202
l3_mask = expr_eval(
203-
"where((a!=a)|((b>=_n)&(_n==_n))|(b!=b), nodata, e)",
203+
"where((a!=a), nodata, e)",
204204
{
205205
"a": si5,
206-
"b": xx.veg_frequency.data,
207206
"e": l3_mask,
208207
},
209208
name="mark_nodata",
210209
dtype="uint8",
211-
**{"_n": xx.veg_frequency.attrs["nodata"], "nodata": NODATA},
210+
**{"nodata": NODATA},
212211
)
213212

214213
# Now add the water frequency

0 commit comments

Comments
 (0)