You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.
I want to make a BoutDataset class which contains extra attributes to hold information about the run which doesn't naturally fit into the xarray data model, extra methods to perform analysis/plotting which only users of this code would require, but also be able to use xarray-specific methods and top-level functions:
bd=BoutDataset('/path/to/data')
ds=bd.data# access the wrapped xarray datasetextra_data=bd.extra_data# access the BOUT-specific databd.isel(time=-1) # use xarray dataset methodsbd2=BoutDataset('/path/to/other/data')
concatenated_bd=xr.concat([bd, bd2]) # apply top-level xarray functions to the databd.plot_tokamak() # methods implementing bout-specific functionality
I'm not sure what the best way to do this is. My current approach uses xr.register_dataset_accessor.
The text was updated successfully, but these errors were encountered:
This was closed by adding the ability to always keep attributes on operations in xarray (pydata/xarray#2482).
This means that as long as the desired data is stored either in the dataset variables or in the attrs dictionary it will be preserved across operations, and therefore we can just use xarray.Dataset to hold everything, and implement BOUT-specific methods using the xarray accessors.
(described in more detail at pydata/xarray#2473)
I want to make a BoutDataset class which contains extra attributes to hold information about the run which doesn't naturally fit into the xarray data model, extra methods to perform analysis/plotting which only users of this code would require, but also be able to use xarray-specific methods and top-level functions:
I'm not sure what the best way to do this is. My current approach uses
xr.register_dataset_accessor
.The text was updated successfully, but these errors were encountered: