hydromt.model.components.DatasetsComponent#

class hydromt.model.components.DatasetsComponent(model: Model, filename: str = 'datasets/{name}.nc')[source]#

A component to manage collections of Xarray objects.

It contains a dictionary of xarray DataArray or Dataset objects.

Initialize a DatasetsComponent.

Parameters:
  • model (Model) – HydroMT model instance

  • filename (str) – The path to use for reading and writing of component data by default. by default “datasets/{name}.nc” ie one file per dataset in the data dictionary.

__init__(model: Model, filename: str = 'datasets/{name}.nc')[source]#

Initialize a DatasetsComponent.

Parameters:
  • model (Model) – HydroMT model instance

  • filename (str) – The path to use for reading and writing of component data by default. by default “datasets/{name}.nc” ie one file per dataset in the data dictionary.

Methods

__init__(model[, filename])

Initialize a DatasetsComponent.

read([filename, single_var_as_array])

Read model dataset files at <root>/<filename>.

set(data[, name, split_dataset])

Add data to the xarray component.

test_equal(other)

Test if two DatasetsComponents are equal.

write([filename, gdal_compliant, ...])

Write dictionary of xarray.Dataset and/or xarray.DataArray to netcdf files.

Attributes

data

Model data in the form of xarray objects.

data_catalog

Return the data catalog of the model this component is associated with.

model

Return the model object this component is associated with.

root

Return the root of the model this component is associated with.