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 instancefilename (
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 instancefilename (
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.
close
()Clean up all open datasets.
finish_write
()Finish the write functionality after cleanup was called for all components in the model.
read
([filename])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
Model data in the form of xarray objects.
Return the data catalog of the model this component is associated with.
Return the model object this component is associated with.
name_in_model
Find the name of the component in the parent model components.
Return the root of the model this component is associated with.