Skip to content

Commit

Permalink
Remove constraint on mask variables (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnowacki-usgs authored Apr 29, 2024
1 parent b91001c commit fab5efc
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions stglib/core/qaqc.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,18 +336,13 @@ def trim_mask(ds, var):
trmvars = [trmvars]

for trimvar in trmvars:
if ds[var].dims == ds[trimvar].dims:
cond = ~ds[trimvar].isnull()
ds[var] = ds[var].where(cond)
cond = ~ds[trimvar].isnull()
ds[var] = ds[var].where(cond)

affected = cond.size - cond.sum()
affected = cond.size - cond.sum()

notetxt = f"Values filled using {trimvar} mask; {affected.values} values affected. "
ds = utils.insert_note(ds, var, notetxt)
else:
raise ValueError(
f"dimension mismatch between {var} and masking variable {trimvar}"
)
notetxt = f"Values filled using {trimvar} mask; {affected.values} values affected. "
ds = utils.insert_note(ds, var, notetxt)

return ds

Expand Down

0 comments on commit fab5efc

Please sign in to comment.