File tree Expand file tree Collapse file tree
aodntools/timeseries_products Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -190,12 +190,11 @@ def in_water(nc):
190190 :param nc: xarray dataset
191191 :return: xarray dataset
192192 """
193-
194- condition = in_water_index (nc ) # This returns a numpy array
195- # Wrap the condition in a DataArray so that it aligns with the TIME coordinate.
196- cond_da = xr .DataArray (condition , dims = ["TIME" ], coords = {"TIME" : nc ["TIME" ].values })
197- return nc .where (cond_da , drop = True )
198-
193+ condition = in_water_index (nc ) # NumPy boolean array
194+ # Get the integer indices where condition is True.
195+ indices = np .nonzero (condition )[0 ]
196+ # Use positional indexing to select the TIME entries that satisfy the condition.
197+ return nc .isel (TIME = indices )
199198
200199def current_utc_timestamp (format = TIMESTAMP_FORMAT ):
201200 return datetime .now (timezone .utc ).strftime (format )
You can’t perform that action at this time.
0 commit comments