ValidDataset#

class ethology.validators.utils.ValidDataset(dataset)[source]#

Bases: ABC

An abstract base class for valid ethology datasets.

This class validates that the input dataset:

  • is an xarray Dataset

  • contains all required dimensions

  • contains all required data variables

  • has the correct dimensions for each data variable

Subclasses must define required_dims and required_data_vars attributes.

dataset#

The xarray dataset to validate.

Type:

xarray.Dataset

required_dims#

A set of required dimension names. This attribute should be defined by any subclass inheriting from this class.

Type:

set[str]

required_data_vars#

A dictionary mapping data variable names to their required dimensions. This attribute should be defined by any subclass inheriting from this class.

Type:

dict[str, set]

Raises:
  • TypeError – If the input is not an xarray Dataset.

  • ValueError – If the dataset is missing required data variables or dimensions, or if any required dimensions are missing for any data variable.

Notes

The dataset can have other data variables and dimensions, but only the required ones are checked.