xarray_schema.DataArraySchema

class xarray_schema.DataArraySchema(dtype=None, shape=None, dims=None, name=None, coords=None, chunks=None, array_type=None, attrs=None, checks=None)

A light-weight xarray.DataArray validator

Parameters:
  • dtype (DTypeLike or DTypeSchema, optional) – Datatype of the the variable. If a string is specified it must be a valid NumPy data type value, by default None

  • shape (ShapeT or ShapeSchema, optional) – Shape of the DataArray. None may be used as a wildcard value. By default None

  • dims (DimsT or DimsSchema, optional) – Dimensions of the DataArray. None may be used as a wildcard value. By default None

  • chunks (Union[bool, Dict[str, Union[int, None]]], optional) – If bool, specifies whether DataArray is chunked or not, agnostic to chunk sizes. If dict, includes the expected chunks for the DataArray, by default None

  • name (str, optional) – Name of the DataArray, by default None

  • array_type (Any, optional) – Type of the underlying data in a DataArray (e.g. numpy.ndarray), by default None

  • checks (List[Callable], optional) – List of callables that take and return a DataArray, by default None

__init__(dtype=None, shape=None, dims=None, name=None, coords=None, chunks=None, array_type=None, attrs=None, checks=None)

Methods

__init__([dtype, shape, dims, name, coords, ...])

from_json(obj)

to_json(**dumps_kws)

Generate a JSON string representation of this schema

validate(da)

Check if the DataArray complies with the Schema.

Attributes

array_type

attrs

checks

chunks

coords

dims

dtype

json

name

shape