Prototype Implementation Branch: https://github.com/jthielen/xarray/tree/datatree-backend
Xarray will soon include the DataTree
class, a new data structure that will represent hierarchical data as a series of nested "groups". This data structure maps closely to HDF5, netCDF4, Zarr, and other data formats. Xarray should include an open_datatree
function that efficiently creates DataTree
objects.
This design doc lays out the basic design for the integration of open_datatree
with Xarray's backends.
Guiding Principle: Add a open_datatree
method to xarray.backends.BackendEntrypoint
that instantiates and returns a DataTree
BackendEntrypoint.open_dataset
method as starting point (with similar prototype implementation details as in existing docs)open_datatree
method)
open_dataset
(filename_or_obj
, drop_variables
(Q: how to handle variables of same name in different groups?), mask_and_scale
, decode_times
, use_cftime
, concat_characters
, decode_coords
)numpy.ndarray
or lazy loading BackendArray
subclassThe following (reimplemented from existing open_dataset
) is an example of the high level processing steps:
def open_datatree(
self,
filename_or_obj,
*,
drop_variables=None,
decode_times=True,
decode_timedelta=True,
decode_coords=True,
my_backend_option=None,
):
import datatree
vars, attrs, coords = my_reader(
filename_or_obj,
drop_variables=drop_variables,
my_backend_option=my_backend_option,
)
vars, attrs, coords = my_decode_variables(
vars, attrs, decode_times, decode_timedelta, decode_coords
) # see also conventions.decode_cf_variables
datasets = my_assemble_groups(vars, attrs, coords)
dt = datatree.DataTree.from_dict(datasets)
dt.set_close(my_close_method)
return dt
(Note that this is only one method a backend could implement; alternatively the children/parent nodes could be constructed iteratively through DataTree.__init__
)
Points of uncertainty:
DataTree
, how to handle NotImplemented
?BackendEntrypoint
presently has open_dataset_parameters
. Should this apply to DataTree
identically, or should there be a separate open_datatree_parameters
method?
depth=3
)…
Tom: Let's try and make a start on the cfgrib backend too?
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing