API reference#

Wflow model class#

Initialize#

WflowModel([root, mode, config_fn, ...])

This is the wflow model class

Setup components#

WflowModel.setup_config(**cfdict)

Update config with a dictionary.

WflowModel.setup_basemaps(region[, res, ...])

This component sets the region of interest and res (resolution in degrees) of the model.

WflowModel.setup_rivers(hydrography_fn[, ...])

This component sets the all river parameter maps.

WflowModel.setup_floodplains(hydrography_fn, ...)

This components adds floodplain information to the model schematistation.

WflowModel.setup_lakes(lakes_fn[, ...])

This component generates maps of lake areas and outlets as well as parameters with average lake area, depth and discharge values.

WflowModel.setup_reservoirs(reservoirs_fn[, ...])

This component generates maps of reservoir areas and outlets as well as parameters with average reservoir area, demand, min and max target storage capacities and discharge capacity values.

WflowModel.setup_glaciers([glaciers_fn, ...])

This component generates maps of glacier areas, area fraction and volume fraction, as well as tables with temperature threshold, melting factor and snow-to-ice convertion fraction.

WflowModel.setup_lulcmaps([lulc_fn, ...])

This component derives several wflow maps are derived based on landuse- landcover (LULC) data.

WflowModel.setup_laimaps([lai_fn])

This component sets leaf area index (LAI) climatology maps per month.

WflowModel.setup_rootzoneclim(run_fn, ...[, ...])

This component sets up the RootingDepth by estimating the catchment-scale root-zone storage capacity from observed hydroclimatic data (and optionally also for climate change historical and future periods).

WflowModel.setup_soilmaps([soil_fn, ptf_ksatver])

This component derives several (layered) soil parameters based on a database with physical soil properties using available point-scale (pedo)transfer functions (PTFs) from literature with upscaling rules to ensure flux matching across scales.

WflowModel.setup_outlets([river_only, ...])

This components sets the default gauge map based on basin outlets.

WflowModel.setup_gauges(gauges_fn[, ...])

This components sets a gauge map based on gauges_fn data.

WflowModel.setup_areamap(area_fn, col2raster)

Setup area map from vector data to save wflow outputs for specific area.

WflowModel.setup_config_output_timeseries(mapname)

This components sets the default gauge map based on basin outlets.

WflowModel.setup_precip_forcing([precip_fn, ...])

Setup gridded precipitation forcing at model resolution.

WflowModel.setup_temp_pet_forcing([...])

Setup gridded reference evapotranspiration forcing at model resolution.

WflowModel.setup_constant_pars([dtype, nodata])

Setup constant parameter maps for all active model cells.

WflowModel.setup_staticmaps_from_raster(...)

This component adds data variable(s) from raster_fn to staticmaps object.

Attributes#

WflowModel.region

Returns the geometry of the model area of interest.

WflowModel.crs

Returns coordinate reference system embedded in region.

WflowModel.res

Returns the resolution of the model staticmaps.

WflowModel.root

Path to model folder.

WflowModel.config

Model configuration.

WflowModel.staticmaps

Model static maps.

WflowModel.staticgeoms

Access the geometryes.

WflowModel.forcing

Model forcing.

WflowModel.states

Model states.

WflowModel.results

Model results.

WflowModel.tables

Returns a dictionary of pandas.DataFrames representing the wflow intbl files.

WflowModel.flwdir

Returns the pyflwdir.FlwdirRaster object parsed from the wflow ldd.

WflowModel.basins

Returns a basin(s) geometry as a geopandas.GeoDataFrame.

WflowModel.rivers

Returns a river geometry as a geopandas.GeoDataFrame.

High level methods#

WflowModel.read()

Method to read the complete model schematization and configuration from file.

WflowModel.write()

Method to write the complete model schematization and configuration to file.

WflowModel.build([region, write, opt])

Single method to build a model from scratch based on settings in opt.

WflowModel.update([model_out, write, opt])

Single method to update a model based the settings in opt.

WflowModel.set_root(root[, mode])

Initialize the model root.

General methods#

WflowModel.setup_config(**cfdict)

Update config with a dictionary.

WflowModel.get_config(*args[, fallback, ...])

Get a config value at key(s).

WflowModel.set_config(*args)

Update the config dictionary at key(s) with values.

WflowModel.read_config([config_fn])

Parse config from file.

WflowModel.write_config([config_name, ...])

Write config to <root/config_fn>.

WflowModel.set_staticmaps(data[, name])

Add data to staticmaps.

WflowModel.read_staticmaps(**kwargs)

Read staticmaps

WflowModel.write_staticmaps()

Write staticmaps

