Skip to content

Commit

Permalink
fix the urban mask condition in level3
Browse files Browse the repository at this point in the history
  • Loading branch information
Emma Ai committed Nov 25, 2024
1 parent fbe2fce commit f8e034d
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions odc/stats/plugins/l34_utils/lc_level3.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,31 @@ def lc_level3(xx: xr.Dataset, urban_mask):
)

# Mask urban results with bare sfc (210)
# and urban mask

res = expr_eval(
"where((a==_u)&(c>0), b, a)",
"where((a==_u), b, a)",
{
"a": res,
"b": xx.artificial_surface.data,
"c": urban_mask,
},
name="mark_urban",
dtype="float32",
**{"_u": 210},
)

# Enforce non-urban mask area to be n/artificial (216)

res = expr_eval(
"where((b<=0)&(a==_u), _nu, a)",
{
"a": res,
"b": urban_mask,
},
name="mask_non_urban",
dtype="float32",
**{"_u": 215, "_nu": 216},
)

# Mark nodata to 255 in case any nan
res = expr_eval(
"where(a==a, a, nodata)",
Expand Down

0 comments on commit f8e034d

Please sign in to comment.