xarray-contrib/xarray-schema

Fill out the DatasetSchema routines

orianac opened this issue · 2 comments

I think we want to leverage the existing DataArray schema routines inside the Dataset schema, and check each variable in the Dataset using a specified schema. It seems then that the construction of the Dataset schema might just be a dictionary of data array schemas. The DatasetSchema.validate() would then return a Dataset upon passing.

A note: currently with only DataArray validation implemented, validating a Dataset involves extracting the variable from the dataset into a DataArray which then means that a DataArray is returned.

We currently do have DatasetSchema.validate() implemented and, as you suggest, the constructor takes a dictionary of DataArraySchema objects. Under the hood there is just a for loop validating each DataArray separately:

https://github.com/carbonplan/xarray-schema/blob/27648a80b06364ef4cfd8011fb264dbebb8a666b/xarray_schema/core.py#L173-L179

Other than some docs highlighting that this exists, is there anything else missing that you'd like to see here?

OH EXCELLENT. In that case yes, I want more docs about that since I didn't understand the usage. See PR #5