hydromt_wflow.WflowSbmModel#
- class WflowSbmModel(root: str | None = None, config_filename: str | None = None, mode: str = 'w', data_libs: list[str] | str | None = None, **catalog_keys)[source]#
Class to read, write, build, update wflow-SBM models.
This class provides methods to manipulate the wflow-SBM model components and their data. It extends the
hydromt_wflow.WflowBaseModelwith specific methods for the setup of the wflow-SBM model schematisation.- Parameters:
root (str, optional) – Model root, by default None (current working directory)
config_filename (str, optional) – A path relative to the root where the configuration file will be read and written if user does not provide a path themselves. By default “wflow_sbm.toml”
mode ({'r','r+','w'}, optional) – read/append/write mode, by default “w”
data_libs (list[str] | str, optional) – List of data catalog configuration files, by default None
**catalog_keys – Additional keyword arguments to be passed down to the DataCatalog.
- __init__(root: str | None = None, config_filename: str | None = None, mode: str = 'w', data_libs: list[str] | str | None = None, **catalog_keys)[source]#
Initialize a model.
- Parameters:
root (str, Path, optional) – Model root, by default the current working directory:
Path.cwd()components (Dict[str, Any], optional) –
Dictionary of components to add to the model, by default None Every entry in this dictionary contains the name of the component as key, and the component object as value, or a dictionary with options passed to the component initializers. If a component is a dictionary, the key ‘type’ should be provided with the name of the component type.
{ "grid": { "type": "GridComponent", "filename": "path/to/grid.nc" } }
mode ({'r','r+','w'}, optional) – read/append/write mode, by default “w”
data_libs (List[str], optional) – List of data catalog configuration files, by default None
region_component (str, optional) – The name of the region component in the components dictionary. If None, the model will can automatically determine the region component if there is only one SpatialModelComponent. Otherwise it will raise an error. If there are no SpatialModelComponent it will raise a warning that region functionality will not work.
**catalog_keys – Additional keyword arguments to be passed down to the DataCatalog.
Methods
__init__([root, config_filename, mode, ...])Initialize a model.
add_component(name, component)Add a component to the model.
build(*[, write])Single method to build a model from scratch based on settings in steps.
clip(region[, inverse_clip, clip_forcing, ...])Clip model to region.
close()Close all components by closing their open files.
from_dict(model_dict)Construct a model with the components and other init arguments in the yaml file located at path.
from_yml(path)Construct a model with the components and other init arguments in the yaml file located at path.
get_component(name)Get a component from the model.
read([config_filename, geoms_folder])Read components from disk.
read_outputs()Read outputs at <root/dir_output>.
set_flwdir([ftype])Parse pyflwdir.FlwdirRaster object parsed from the wflow ldd.
set_states(data[, name])Add data to states.
setup_1dmodel_connection(river1d_fn[, ...])Connect wflow to a 1D model by deriving linked subcatch (and tributaries).
setup_allocation_areas(waterareas_fn[, ...])Create water demand allocation areas.
setup_allocation_surfacewaterfrac(gwfrac_fn)Create the fraction of water allocated from surface water.
setup_areamap(area_fn, col2raster[, nodata, ...])Set area map from vector data to save wflow outputs for specific area.
setup_basemaps(region, hydrography_fn[, ...])Build the DEM and flow direction for a Wflow model.
setup_cold_states([timestamp])Prepare cold states for Wflow.
setup_config(data)Set the config dictionary at key(s) with values.
setup_config_output_timeseries(mapname[, ...])Set the default gauge map based on basin outlets.
setup_constant_pars(**kwargs)Generate constant parameter maps for all active model cells.
setup_domestic_demand(domestic_fn[, ...])Prepare domestic water demand maps from a raster dataset.
setup_domestic_demand_from_population(...[, ...])Prepare domestic water demand maps from statistics per capita.
setup_floodplains(hydrography_fn, ...[, ...])Add floodplain information to the model schematisation.
setup_gauges(gauges_fn[, index_col, ...])Set a gauge map based on
gauges_fndata.setup_glaciers(glaciers_fn[, min_area, ...])Generate maps of glacier areas, area fraction and volume fraction.
setup_grid_from_raster(raster_fn, ...[, ...])Add data variable(s) from
raster_fnto grid object.setup_irrigation(irrigated_area_fn, ...[, ...])Add required information to simulate irrigation water demand from grid.
setup_irrigation_from_vector(...[, ...])Add required information to simulate irrigation water demand from vector.
setup_ksathorfrac(ksat_fn[, variable, ...])Set KsatHorFrac parameter values from a predetermined map.
setup_ksatver_vegetation([soil_fn, alfa, ...])Correct vertical saturated hydraulic conductivity with vegetation properties.
setup_laimaps(lai_fn[, lulc_fn, ...])Set leaf area index (LAI) climatology maps per month [1,2,3,...,12].
setup_laimaps_from_lulc_mapping(lulc_fn, ...)Derive cyclic LAI maps from a LULC data source and a LULC-LAI mapping table.
setup_lulcmaps(lulc_fn, *[, ...])Derive several wflow maps based on landuse-landcover (LULC) data.
setup_lulcmaps_from_vector(lulc_fn, *[, ...])Derive several wflow maps based on vector landuse-landcover (LULC) data.
setup_lulcmaps_with_paddy(lulc_fn, *, ...[, ...])Set up landuse maps and parameters including for paddy fields.
setup_other_demand(demand_fn[, variables, ...])Create water demand maps from other sources (e.g. industry, livestock).
setup_outlets([river_only, toml_output, ...])Set the default gauge map based on basin outlets.
setup_pet_forcing(pet_fn[, chunksize])Prepare PET forcing from existig PET data.
setup_precip_forcing(precip_fn[, ...])Generate gridded precipitation forcing at model resolution.
setup_precip_from_point_timeseries(precip_fn)Generate gridded precipitation from point timeseries (requires wradlib).
setup_reservoirs_no_control(reservoirs_fn[, ...])Generate maps of reservoir areas, outlets and parameters.
setup_reservoirs_simple_control(reservoirs_fn)Generate maps of controlled reservoir areas, outlets and parameters.
setup_river_roughness([rivman_mapping_fn, ...])Set river Manning roughness coefficient for SBM.
setup_rivers(hydrography_fn[, ...])Set full river parameter maps including river depth and bank elevation.
setup_riverwidth([predictor, fill, fit, ...])Set the river width parameter based on power-law relationship with a predictor.
setup_rootzoneclim(run_fn, forcing_obs_fn[, ...])Set the vegetation_root_depth.
setup_soilmaps([soil_fn, ptf_ksatver, ...])Derive several (layered) soil parameters.
setup_temp_pet_forcing(temp_pet_fn[, ...])Generate gridded temperature and reference evapotranspiration forcing.
test_equal(other)Test if two models are equal, based on their components.
update(*[, model_out, write, steps, ...])Single method to update a model based the settings in steps.
Upgrade the model to wflow v1 format.
write([config_filename, grid_filename, ...])Write the complete model schematization and configuration to file.
write_data_catalog([root, data_lib_path, ...])Write the data catalog to data_lib_path.
Attributes
Returns a basin(s) geometry as a geopandas.GeoDataFrame.
basins_highresReturns a high resolution basin(s) geometry.
configReturn the config component.
Returns coordinate reference system embedded in region.
Return the pyflwdir.FlwdirRaster object parsed from wflow ldd.
forcingReturn the forcing component.
geomsReturn the geoms component.
nameoutput_csvReturn the WflowOutputCsvComponent instance.
output_gridReturn the WflowOutputGridComponent instance.
output_scalarReturn the WflowOutputScalarComponent instance.
regionReturn the model's region component.
Return a river geometry as a geopandas.GeoDataFrame.
statesReturn the states component.
staticmapsReturn the staticmaps component.
tablesReturn the WflowTablesComponent instance.
data_catalogDataCatalog for data access
Model root