Skip to content

Support for xarray-datatrees? #82

@ahuang11

Description

@ahuang11

Hi! Amazing documentation and really excited for this. Was wondering if it'd be valuable to have a from_datatree method:

import numpy as np
import xarray as xr
from xarray_sql import XarrayContext

data = xr.DataArray(np.random.randn(2, 3), dims=("x", "y"), coords={"x": [10, 20]})
ds = xr.Dataset({"foo": data, "bar": ("x", [1, 2]), "baz": np.pi})
ds

ds2 = ds.interp(coords={"x": [10, 12, 14, 16, 18, 20]})
ds2

ds3 = xr.Dataset(
    {"people": ["alice", "bob"], "heights": ("people", [1.57, 1.82])},
    coords={"species": "human"},
)
ds3

dt = xr.DataTree.from_dict({"simulation/coarse": ds, "simulation/fine": ds2, "/": ds3})
dt

XarrayContext.from_datatree(dt)

Which would simply loop through each dataset and register them?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions