hydromt_wflow.components.WflowStatesComponent#
- class hydromt_wflow.components.WflowStatesComponent(model: Model, *, filename: str = 'instate/instates.nc', region_component: str | None = None, region_filename: str | None = 'staticgeoms/states_region.geojson')[source]#
ModelComponent class for Wflow states.
This class is used for setting, creating, writing, and reading the Wflow states. The states component data stored in the
dataproperty of this class is of the hydromt.gis.raster.RasterDataset type which is an extension of xarray.Dataset for regular grid.Initialize the Wflow states component.
- Parameters:
model (Model) – HydroMT model instance.
filename (str, optional) – Default path relative to the root where the states file will be read and written. By default ‘instate/instates.nc’.
region_component (str, optional) – Name of the region component to align the states data with. If provided, the states data will be aligned with the grid of this component. By default None.
region_filename (str, optional) – A path relative to the root where the region file will be written. By default ‘staticgeoms/states_region.geojson’.
- __init__(model: Model, *, filename: str = 'instate/instates.nc', region_component: str | None = None, region_filename: str | None = 'staticgeoms/states_region.geojson')[source]#
Initialize the Wflow states component.
- Parameters:
model (Model) – HydroMT model instance.
filename (str, optional) – Default path relative to the root where the states file will be read and written. By default ‘instate/instates.nc’.
region_component (str, optional) – Name of the region component to align the states data with. If provided, the states data will be aligned with the grid of this component. By default None.
region_filename (str, optional) – A path relative to the root where the region file will be written. By default ‘staticgeoms/states_region.geojson’.
Methods
__init__(model, *[, filename, ...])Initialize the Wflow states component.
clip([reservoir_name, reservoir_states])Clip the states component to the region of the region component.
close()Clean up all open datasets.
drop_vars(names[, errors])Drop variables from the states.
finish_write()Finish the write functionality after cleanup was called for all components in the model.
get_mask_layer(mask, *args)Get the proper mask layer based on itself or a layer in a Dataset.
read()Read states at <root/dir_input/state.path_input>.
set(data[, name])Set the states data.
test_equal(other)Test if two staticmaps components are equal.
write([filename])Write states at <root/dir_input/state.path_input> in model ready format.
write_region([filename, to_wgs84])Write the model region to file.
Attributes
boundsReturns the bounding box of the model grid.
crsReturns coordinate reference system embedded in the model grid.
Model static gridded data as xarray.Dataset.
data_catalogReturn the data catalog of the model this component is associated with.
modelReturn the model object this component is associated with.
name_in_modelFind the name of the component in the parent model components.
regionProvide access to the underlying GeoDataFrame data of the model region.
resReturns the resolution of the model grid.
rootReturn the root of the model this component is associated with.
transformReturns spatial transform of the model grid.