WflowModel.clip_staticmaps(region[, buffer, ...])

Clip staticmaps to subbasin.

WflowModel.read_staticmaps_pcr([crs])

Read and staticmaps at <root/staticmaps> and parse to xarray

WflowModel.write_staticmaps_pcr()

Write staticmaps at <root/staticmaps> in PCRaster maps format.

WflowModel.set_staticgeoms(geom, name)

Set the geometries.

WflowModel.read_staticgeoms()

Read and staticgeoms at <root/staticgeoms> and parse to geopandas

WflowModel.write_staticgeoms()

Write staticmaps at <root/staticgeoms> in model ready format

WflowModel.set_forcing(data[, name, ...])

Add data to forcing attribute.

WflowModel.read_forcing()

Read forcing

WflowModel.write_forcing([fn_out, freq_out, ...])

write forcing at fn_out in model ready format.

WflowModel.clip_forcing([crs])

Return clippped forcing for subbasin.

WflowModel.set_states(data[, name, ...])

Add data to states attribute.

WflowModel.read_states()

Read states at <root/?/> and parse to dict of xr.DataArray

WflowModel.write_states()

write states at <root/?/> in model ready format

WflowModel.set_results(data[, name, ...])

Add data to results attribute.

WflowModel.read_results()

Read results at <root/?/> and parse to dict of xr.DataArray/xr.Dataset

WflowModel.set_tables(df, name)

Add table <pandas.DataFrame> to model.

WflowModel.read_tables(**kwargs)

Read table files at <root> and parse to dict of dataframes

WflowModel.write_tables()

Write tables at <root>.

WflowModel.set_flwdir([ftype])

Parse pyflwdir.FlwdirRaster object parsed from the wflow ldd

WflowSediment model class#

Initialize#

WflowSedimentModel([root, mode, config_fn, ...])

This is the wflow sediment model class, a subclass of WflowModel

Setup components#

WflowSedimentModel.setup_config(**cfdict)

Update config with a dictionary.

WflowSedimentModel.setup_basemaps(region[, ...])

This component sets the region of interest and res (resolution in degrees) of the model.

WflowSedimentModel.setup_rivers(*args, **kwargs)

This components copies the functionality of WflowModel, but removes the river_routing key from the config

WflowSedimentModel.setup_lakes([lakes_fn, ...])

This component generates maps of lake areas and outlets as well as parameters with average lake area, depth a discharge values.

WflowSedimentModel.setup_reservoirs(...[, ...])

This component generates maps of lake areas and outlets as well as parameters with average reservoir area, demand, min and max target storage capacities and discharge capacity values.

WflowSedimentModel.setup_lulcmaps([lulc_fn, ...])

This component derives several wflow maps are derived based on landuse- landcover (LULC) data.

WflowSedimentModel.setup_laimaps([lai_fn])

This component sets leaf area index (LAI) climatology maps per month.

WflowSedimentModel.setup_canopymaps([canopy_fn])

Setup sediments based canopy height maps.

WflowSedimentModel.setup_soilmaps([soil_fn, ...])

Setup sediments based soil parameter maps.

WflowSedimentModel.setup_riverwidth([...])

This component sets the river width parameter based on a power-lay relationship with a predictor.

WflowSedimentModel.setup_riverbedsed([...])

Setup sediments based river bed characteristics maps.

WflowSedimentModel.setup_outlets([...])

This components sets the default gauge map based on basin outlets.

WflowSedimentModel.setup_gauges([gauges_fn, ...])

This components sets a gauge map based on gauges_fn data.

WflowSedimentModel.setup_areamap(area_fn, ...)

Setup area map from vector data to save wflow outputs for specific area.

WflowSedimentModel.setup_config_output_timeseries(mapname)

This components sets the default gauge map based on basin outlets.

WflowSedimentModel.setup_constant_pars([...])

Setup constant parameter maps for all active model cells.

WflowSedimentModel.setup_staticmaps_from_raster(...)

This component adds data variable(s) from raster_fn to staticmaps object.

Attributes#

WflowSedimentModel.region

Returns the geometry of the model area of interest.

WflowSedimentModel.crs

Returns coordinate reference system embedded in region.

WflowSedimentModel.res

Returns the resolution of the model staticmaps.

WflowSedimentModel.root

Path to model folder.

WflowSedimentModel.config

Model configuration.

WflowSedimentModel.staticmaps

Model static maps.

WflowSedimentModel.staticgeoms

Access the geometryes.

WflowSedimentModel.forcing

Model forcing.

WflowSedimentModel.states

Model states.

WflowSedimentModel.results

Model results.

WflowSedimentModel.flwdir

