Skip to content

Commit f8e034d

Browse files
author
Emma Ai
committed
fix the urban mask condition in level3
1 parent fbe2fce commit f8e034d

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

odc/stats/plugins/l34_utils/lc_level3.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,31 @@ def lc_level3(xx: xr.Dataset, urban_mask):
2121
)
2222

2323
# Mask urban results with bare sfc (210)
24-
# and urban mask
2524

2625
res = expr_eval(
27-
"where((a==_u)&(c>0), b, a)",
26+
"where((a==_u), b, a)",
2827
{
2928
"a": res,
3029
"b": xx.artificial_surface.data,
31-
"c": urban_mask,
3230
},
3331
name="mark_urban",
3432
dtype="float32",
3533
**{"_u": 210},
3634
)
3735

36+
# Enforce non-urban mask area to be n/artificial (216)
37+
38+
res = expr_eval(
39+
"where((b<=0)&(a==_u), _nu, a)",
40+
{
41+
"a": res,
42+
"b": urban_mask,
43+
},
44+
name="mask_non_urban",
45+
dtype="float32",
46+
**{"_u": 215, "_nu": 216},
47+
)
48+
3849
# Mark nodata to 255 in case any nan
3950
res = expr_eval(
4051
"where(a==a, a, nodata)",

0 commit comments

Comments
 (0)