API reference#

Wflow model class#

Initialize#

WflowModel([root, config_path, mode, data_libs])

Read or Write a wflow model.

Setup components#

WflowModel.setup_basemaps(region, hydrography_fn)

Build the DEM and flow direction for a Wflow model.

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

Set all river parameter maps.

WflowModel.setup_floodplains(hydrography_fn, ...)

Add floodplain information to the model schematisation.

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

Generate maps of lake areas and outlets.

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

Generate maps of reservoir areas and outlets.

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

Generate maps of glacier areas, area fraction and volume fraction.

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

Derive several wflow maps based on landuse-landcover (LULC) data.

WflowModel.setup_lulcmaps_from_vector(lulc_fn)

Derive several wflow maps based on vector landuse-landcover (LULC) data.

WflowModel.setup_lulcmaps_with_paddy(...[, ...])

Set up landuse maps and parameters including for paddy fields.

WflowModel.setup_laimaps(lai_fn[, lulc_fn, ...])

Set leaf area index (LAI) climatology maps per month [1,2,3,...,12].

WflowModel.setup_laimaps_from_lulc_mapping(...)

Derive cyclic LAI maps from a LULC data source and a LULC-LAI mapping table.

WflowModel.setup_allocation_areas(waterareas_fn)

Create water demand allocation areas.

WflowModel.setup_allocation_surfacewaterfrac(...)

Create the fraction of water allocated from surface water.

WflowModel.setup_domestic_demand(domestic_fn)

Prepare domestic water demand maps from a raster dataset.

WflowModel.setup_domestic_demand_from_population(...)

Prepare domestic water demand maps from statistics per capita.

WflowModel.setup_other_demand(demand_fn[, ...])

Create water demand maps from other sources (e.g. industry, livestock).

WflowModel.setup_irrigation(...[, ...])

Add required information to simulate irrigation water demand from grid.

WflowModel.setup_irrigation_from_vector(...)

Add required information to simulate irrigation water demand from vector.

WflowModel.setup_ksathorfrac(ksat_fn[, ...])

Set KsatHorFrac parameter values from a predetermined map.

WflowModel.setup_ksatver_vegetation([...])

Calculate KsatVer values from vegetation in addition to soil characteristics.

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

Set the RootingDepth.

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

Derive several (layered) soil parameters.

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

Set the default gauge map based on basin outlets.

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

Set a gauge map based on gauges_fn data.

WflowModel.setup_areamap(area_fn, col2raster)

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

WflowModel.setup_config_output_timeseries(mapname)

Set the default gauge map based on basin outlets.

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

Generate gridded precipitation forcing at model resolution.

WflowModel.setup_precip_from_point_timeseries(...)

Generate gridded precipitation from point timeseries (requires wradlib).

WflowModel.setup_temp_pet_forcing(temp_pet_fn)

Generate gridded temperature and reference evapotranspiration forcing.

WflowModel.setup_pet_forcing(pet_fn[, chunksize])

Prepare PET forcing from existig PET data.

WflowModel.setup_constant_pars(**kwargs)

Generate constant parameter maps for all active model cells.

WflowModel.setup_1dmodel_connection(river1d_fn)

Connect wflow to a 1D model by deriving linked subcatch (and tributaries).

WflowModel.setup_grid_from_raster(raster_fn, ...)

Add data variable(s) from raster_fn to grid object.

WflowModel.setup_cold_states([timestamp])

Prepare cold states for Wflow.

WflowModel.upgrade_to_v1_wflow()

Upgrade the model to wflow v1 format.

Attributes#

WflowModel.region

Return the model's region component.

WflowModel.crs

Returns coordinate reference system embedded in region.

WflowModel.root

Model root

High level methods#

WflowModel.read([components])

Read provided components from disk.

WflowModel.write([config_fn, grid_fn, ...])

Write the complete model schematization and configuration to file.

WflowModel.build(*[, write])

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

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

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

General methods#

WflowSediment model class#

Initialize#

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

The wflow sediment model class, a subclass of WflowModel.

Setup components#

WflowSedimentModel.setup_basemaps(region, ...)

Build the DEM and flow direction for a Wflow model.

WflowSedimentModel.setup_rivers(hydrography_fn)

Set all river parameter maps.

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

Generate maps of lake areas and outlets.

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

Generate maps of reservoir areas and outlets.

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

Derive several wflow maps based on landuse-landcover (LULC) data.

WflowSedimentModel.setup_lulcmaps_from_vector(lulc_fn)

Derive several wflow maps based on vector landuse-landcover (LULC) data.

WflowSedimentModel.setup_laimaps(lai_fn[, ...])

Set leaf area index (LAI) climatology maps per month [1,2,3,...,12].

WflowSedimentModel.setup_laimaps_from_lulc_mapping(...)

Derive cyclic LAI maps from a LULC data source and a LULC-LAI mapping table.

WflowSedimentModel.setup_canopymaps(canopy_fn)

Generate sediments based canopy height maps.

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

Generate sediments based soil parameter maps.

WflowSedimentModel.setup_riverwidth([...])

Set the river width parameter based on power-law relationship with a predictor.

WflowSedimentModel.setup_riverbedsed([...])

Generate sediments based river bed characteristics maps.

WflowSedimentModel.setup_outlets([...])

Set the default gauge map based on basin outlets.

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

Set a gauge map based on gauges_fn data.

WflowSedimentModel.setup_areamap(area_fn, ...)

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

WflowSedimentModel.setup_config_output_timeseries(mapname)

Set the default gauge map based on basin outlets.

WflowSedimentModel.setup_constant_pars(**kwargs)

Generate constant parameter maps for all active model cells.

WflowSedimentModel.setup_grid_from_raster(...)

Add data variable(s) from raster_fn to grid object.

WflowSedimentModel.upgrade_to_v1_wflow([...])

Upgrade the model to wflow v1 format.

Attributes#

WflowSedimentModel.region

Return the model's region component.

WflowSedimentModel.crs

Returns coordinate reference system embedded in region.

WflowSedimentModel.root

Model root

High level methods#

WflowSedimentModel.read([components])

Read provided components from disk.

WflowSedimentModel.write([config_fn, ...])

Write the complete model schematization and configuration to file.

WflowSedimentModel.build(*[, write])

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

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

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

Wflow workflows#

workflows.allocation_areas(ds_like, ...[, ...])

Create water allocation area.

workflows.surfacewaterfrac_used(gwfrac_raw, ...)

Create surface water fraction map.

workflows.domestic(ds, ds_like[, popu, ...])

Create domestic water demand maps.

workflows.domestic_from_population(popu, ...)

Create domestic water demand maps from statitics per capita.

workflows.other_demand(ds, ds_like[, ds_method])

Create non-irrigation water demand maps.

workflows.irrigation(da_irrigation, ds_like, ...)

Prepare irrigation maps for paddy and non paddy.

workflows.irrigation_from_vector(...[, ...])

Prepare irrigation maps for paddy and non paddy from geodataframe.

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

Return hydrography maps (see list below) and FlwdirRaster object.

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

Return topography maps (see list below) at model resolution.

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

Return river maps.

workflows.river_bathymetry(ds_model, gdf_riv)

Get river width and bankfull discharge.

workflows.pet(pet, ds_like[, freq, ...])

Resample and reproject PET to the grid of ds_like.

workflows.spatial_interpolation(forcing, ...)

Interpolate spatial forcing data from station observations to a regular grid.

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

Return landuse map and related parameter maps.

workflows.landuse_from_vector(gdf, ds_like, df)

Derive several wflow maps based on vector landuse-landcover (LULC) data.

workflows.lai(da, ds_like[, logger])

Return climatology of Leaf Area Index (LAI).

workflows.create_lulc_lai_mapping_table(...)

Derive LAI values per landuse class.

workflows.lai_from_lulc_mapping(da, ds_like, df)

Derive LAI values from a landuse map and a mapping table.

workflows.add_paddy_to_landuse(landuse, ...)

Burn paddy fields into landuse map and update mapping table.

workflows.add_planted_forest_to_landuse(...)

Update USLE C map with planted forest and orchard data.

workflows.ksathorfrac(da, ds_like, ...)

Create KsatHorfrac map.

workflows.ksatver_vegetation(ds_like, sndppt)

Calculate saturated hydraulic conductivity based on soil and vegetation [mm/d].

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

Return soil parameter maps at model resolution.

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

Return soil parameter maps for sediment modelling at model resolution.

workflows.soilgrids_brooks_corey(ds, ds_like)

Determine Brooks Corey coefficient per wflow soil layer depth.

workflows.update_soil_with_paddy(ds, ...[, ...])

Update c and kvfrac soil properties for paddy fields.

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

Return waterbody (reservoir/lake) maps (see list below).

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

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

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

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

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

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

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

Return glacier intbls (see list below).

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

Estimates the root zone storage parameter.

workflows.wflow_1dmodel_connection(gdf_riv, ...)

Connect wflow to a 1D model by deriving linked subcatchs (and tributaries).

workflows.prepare_cold_states(ds_like, config)

Prepare cold states for Wflow.

Wflow low-level methods#

Utility methods#

utils.get_grid_from_config(var_name[, ...])

Get actual grid values from config including scale and offset.