xarray-contrib / xarray-schema

Schema validation for Xarray objects
https://xarray-schema.readthedocs.io/en/latest/index.html
MIT License
39 stars 8 forks source link

Extract schema from xarray objects #45

Open jhamman opened 2 years ago

jhamman commented 2 years ago

One way users may want to generate schemas is from xarray objects directly. We could add a utility here that supports this workflow.

This could be a function

schema = create_schema(ds)

Or a class method:

schema = DatasetSchema.from_dataset(ds)

Or as an Xarray accessor extension:

schema = ds.schema.create()