Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe Miron committed Dec 20, 2023
1 parent 63bb625 commit d99547a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions clouddrift/ragged.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,11 +840,9 @@ def _mask_var(
data=apply_ragged(criterion, var, rowsize), dims=[dim_name]
).astype(bool)

if (len(var) == len(rowsize) and len(mask) != len(var)) or (
len(var) == np.sum(rowsize) and len(mask) != np.sum(rowsize)
):
if not len(var) == len(mask):
raise ValueError(
"The `Callable` function needs to return a masked array that matches the length of the variable to filter."
"The `Callable` function must return a masked array that matches the length of the variable to filter."
)
else: # select one specific value
mask = var == criterion
Expand Down

0 comments on commit d99547a

Please sign in to comment.