hydromt_wflow.components.WflowOutputScalarComponent#

Summary of Methods and Attributes#

class WflowOutputScalarComponent(model: Model, *, filename: str = 'output_scalar.nc')[source]#

Bases: ModelComponent

ModelComponent class for Wflow netcdf_scalar output.

This class is used for reading the Wflow netcdf_scalar output.

The overall output netcdf_scalar component data stored in the data property of this class is a xarray.Dataset.

read()[source]#

Read netcdf_scalar model output at root/dir_output/filename.

Checks the path of the file in the config toml using both output.netcdf_scalar.path and dir_output. If not found uses the default path output_scalar.nc in the root folder.

Parameters:

**kwargs (dict) – Additional keyword arguments to be passed to the read_nc method.

write()[source]#

Skip writing output files.

Output files are model results and are therefore not written by HydroMT.

set(data: DataArray | Dataset, name: str | None = None)[source]#

Add data to netcdf_scalar output.

Parameters:
  • data (xarray.DataArray or xarray.Dataset) – new map layer to add to netcdf_scalar output

  • name (str, optional) – Name of new map layer, this is used to overwrite the name of a DataArray and ignored if data is a Dataset

property data: Dataset#

Model netcdf_scalar output data as xarray.Dataset.

test_equal(other: ModelComponent) tuple[bool, dict[str, str]][source]#

Test if two components are equal.

Parameters:

other (ModelComponent) – The component to compare against.

Returns:

True if the components are equal, and a dict with the associated errors per property checked.

Return type:

Tuple[bool, Dict[str, str]]

close() None#

Clean up all open datasets. Method to be called before finish_write.

property data_catalog: DataCatalog#

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

finish_write()#

Finish the write functionality after cleanup was called for all components in the model.

All DeferredFileClose objects can overwrite any lazy loaded files now.

property model: Model#

Return the model object this component is associated with.

property name_in_model: str#

Find the name of the component in the parent model components.

property root: ModelRoot#

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