Skip to content

Commit

Permalink
Merge pull request #64 from leosaffin/version-1-prep
Browse files Browse the repository at this point in the history
Fix use of track_ids in trackswhere
  • Loading branch information
leosaffin authored Nov 19, 2024
2 parents cdc4ce1 + c753ccc commit fcb0585
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions huracanpy/_subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,8 @@ def trackswhere(tracks, track_ids, condition):
if track_ids.ndim != 1:
raise ValueError("track_ids must be 1d")

track_groups = tracks.groupby("track_id")

if callable(condition):
is_match = track_groups.map(condition)

track_groups = [
track for n, (track_id, track) in enumerate(track_groups) if is_match[n]
track for track_id, track in tracks.groupby(track_ids) if condition(track)
]

return xr.concat(track_groups, dim=track_ids.dims[0])

0 comments on commit fcb0585

Please sign in to comment.