Replies: 1 comment 2 replies
-
One approach outlined in xarray's issue could potentially be implemented (note you need to download a file listed at the bottom to run this example Setup
Result
Selection works...
File download
|
Beta Was this translation helpful? Give feedback.
-
xcdat has generally operated on dataset objects, which would be comparable to opening all of the contents of a netCDF4 file. This would be similar to the following objects:
ds = Dataset(filename)
for the netCDF4 libraryds = cdms2.open(filename)
for cdmsds = xr.open_dataset(filename)
for xarray / xcdatWe do this because the dataset (
ds
) object has everything you need for most calculations (i.e., a dataset contains the bounds, which can be used to calculate spatial weights for spatial averages). So, for a variabletas
, we can do things like:ds = ds.spatial.average("tas", ...)
)ds = ds.regridder.horizontal("tas", ...)
)ds = ds.temporal.departures("tas", ...)
)But we'd ideally just operate directly on the variable/dataarray
tas
. Imagine if we could do the following:(Or you could imagine functions like
tas_global = spatial_average(tas)
)...This is how a lot of people are used to operating. CDAT actually operated this way. The problem has been getting bounds into the dataarray object. This has been a longstanding issue/request for xarray.
Could we help address that longstanding issue (or would some of the simpler approaches work for us)?
Beta Was this translation helpful? Give feedback.
All reactions