How to tell if flox is actually being used? #8318
-
I have a process that is using Alternatively, maybe somebody can tell me if my use-case makes sense in the first place. It goes something like this: from pathlib import Path
import xarray as xr
def ds_preprocess(dataset):
# do stuff to dataset (transform vars, add some new vars, including "cell")
return dataset
def cell_ds_process(dataset):
# do stuff to dataset (transform vars, add some new vars)
return dataset
filenames = list(Path("/path/to/files/").glob("*.nc"))
with xr.open_mfdataset(filenames, concat_dim="obs", combine="nested") as fp:
data = ds_preprocess(fp)
for cell, cell_ds in data.groupby("cell"):
cell_ds = cell_ds_process(cell_ds)
fname = get_fname(cell_ds)
cell_ds.to_netcdf(fname) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It is not being used here. |
Beta Was this translation helpful? Give feedback.
It is not being used here.
flox
only accelerates reductions, so things likedata.groupby("cell").mean()
. Depending on whats incell_ds_process
you might be able to migrate the heavy lifting to flox.