Returns the pyflwdir.FlwdirRaster object parsed from the wflow ldd.

WflowSedimentModel.basins

Returns a basin(s) geometry as a geopandas.GeoDataFrame.

WflowSedimentModel.rivers

Returns a river geometry as a geopandas.GeoDataFrame.

High level methods#

WflowSedimentModel.read()

Method to read the complete model schematization and configuration from file.

WflowSedimentModel.write()

Method to write the complete model schematization and configuration to file.

WflowSedimentModel.build([region, write, opt])

Single method to build a model from scratch based on settings in opt.

WflowSedimentModel.update([model_out, ...])

Single method to update a model based the settings in opt.

WflowSedimentModel.set_root(root[, mode])

Initialize the model root.

General methods#

WflowSedimentModel.setup_config(**cfdict)

Update config with a dictionary.

WflowSedimentModel.get_config(*args[, ...])

Get a config value at key(s).

WflowSedimentModel.set_config(*args)

Update the config dictionary at key(s) with values.

WflowSedimentModel.read_config([config_fn])

Parse config from file.

WflowSedimentModel.write_config([...])

Write config to <root/config_fn>.

WflowSedimentModel.set_staticmaps(data[, name])

Add data to staticmaps.

WflowSedimentModel.read_staticmaps(**kwargs)

Read staticmaps

WflowSedimentModel.write_staticmaps()

Write staticmaps

WflowSedimentModel.clip_staticmaps(region[, ...])

Clip staticmaps to subbasin.

WflowSedimentModel.set_staticgeoms(geom, name)

Set the geometries.

WflowSedimentModel.read_staticgeoms()

Read and staticgeoms at <root/staticgeoms> and parse to geopandas

WflowSedimentModel.write_staticgeoms()

Write staticmaps at <root/staticgeoms> in model ready format

WflowSedimentModel.set_forcing(data[, name, ...])

Add data to forcing attribute.

WflowSedimentModel.read_forcing()

Read forcing

WflowSedimentModel.write_forcing([fn_out, ...])

write forcing at fn_out in model ready format.

WflowSedimentModel.clip_forcing([crs])

Return clippped forcing for subbasin.

WflowSedimentModel.set_states(data[, name, ...])

Add data to states attribute.

WflowSedimentModel.read_states()

Read states at <root/?/> and parse to dict of xr.DataArray

WflowSedimentModel.write_states()

write states at <root/?/> in model ready format

WflowSedimentModel.set_results(data[, name, ...])

Add data to results attribute.

WflowSedimentModel.read_results()

Read results at <root/?/> and parse to dict of xr.DataArray/xr.Dataset

WflowSedimentModel.set_flwdir([ftype])

Parse pyflwdir.FlwdirRaster object parsed from the wflow ldd

Wflow workflows#

workflows.hydrography(ds, res[, xy, ...])

Returns hydrography maps (see list below) and FlwdirRaster object based on gridded flow direction and elevation data input.

workflows.topography(ds, ds_like[, ...])

Returns topography maps (see list below) at model resolution based on gridded elevation data input.

workflows.river(ds[, ds_model, river_upa, ...])

Returns river maps

workflows.river_bathymetry(ds_model, gdf_riv)

Get river width and bankfull discharge from gdf_riv to estimate river depth using hydromt.workflows.river_depth().

workflows.landuse(da, ds_like, df[, logger, ...])

Returns landuse map and related parameter maps.

workflows.soilgrids(ds, ds_like, ptfKsatVer, ...)

Returns soil parameter maps at model resolution based on soil properties from SoilGrids datasets.

workflows.soilgrids_sediment(ds, ds_like, ...)

Returns soil parameter maps for sediment modelling at model resolution based on soil properties from SoilGrids dataset.

workflows.waterbodymaps(gdf, ds_like[, ...])

Returns waterbody (reservoir/lake) maps (see list below) at model resolution based on gridded upstream area data input or outlet coordinates.

workflows.reservoirattrs(gdf[, ...])

Returns reservoir attributes (see list below) needed for modelling.

workflows.lakeattrs(ds, gdf[, rating_dict, ...])

Returns lake attributes (see list below) needed for modelling.

workflows.glaciermaps(gdf, ds_like[, ...])

Returns glacier maps (see list below) at model resolution.

workflows.glacierattrs(gdf[, TT, Cfmax, ...])

Returns glacier intbls (see list below).

workflows.rootzoneclim(dsrun, ds_obs, ...[, ...])

Estimates the root zone storage parameter for current observed and (optionally for) future climate-based streamflow data.

Wflow low-level methods#

Input/Output methods#

read_csv_results(fn, config, maps)

Read wflow results csv timeseries and parse to dictionnary