Update a wflow model: water demand#
With HydroMT, you can easily read your model and update one or several components of your model using the update function of the command line interface (CLI). Here are the steps and some examples on how to add water demand information to your wflow_sbm model.
All lines in this notebook which starts with ! are executed from the command line. Within the notebook environment the logging messages are shown after completion. You can also copy these lines and paste them in your shell to get more feedback.
You can update a wflow_sbm model to include the simulation of water demand and allocation. This can be important in basins where there is substantial human influence, and/or you might want to simulate what will happen if (more) water is consumed. We identify four different sources of water demand: - domestic - industry - livestock - irrigation
These four different items are taken into account when adding the required water demand data to your wflow model. Besides computing the water demand, we also need information on the regions where water is allocated.
Let’s open the example configuration file (wflow_update_water_demand.yml) from the model repository [examples folder] and have a look at the main setup.
[1]:
fn_config = "wflow_update_water_demand.yml"
with open(fn_config, "r") as f:
txt = f.read()
print(txt)
setup_allocation_areas:
waterareas_fn: gadm_level2
priority_basins: True
setup_allocation_surfacewaterfrac:
gwfrac_fn: lisflood_gwfrac
gwbodies_fn: lisflood_gwbodies
ncfrac_fn: lisflood_ncfrac
# Update model with GLCNMO landuse data in order to add the paddies
setup_lulcmaps_with_paddy:
lulc_fn: glcnmo
paddy_class: 12
soil_fn: soilgrids
wflow_thicknesslayers:
- 50
- 100
- 50
- 200
- 800
target_conductivity:
- null
- null
- 5
- null
- null
paddy_waterlevels:
"h_min": 20
"h_opt": 50
"h_max": 80
setup_domestic_demand:
domestic_fn: pcr_globwb
population_fn: worldpop_2020_constrained
domestic_fn_original_res: 0.5
setup_other_demand:
demand_fn: pcr_globwb
variables:
- ind_gross
- ind_net
- lsk_gross
- lsk_net
resampling_method: nearest
setup_irrigation:
irrigated_area_fn: irrigated_area
irrigation_value:
- 1
cropland_class:
- 11
- 14
- 20
- 30
paddy_class:
- 12
area_threshold: 0.6
lai_threshold: 0.2
Here, you see we will be adding the required information to simulate water demand and allocation in wflow, by running three different setup functions: - setup_allocation_areas: Adds a map that defines the different regions that will be used to allocate water. By default this is a mix between administrative boundaries and catchment boundaries - setup_allocation_surfacewaterfrac: prepare the fraction of surface water used for allocation (can be reduced if groundwater or non conventional water sources are also present in the basin). - setup_lulcmaps_with_paddy (or setup_lulcmaps): update the landuse to include new parameters (crop coefficient kc and soil water pressure heads h) and add the paddies (rice fields). To allow for water to pool on the surface of the rice fields, soil parameters will also be updated to include an additional thin layer with limited vertical conductivity. - setup_domestic_demand: Add domestic water demands (gross and net) from gridded data and downscaled using high resolution population map. - setup_other_demand: Adds maps to the wflow schematization that describe how much water is demanded (gross and net amounts) by different sources: domestic (dom), industry (ind), and livestock (lsk). In our case, as we downscale domestic with population, we will here add industry and livestock. - setup_irrigation: Adds information about where and when irrigation takes place for paddy and nonpaddy crops.
More information on these steps will be given below (after we have updated the model)
Update the wflow model#
First, we build a wflow_sbm model for the full Piave basin, as most water demand activities occur in the most downstream locations of the catchment. Please note that this is a basin model (until the full outlet at the ocean), as opposed to the sub-basin models (until a certain location) that are being created in the other examples.
[2]:
# NOTE: copy this line (without !) to your shell for more direct feedback
! hydromt build wflow "./wflow_piave_water_demand" -r "{'basin': [12.2051, 45.8331], 'bounds': [11.70, 45.35, 12.95, 46.70]}" -i wflow_build.yml -d artifact_data -vv
2024-12-18 18:39:15,144 - build - log - DEBUG - Writing log messages to new file /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_piave_water_demand/hydromt.log.
2024-12-18 18:39:15,144 - build - log - INFO - HydroMT version: 0.10.0
2024-12-18 18:39:15,144 - build - main - INFO - Building instance of wflow model at /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_piave_water_demand.
2024-12-18 18:39:15,144 - build - main - INFO - User settings:
2024-12-18 18:39:15,519 - build - data_catalog - INFO - Reading data catalog artifact_data latest
2024-12-18 18:39:15,519 - build - data_catalog - INFO - Parsing data catalog from /home/runner/.hydromt_data/artifact_data/v0.0.9/data_catalog.yml
2024-12-18 18:39:16,109 - build - model_api - INFO - Initializing wflow model from hydromt_wflow (v0.7.1.dev0).
2024-12-18 18:39:16,109 - build - data_catalog - INFO - Parsing data catalog from /home/runner/work/hydromt_wflow/hydromt_wflow/hydromt_wflow/data/parameters_data.yml
2024-12-18 18:39:16,121 - build - model_api - DEBUG - Setting model config options.
2024-12-18 18:39:16,123 - build - model_api - DEBUG - Default config read from /home/runner/work/hydromt_wflow/hydromt_wflow/hydromt_wflow/data/wflow/wflow_sbm.toml
2024-12-18 18:39:16,123 - build - model_api - INFO - setup_basemaps.region: {'basin': [12.2051, 45.8331], 'bounds': [11.7, 45.35, 12.95, 46.7]}
2024-12-18 18:39:16,123 - build - model_api - INFO - setup_basemaps.hydrography_fn: merit_hydro
2024-12-18 18:39:16,123 - build - model_api - INFO - setup_basemaps.basin_index_fn: merit_hydro_index
2024-12-18 18:39:16,123 - build - model_api - INFO - setup_basemaps.res: 0.00833
2024-12-18 18:39:16,123 - build - model_api - INFO - setup_basemaps.upscale_method: ihu
2024-12-18 18:39:16,123 - build - wflow - INFO - Preparing base hydrography basemaps.
2024-12-18 18:39:16,124 - build - rasterdataset - INFO - Reading merit_hydro raster data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/merit_hydro/{variable}.tif
2024-12-18 18:39:16,201 - build - basin_mask - DEBUG - Parsed region (kind=basin): {'bounds': [11.7, 45.35, 12.95, 46.7], 'xy': [12.2051, 45.8331]}
2024-12-18 18:39:16,216 - build - basin_mask - DEBUG - Getting basin IDs at point locations.
2024-12-18 18:39:16,424 - build - basin_mask - INFO - basin bbox: [11.7750, 45.5042, 12.8375, 46.6900]
2024-12-18 18:39:16,487 - build - wflow - DEBUG - Adding basins vector to geoms.
2024-12-18 18:39:16,488 - build - basemaps - DEBUG - (Sub)basin at original resolution has 751509 cells.
2024-12-18 18:39:18,045 - build - basemaps - INFO - Upscale flow direction data: 10x, ihu method.
2024-12-18 18:39:34,205 - build - basemaps - DEBUG - Derive stream order.
2024-12-18 18:39:34,366 - build - basemaps - DEBUG - Map shape: (142, 127); active cells: 7503.
2024-12-18 18:39:34,366 - build - basemaps - DEBUG - Outlet coordinates (1/1): (12.73250,45.52750).
2024-12-18 18:39:34,546 - build - wflow - DEBUG - Adding region vector to geoms.
2024-12-18 18:39:34,548 - build - model_api - INFO - setup_rivers.hydrography_fn: merit_hydro
2024-12-18 18:39:34,548 - build - model_api - INFO - setup_rivers.river_geom_fn: hydro_rivers_lin
2024-12-18 18:39:34,548 - build - model_api - INFO - setup_rivers.river_upa: 30
2024-12-18 18:39:34,548 - build - model_api - INFO - setup_rivers.rivdph_method: powlaw
2024-12-18 18:39:34,548 - build - model_api - INFO - setup_rivers.slope_len: 2000
2024-12-18 18:39:34,548 - build - model_api - INFO - setup_rivers.min_rivlen_ratio: 0.0
2024-12-18 18:39:34,548 - build - model_api - INFO - setup_rivers.min_rivdph: 1
2024-12-18 18:39:34,548 - build - model_api - INFO - setup_rivers.min_rivwth: 30
2024-12-18 18:39:34,548 - build - model_api - INFO - setup_rivers.smooth_len: 5000
2024-12-18 18:39:34,548 - build - model_api - INFO - setup_rivers.rivman_mapping_fn: roughness_river_mapping_default
2024-12-18 18:39:34,548 - build - model_api - INFO - setup_rivers.elevtn_map: wflow_dem
2024-12-18 18:39:34,548 - build - model_api - INFO - setup_rivers.river_routing: kinematic-wave
2024-12-18 18:39:34,548 - build - model_api - INFO - setup_rivers.connectivity: 8
2024-12-18 18:39:34,549 - build - wflow - INFO - Preparing river maps.
2024-12-18 18:39:34,549 - build - rasterdataset - INFO - Reading merit_hydro raster data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/merit_hydro/{variable}.tif
2024-12-18 18:39:34,609 - build - rasterdataset - DEBUG - Clip to [11.778, 45.507, 12.837, 46.690] (epsg:4326))
2024-12-18 18:39:34,616 - build - river - DEBUG - Set river mask (min uparea: 30 km2) and prepare flow dirs.
2024-12-18 18:39:34,771 - build - river - DEBUG - Derive river length.
2024-12-18 18:39:41,698 - build - river - DEBUG - Derive river slope.
2024-12-18 18:39:42,307 - build - river - DEBUG - Derive rivwth from hydrography dataset.
2024-12-18 18:39:42,320 - build - dataframe - INFO - Reading roughness_river_mapping_default csv data from /home/runner/work/hydromt_wflow/hydromt_wflow/hydromt_wflow/data/wflow/N_river_mapping.csv
2024-12-18 18:39:42,326 - build - landuse - INFO - Deriving N_River using average resampling (nodata=-999.0).
2024-12-18 18:39:42,331 - build - geodataframe - INFO - Reading hydro_rivers_lin vector data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/rivers_lin2019_v1.gpkg
2024-12-18 18:39:42,340 - build - geodataframe - DEBUG - Clip intersects [11.778, 45.507, 12.837, 46.690] (EPSG:4326)
2024-12-18 18:39:42,717 - build - river - DEBUG - Derive ['rivwth', 'qbankfull'] from shapefile.
2024-12-18 18:39:42,788 - build - river - DEBUG - Valid for 466/830 river cells (max dist: 393 m).
2024-12-18 18:39:46,897 - build - wflow - DEBUG - Adding rivers vector to geoms.
2024-12-18 18:39:47,712 - build - model_api - INFO - setup_reservoirs.reservoirs_fn: hydro_reservoirs
2024-12-18 18:39:47,713 - build - model_api - INFO - setup_reservoirs.timeseries_fn: gww
2024-12-18 18:39:47,713 - build - model_api - INFO - setup_reservoirs.min_area: 1.0
2024-12-18 18:39:47,713 - build - wflow - INFO - Preparing reservoir maps.
2024-12-18 18:39:47,713 - build - geodataframe - INFO - Reading hydro_reservoirs vector data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/hydro_reservoirs.gpkg
2024-12-18 18:39:47,732 - build - geodataframe - DEBUG - Clip contains [11.775, 45.504, 12.838, 46.690] (EPSG:4326)
2024-12-18 18:39:47,734 - build - geodataframe - DEBUG - Convert units for 5 columns.
2024-12-18 18:39:47,736 - build - wflow - WARNING - No reservoirs of sufficient size found within region! Skipping reservoir procedures!
2024-12-18 18:39:47,736 - build - wflow - INFO - Skipping method, as no data has been found
2024-12-18 18:39:47,736 - build - model_api - INFO - setup_lakes.lakes_fn: hydro_lakes
2024-12-18 18:39:47,736 - build - model_api - INFO - setup_lakes.rating_curve_fns: None
2024-12-18 18:39:47,736 - build - model_api - INFO - setup_lakes.min_area: 10.0
2024-12-18 18:39:47,736 - build - model_api - INFO - setup_lakes.add_maxstorage: False
2024-12-18 18:39:47,736 - build - wflow - INFO - Preparing lake maps.
2024-12-18 18:39:47,736 - build - geodataframe - INFO - Reading hydro_lakes vector data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/hydro_lakes.gpkg
2024-12-18 18:39:47,748 - build - geodataframe - DEBUG - Clip contains [11.775, 45.504, 12.838, 46.690] (EPSG:4326)
2024-12-18 18:39:47,749 - build - geodataframe - DEBUG - Convert units for 1 columns.
2024-12-18 18:39:47,750 - build - wflow - WARNING - No lakes of sufficient size found within region! Skipping lake procedures!
2024-12-18 18:39:47,750 - build - wflow - INFO - Skipping method, as no data has been found
2024-12-18 18:39:47,751 - build - model_api - INFO - setup_glaciers.glaciers_fn: rgi
2024-12-18 18:39:47,751 - build - model_api - INFO - setup_glaciers.min_area: 1.0
2024-12-18 18:39:47,751 - build - wflow - INFO - Preparing glacier maps.
2024-12-18 18:39:47,751 - build - geodataframe - INFO - Reading rgi vector data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/rgi.gpkg
2024-12-18 18:39:47,764 - build - geodataframe - DEBUG - Clip intersects [11.775, 45.504, 12.838, 46.690] (EPSG:4326)
2024-12-18 18:39:47,766 - build - wflow - INFO - 1 glaciers of sufficient size found within region.
2024-12-18 18:39:47,777 - build - glaciers - DEBUG - Creating vector grid for calculating glacier fraction and storage per grid cell
2024-12-18 18:39:47,852 - build - glaciers - DEBUG - Setting glacierfrac and store values per glacier.
2024-12-18 18:39:50,470 - build - model_api - INFO - setup_lulcmaps.lulc_fn: globcover_2009
2024-12-18 18:39:50,470 - build - model_api - INFO - setup_lulcmaps.lulc_mapping_fn: globcover_mapping_default
2024-12-18 18:39:50,470 - build - model_api - INFO - setup_lulcmaps.lulc_vars: ['landuse', 'Kext', 'N', 'PathFrac', 'RootingDepth', 'Sl', 'Swood', 'WaterFrac', 'kc', 'alpha_h1', 'h1', 'h2', 'h3_high', 'h3_low', 'h4']
2024-12-18 18:39:50,470 - build - wflow - INFO - Preparing LULC parameter maps.
2024-12-18 18:39:50,470 - build - rasterdataset - INFO - Reading globcover_2009 raster data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/globcover.tif
2024-12-18 18:39:50,480 - build - rasterdataset - DEBUG - Clip to [11.778, 45.507, 12.837, 46.690] (epsg:4326))
2024-12-18 18:39:50,480 - build - dataframe - INFO - Reading globcover_mapping_default csv data from /home/runner/work/hydromt_wflow/hydromt_wflow/hydromt_wflow/data/lulc/globcover_mapping.csv
2024-12-18 18:39:50,487 - build - landuse - INFO - Deriving landuse using nearest resampling (nodata=230).
2024-12-18 18:39:50,508 - build - landuse - INFO - Deriving Kext using average resampling (nodata=-999.0).
2024-12-18 18:39:50,529 - build - landuse - INFO - Deriving N using average resampling (nodata=-999.0).
2024-12-18 18:39:50,551 - build - landuse - INFO - Deriving PathFrac using average resampling (nodata=-999.0).
2024-12-18 18:39:50,572 - build - landuse - INFO - Deriving RootingDepth using average resampling (nodata=-999.0).
2024-12-18 18:39:50,594 - build - landuse - INFO - Deriving Sl using average resampling (nodata=-999.0).
2024-12-18 18:39:50,616 - build - landuse - INFO - Deriving Swood using average resampling (nodata=-999.0).
2024-12-18 18:39:50,637 - build - landuse - INFO - Deriving WaterFrac using average resampling (nodata=-999.0).
2024-12-18 18:39:50,659 - build - landuse - INFO - Deriving kc using average resampling (nodata=-999.0).
2024-12-18 18:39:50,680 - build - landuse - INFO - Deriving alpha_h1 using mode resampling (nodata=-999).
2024-12-18 18:39:50,757 - build - landuse - INFO - Deriving h1 using average resampling (nodata=-999).
2024-12-18 18:39:50,778 - build - landuse - INFO - Deriving h2 using average resampling (nodata=-999).
2024-12-18 18:39:50,800 - build - landuse - INFO - Deriving h3_high using average resampling (nodata=-999).
2024-12-18 18:39:50,822 - build - landuse - INFO - Deriving h3_low using average resampling (nodata=-999).
2024-12-18 18:39:50,844 - build - landuse - INFO - Deriving h4 using average resampling (nodata=-999).
2024-12-18 18:39:50,876 - build - model_api - INFO - setup_laimaps.lai_fn: modis_lai
2024-12-18 18:39:50,876 - build - model_api - INFO - setup_laimaps.lulc_fn: None
2024-12-18 18:39:50,876 - build - model_api - INFO - setup_laimaps.lulc_sampling_method: any
2024-12-18 18:39:50,876 - build - model_api - INFO - setup_laimaps.lulc_zero_classes: []
2024-12-18 18:39:50,876 - build - model_api - INFO - setup_laimaps.buffer: 2
2024-12-18 18:39:50,876 - build - wflow - INFO - Preparing LAI maps.
2024-12-18 18:39:50,877 - build - rasterdataset - INFO - Reading modis_lai netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/modis_lai.nc
2024-12-18 18:39:50,902 - build - rasterdataset - DEBUG - Clip to [11.778, 45.507, 12.837, 46.690] (epsg:4326))
2024-12-18 18:39:50,903 - build - rasterdataset - DEBUG - Convert units for 1 variables.
2024-12-18 18:39:50,908 - build - landuse - INFO - Deriving LAI using average resampling (nodata=nan).
2024-12-18 18:39:50,986 - build - model_api - INFO - setup_soilmaps.soil_fn: soilgrids
2024-12-18 18:39:50,986 - build - model_api - INFO - setup_soilmaps.ptf_ksatver: brakensiek
2024-12-18 18:39:50,986 - build - model_api - INFO - setup_soilmaps.wflow_thicknesslayers: [100, 300, 800]
2024-12-18 18:39:50,986 - build - wflow - INFO - Preparing soil parameter maps.
2024-12-18 18:39:50,987 - build - rasterdataset - INFO - Reading soilgrids raster data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/soilgrids/{variable}.tif
2024-12-18 18:39:51,408 - build - rasterdataset - DEBUG - Clip to [11.778, 45.507, 12.837, 46.690] (epsg:4326))
2024-12-18 18:39:51,419 - build - rasterdataset - DEBUG - Convert units for 21 variables.
2024-12-18 18:39:51,641 - build - soilgrids - INFO - calculate and resample thetaS
2024-12-18 18:39:51,924 - build - soilgrids - INFO - calculate and resample thetaR
2024-12-18 18:39:52,226 - build - soilgrids - INFO - calculate and resample KsatVer
2024-12-18 18:39:52,299 - build - soilgrids - INFO - calculate and resample pore size distribution index
2024-12-18 18:39:52,825 - build - soilgrids - INFO - fit z - log(KsatVer) with numpy linalg regression (y = b*x) -> M_
2024-12-18 18:39:53,366 - build - soilgrids - INFO - fit zi - Ksat with curve_fit (scipy.optimize) -> M
2024-12-18 18:39:57,004 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for thetaS
2024-12-18 18:39:57,182 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for thetaR
2024-12-18 18:39:57,370 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for SoilThickness
No numerical nodata value found, skipping set_nodata
2024-12-18 18:39:57,387 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for SoilMinThickness
No numerical nodata value found, skipping set_nodata
2024-12-18 18:39:57,404 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for c
2024-12-18 18:39:57,411 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer
2024-12-18 18:39:57,462 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_0.0cm
2024-12-18 18:39:57,662 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_5.0cm
2024-12-18 18:39:57,713 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_15.0cm
2024-12-18 18:39:57,762 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_30.0cm
2024-12-18 18:39:57,812 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_60.0cm
2024-12-18 18:39:57,863 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_100.0cm
2024-12-18 18:39:57,914 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for KsatVer_200.0cm
2024-12-18 18:39:57,964 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M_original_
No numerical nodata value found, skipping set_nodata
2024-12-18 18:39:58,167 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M_
No numerical nodata value found, skipping set_nodata
2024-12-18 18:39:58,375 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for f_
No numerical nodata value found, skipping set_nodata
2024-12-18 18:39:58,573 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M_original
No numerical nodata value found, skipping set_nodata
2024-12-18 18:39:58,793 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for M
No numerical nodata value found, skipping set_nodata
2024-12-18 18:39:59,019 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for f
No numerical nodata value found, skipping set_nodata
2024-12-18 18:39:59,194 - build - soilgrids - DEBUG - Interpolate nodata (NaN) values for wflow_soil
2024-12-18 18:39:59,350 - build - model_api - INFO - setup_outlets.river_only: True
2024-12-18 18:39:59,351 - build - model_api - INFO - setup_outlets.toml_output: csv
2024-12-18 18:39:59,351 - build - model_api - INFO - setup_outlets.gauge_toml_header: ['Q']
2024-12-18 18:39:59,351 - build - model_api - INFO - setup_outlets.gauge_toml_param: ['lateral.river.q_av']
2024-12-18 18:39:59,351 - build - wflow - INFO - Gauges locations set based on river outlets.
2024-12-18 18:39:59,355 - build - wflow - INFO - Gauges map based on catchment river outlets added.
2024-12-18 18:39:59,355 - build - wflow - INFO - Adding ['lateral.river.q_av'] to csv section of toml.
2024-12-18 18:39:59,355 - build - model_api - INFO - setup_gauges.gauges_fn: grdc
2024-12-18 18:39:59,355 - build - model_api - INFO - setup_gauges.index_col: None
2024-12-18 18:39:59,355 - build - model_api - INFO - setup_gauges.snap_to_river: True
2024-12-18 18:39:59,355 - build - model_api - INFO - setup_gauges.mask: None
2024-12-18 18:39:59,355 - build - model_api - INFO - setup_gauges.snap_uparea: False
2024-12-18 18:39:59,356 - build - model_api - INFO - setup_gauges.max_dist: 10000.0
2024-12-18 18:39:59,356 - build - model_api - INFO - setup_gauges.wdw: 3
2024-12-18 18:39:59,356 - build - model_api - INFO - setup_gauges.rel_error: 0.05
2024-12-18 18:39:59,356 - build - model_api - INFO - setup_gauges.abs_error: 50.0
2024-12-18 18:39:59,356 - build - model_api - INFO - setup_gauges.fillna: False
2024-12-18 18:39:59,356 - build - model_api - INFO - setup_gauges.derive_subcatch: False
2024-12-18 18:39:59,356 - build - model_api - INFO - setup_gauges.basename: None
2024-12-18 18:39:59,356 - build - model_api - INFO - setup_gauges.toml_output: csv
2024-12-18 18:39:59,356 - build - model_api - INFO - setup_gauges.gauge_toml_header: ['Q', 'P']
2024-12-18 18:39:59,356 - build - model_api - INFO - setup_gauges.gauge_toml_param: ['lateral.river.q_av', 'vertical.precipitation']
2024-12-18 18:39:59,356 - build - geodataframe - INFO - Reading grdc csv data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/grdc.csv
2024-12-18 18:39:59,360 - build - geodataframe - DEBUG - Clip intersects [11.778, 45.507, 12.837, 46.690] (EPSG:4326)
2024-12-18 18:39:59,361 - build - wflow - INFO - 3 grdc gauge locations found within domain
2024-12-18 18:40:00,214 - build - wflow - INFO - Adding ['lateral.river.q_av', 'vertical.precipitation'] to csv section of toml.
2024-12-18 18:40:00,215 - build - model_api - INFO - setup_precip_forcing.precip_fn: era5
2024-12-18 18:40:00,215 - build - model_api - INFO - setup_precip_forcing.precip_clim_fn: None
2024-12-18 18:40:00,215 - build - model_api - INFO - setup_precip_forcing.chunksize: None
2024-12-18 18:40:00,215 - build - rasterdataset - INFO - Reading era5 netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/era5.nc
2024-12-18 18:40:00,227 - build - rasterdataset - DEBUG - Shifting time labels with 86400 sec.
2024-12-18 18:40:00,228 - build - rasterdataset - DEBUG - Slicing time dim (datetime.datetime(2010, 1, 1, 0, 0), datetime.datetime(2010, 3, 31, 0, 0))
2024-12-18 18:40:00,234 - build - rasterdataset - DEBUG - Clip to [11.778, 45.507, 12.837, 46.690] (epsg:4326))
2024-12-18 18:40:00,235 - build - rasterdataset - DEBUG - Convert units for 1 variables.
2024-12-18 18:40:00,282 - build - model_api - INFO - setup_temp_pet_forcing.temp_pet_fn: era5
2024-12-18 18:40:00,282 - build - model_api - INFO - setup_temp_pet_forcing.pet_method: debruin
2024-12-18 18:40:00,282 - build - model_api - INFO - setup_temp_pet_forcing.press_correction: True
2024-12-18 18:40:00,283 - build - model_api - INFO - setup_temp_pet_forcing.temp_correction: True
2024-12-18 18:40:00,283 - build - model_api - INFO - setup_temp_pet_forcing.wind_correction: True
2024-12-18 18:40:00,283 - build - model_api - INFO - setup_temp_pet_forcing.wind_altitude: 10
2024-12-18 18:40:00,283 - build - model_api - INFO - setup_temp_pet_forcing.reproj_method: nearest_index
2024-12-18 18:40:00,283 - build - model_api - INFO - setup_temp_pet_forcing.fillna_method: None
2024-12-18 18:40:00,283 - build - model_api - INFO - setup_temp_pet_forcing.dem_forcing_fn: era5_orography
2024-12-18 18:40:00,283 - build - model_api - INFO - setup_temp_pet_forcing.skip_pet: False
2024-12-18 18:40:00,283 - build - model_api - INFO - setup_temp_pet_forcing.chunksize: None
2024-12-18 18:40:00,283 - build - rasterdataset - INFO - Reading era5 netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/era5.nc
2024-12-18 18:40:00,294 - build - rasterdataset - DEBUG - Shifting time labels with 86400 sec.
2024-12-18 18:40:00,295 - build - rasterdataset - DEBUG - Slicing time dim (datetime.datetime(2010, 1, 1, 0, 0), datetime.datetime(2010, 3, 31, 0, 0))
2024-12-18 18:40:00,301 - build - rasterdataset - DEBUG - Clip to [11.778, 45.507, 12.837, 46.690] (epsg:4326))
2024-12-18 18:40:00,303 - build - rasterdataset - DEBUG - Convert units for 4 variables.
2024-12-18 18:40:00,328 - build - rasterdataset - INFO - Reading era5_orography netcdf data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/era5_orography.nc
2024-12-18 18:40:00,341 - build - rasterdataset - DEBUG - Clip to [11.625, 45.375, 13.125, 46.875] (epsg:4326))
2024-12-18 18:40:00,342 - build - rasterdataset - DEBUG - Convert units for 1 variables.
2024-12-18 18:40:00,526 - build - model_api - INFO - setup_constant_pars.dtype: float32
2024-12-18 18:40:00,526 - build - model_api - INFO - setup_constant_pars.nodata: -999
2024-12-18 18:40:00,526 - build - model_api - INFO - setup_constant_pars.KsatHorFrac: 100
2024-12-18 18:40:00,526 - build - model_api - INFO - setup_constant_pars.Cfmax: 3.75653
2024-12-18 18:40:00,526 - build - model_api - INFO - setup_constant_pars.cf_soil: 0.038
2024-12-18 18:40:00,527 - build - model_api - INFO - setup_constant_pars.EoverR: 0.11
2024-12-18 18:40:00,527 - build - model_api - INFO - setup_constant_pars.InfiltCapPath: 5
2024-12-18 18:40:00,527 - build - model_api - INFO - setup_constant_pars.InfiltCapSoil: 600
2024-12-18 18:40:00,527 - build - model_api - INFO - setup_constant_pars.MaxLeakage: 0
2024-12-18 18:40:00,527 - build - model_api - INFO - setup_constant_pars.rootdistpar: -500
2024-12-18 18:40:00,527 - build - model_api - INFO - setup_constant_pars.TT: 0
2024-12-18 18:40:00,527 - build - model_api - INFO - setup_constant_pars.TTI: 2
2024-12-18 18:40:00,527 - build - model_api - INFO - setup_constant_pars.TTM: 0
2024-12-18 18:40:00,527 - build - model_api - INFO - setup_constant_pars.WHC: 0.1
2024-12-18 18:40:00,527 - build - model_api - INFO - setup_constant_pars.G_Cfmax: 5.3
2024-12-18 18:40:00,527 - build - model_api - INFO - setup_constant_pars.G_SIfrac: 0.002
2024-12-18 18:40:00,527 - build - model_api - INFO - setup_constant_pars.G_TT: 1.3
2024-12-18 18:40:00,551 - build - wflow - INFO - Write model data to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_piave_water_demand
2024-12-18 18:40:00,585 - build - wflow - INFO - Write grid to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_piave_water_demand/staticmaps.nc
2024-12-18 18:40:00,796 - build - wflow - INFO - Writing model staticgeom to file.
2024-12-18 18:40:00,865 - build - wflow - INFO - Write forcing file
2024-12-18 18:40:00,868 - build - wflow - WARNING - Not all dates found in precip_fn changing starttime to 2010-02-02 00:00:00 and endtime to 2010-02-15 00:00:00 in the toml.
2024-12-18 18:40:00,872 - build - wflow - INFO - Process forcing; saving to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_piave_water_demand/inmaps-era5-2010.nc
[########################################] | 100% Completed | 101.45 ms
2024-12-18 18:40:00,995 - build - wflow - INFO - Writing model config to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_piave_water_demand/wflow_sbm.toml
Next, we will update the model using the same configuration file that was shown earlier:
[3]:
! hydromt update wflow wflow_piave_water_demand -i wflow_update_water_demand.yml -d artifact_data -d "https://github.com/Deltares/hydromt_wflow/releases/download/v0.5.0/wflow_artifacts.yml" -d ./data/demand/data_catalog.yml -v
2024-12-18 18:40:03,473 - update - log - INFO - HydroMT version: 0.10.0
2024-12-18 18:40:03,473 - update - main - INFO - Updating wflow model at /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_piave_water_demand (r+).
2024-12-18 18:40:03,473 - update - main - INFO - Output dir: /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_piave_water_demand
2024-12-18 18:40:03,473 - update - main - INFO - User settings:
2024-12-18 18:40:03,832 - update - data_catalog - INFO - Reading data catalog artifact_data latest
2024-12-18 18:40:03,832 - update - data_catalog - INFO - Parsing data catalog from /home/runner/.hydromt_data/artifact_data/v0.0.9/data_catalog.yml
2024-12-18 18:40:04,427 - update - data_catalog - INFO - Parsing data catalog from https://github.com/Deltares/hydromt_wflow/releases/download/v0.5.0/wflow_artifacts.yml
Downloading data from 'https://github.com/Deltares/hydromt_wflow/releases/download/v0.5.0/data.tar.gz' to file '/home/runner/.hydromt_data/wflow_artifacts/v0.5.0/data.tar.gz'.
SHA256 hash of downloaded file: ac07cbfe5b5b2f647af0fd1886ead892d85872ba11d3f955858fb45e7419871a
Use this value as the 'known_hash' argument of 'pooch.retrieve' to ensure that the file hasn't changed if it is downloaded again in the future.
Untarring contents of '/home/runner/.hydromt_data/wflow_artifacts/v0.5.0/data.tar.gz' to '/home/runner/.hydromt_data/wflow_artifacts/v0.5.0/data.tar'
2024-12-18 18:40:04,782 - update - data_catalog - INFO - Parsing data catalog from ./data/demand/data_catalog.yml
2024-12-18 18:40:04,784 - update - model_api - INFO - Initializing wflow model from hydromt_wflow (v0.7.1.dev0).
2024-12-18 18:40:04,784 - update - data_catalog - INFO - Parsing data catalog from /home/runner/work/hydromt_wflow/hydromt_wflow/hydromt_wflow/data/parameters_data.yml
2024-12-18 18:40:04,799 - update - wflow - INFO - Reading model staticgeom files.
2024-12-18 18:40:04,807 - update - wflow - INFO - Read grid from /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_piave_water_demand/staticmaps.nc
2024-12-18 18:40:04,880 - update - model_api - INFO - setup_allocation_areas.waterareas_fn: gadm_level2
2024-12-18 18:40:04,880 - update - model_api - INFO - setup_allocation_areas.priority_basins: True
2024-12-18 18:40:04,880 - update - wflow - INFO - Preparing water demand allocation map.
2024-12-18 18:40:04,882 - update - geodataframe - INFO - Reading gadm_level2 vector data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/gadm_level2.gpkg
2024-12-18 18:40:05,000 - update - model_api - INFO - setup_allocation_surfacewaterfrac.gwfrac_fn: lisflood_gwfrac
2024-12-18 18:40:05,000 - update - model_api - INFO - setup_allocation_surfacewaterfrac.waterareas_fn: None
2024-12-18 18:40:05,000 - update - model_api - INFO - setup_allocation_surfacewaterfrac.gwbodies_fn: lisflood_gwbodies
2024-12-18 18:40:05,000 - update - model_api - INFO - setup_allocation_surfacewaterfrac.ncfrac_fn: lisflood_ncfrac
2024-12-18 18:40:05,000 - update - model_api - INFO - setup_allocation_surfacewaterfrac.interpolate_nodata: False
2024-12-18 18:40:05,000 - update - model_api - INFO - setup_allocation_surfacewaterfrac.mask_and_scale_gwfrac: True
2024-12-18 18:40:05,000 - update - wflow - INFO - Preparing surface water fraction map.
2024-12-18 18:40:05,002 - update - rasterdataset - INFO - Reading lisflood_gwfrac raster data from /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/demand/lisflood_gwfrac.tif
2024-12-18 18:40:05,023 - update - rasterdataset - INFO - Reading lisflood_gwbodies raster data from /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/demand/lisflood_gwbodies.tif
2024-12-18 18:40:05,034 - update - rasterdataset - INFO - Reading lisflood_ncfrac raster data from /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/data/demand/lisflood_ncfrac.tif
2024-12-18 18:40:05,043 - update - wflow - INFO - Using wflow model allocation areas.
2024-12-18 18:40:05,294 - update - model_api - INFO - setup_lulcmaps_with_paddy.lulc_fn: glcnmo
2024-12-18 18:40:05,294 - update - model_api - INFO - setup_lulcmaps_with_paddy.paddy_class: 12
2024-12-18 18:40:05,294 - update - model_api - INFO - setup_lulcmaps_with_paddy.output_paddy_class: None
2024-12-18 18:40:05,294 - update - model_api - INFO - setup_lulcmaps_with_paddy.lulc_mapping_fn: None
2024-12-18 18:40:05,294 - update - model_api - INFO - setup_lulcmaps_with_paddy.paddy_fn: None
2024-12-18 18:40:05,294 - update - model_api - INFO - setup_lulcmaps_with_paddy.paddy_mapping_fn: None
2024-12-18 18:40:05,294 - update - model_api - INFO - setup_lulcmaps_with_paddy.soil_fn: soilgrids
2024-12-18 18:40:05,294 - update - model_api - INFO - setup_lulcmaps_with_paddy.wflow_thicknesslayers: [50, 100, 50, 200, 800]
2024-12-18 18:40:05,294 - update - model_api - INFO - setup_lulcmaps_with_paddy.target_conductivity: [None, None, 5, None, None]
2024-12-18 18:40:05,294 - update - model_api - INFO - setup_lulcmaps_with_paddy.lulc_vars: ['landuse', 'Kext', 'N', 'PathFrac', 'RootingDepth', 'Sl', 'Swood', 'WaterFrac', 'kc', 'alpha_h1', 'h1', 'h2', 'h3_high', 'h3_low', 'h4']
2024-12-18 18:40:05,294 - update - model_api - INFO - setup_lulcmaps_with_paddy.paddy_waterlevels: {'h_min': 20, 'h_opt': 50, 'h_max': 80}
2024-12-18 18:40:05,295 - update - model_api - INFO - setup_lulcmaps_with_paddy.save_high_resolution_lulc: False
2024-12-18 18:40:05,295 - update - wflow - INFO - Preparing LULC parameter maps including paddies.
2024-12-18 18:40:05,297 - update - rasterdataset - INFO - Reading glcnmo raster data from /home/runner/.hydromt_data/wflow_artifacts/v0.5.0/data.tar/glcnmo.tif
2024-12-18 18:40:05,306 - update - dataframe - INFO - Reading glcnmo_mapping_default csv data from /home/runner/work/hydromt_wflow/hydromt_wflow/hydromt_wflow/data/lulc/glcnmo_mapping.csv
2024-12-18 18:40:05,313 - update - landuse - INFO - Deriving landuse using nearest resampling (nodata=0).
2024-12-18 18:40:05,333 - update - landuse - INFO - Deriving Kext using average resampling (nodata=-999.0).
2024-12-18 18:40:05,347 - update - landuse - INFO - Deriving N using average resampling (nodata=-999.0).
2024-12-18 18:40:05,361 - update - landuse - INFO - Deriving PathFrac using average resampling (nodata=-999.0).
2024-12-18 18:40:05,375 - update - landuse - INFO - Deriving RootingDepth using average resampling (nodata=-999.0).
2024-12-18 18:40:05,389 - update - landuse - INFO - Deriving Sl using average resampling (nodata=-999.0).
2024-12-18 18:40:05,403 - update - landuse - INFO - Deriving Swood using average resampling (nodata=-999.0).
2024-12-18 18:40:05,417 - update - landuse - INFO - Deriving WaterFrac using average resampling (nodata=-999.0).
2024-12-18 18:40:05,431 - update - landuse - INFO - Deriving kc using average resampling (nodata=-999.0).
2024-12-18 18:40:05,445 - update - landuse - INFO - Deriving alpha_h1 using mode resampling (nodata=-999).
2024-12-18 18:40:05,512 - update - landuse - INFO - Deriving h1 using average resampling (nodata=-999).
2024-12-18 18:40:05,527 - update - landuse - INFO - Deriving h2 using average resampling (nodata=-999).
2024-12-18 18:40:05,541 - update - landuse - INFO - Deriving h3_high using average resampling (nodata=-999).
2024-12-18 18:40:05,555 - update - landuse - INFO - Deriving h3_low using average resampling (nodata=-999).
2024-12-18 18:40:05,570 - update - landuse - INFO - Deriving h4 using average resampling (nodata=-999).
2024-12-18 18:40:05,584 - update - model_grid - WARNING - Replacing grid map: wflow_landuse
2024-12-18 18:40:05,586 - update - model_grid - WARNING - Replacing grid map: Kext
2024-12-18 18:40:05,587 - update - model_grid - WARNING - Replacing grid map: N
2024-12-18 18:40:05,588 - update - model_grid - WARNING - Replacing grid map: PathFrac
2024-12-18 18:40:05,590 - update - model_grid - WARNING - Replacing grid map: RootingDepth
2024-12-18 18:40:05,591 - update - model_grid - WARNING - Replacing grid map: Sl
2024-12-18 18:40:05,592 - update - model_grid - WARNING - Replacing grid map: Swood
2024-12-18 18:40:05,593 - update - model_grid - WARNING - Replacing grid map: WaterFrac
2024-12-18 18:40:05,594 - update - model_grid - WARNING - Replacing grid map: kc
2024-12-18 18:40:05,596 - update - model_grid - WARNING - Replacing grid map: alpha_h1
2024-12-18 18:40:05,597 - update - model_grid - WARNING - Replacing grid map: h1
2024-12-18 18:40:05,598 - update - model_grid - WARNING - Replacing grid map: h2
2024-12-18 18:40:05,599 - update - model_grid - WARNING - Replacing grid map: h3_high
2024-12-18 18:40:05,600 - update - model_grid - WARNING - Replacing grid map: h3_low
2024-12-18 18:40:05,601 - update - model_grid - WARNING - Replacing grid map: h4
2024-12-18 18:40:05,603 - update - wflow - INFO - Different thicknesslayers requested, updating `c` parameter
2024-12-18 18:40:05,606 - update - rasterdataset - INFO - Reading soilgrids raster data from /home/runner/.hydromt_data/artifact_data/v0.0.9/data.tar/soilgrids/{variable}.tif
2024-12-18 18:40:05,959 - update - soilgrids - INFO - Adding kvfrac map
2024-12-18 18:40:06,949 - update - wflow - INFO - Dropping these variables, as they depend on the layer dimension: ['layer', 'c']
2024-12-18 18:40:06,952 - update - model_api - INFO - setup_domestic_demand.domestic_fn: pcr_globwb
2024-12-18 18:40:06,952 - update - model_api - INFO - setup_domestic_demand.population_fn: worldpop_2020_constrained
2024-12-18 18:40:06,952 - update - model_api - INFO - setup_domestic_demand.domestic_fn_original_res: 0.5
2024-12-18 18:40:06,952 - update - wflow - INFO - Preparing domestic demand maps.
2024-12-18 18:40:06,955 - update - rasterdataset - INFO - Reading pcr_globwb netcdf data from /home/runner/.hydromt_data/wflow_artifacts/v0.5.0/data.tar/pcr_globwb.nc
2024-12-18 18:40:06,975 - update - rasterdataset - INFO - Reading pcr_globwb netcdf data from /home/runner/.hydromt_data/wflow_artifacts/v0.5.0/data.tar/pcr_globwb.nc
2024-12-18 18:40:06,993 - update - rasterdataset - INFO - Reading worldpop_2020_constrained raster data from /home/runner/.hydromt_data/wflow_artifacts/v0.5.0/data.tar/worldpop_2020_constrained.tif
2024-12-18 18:40:07,002 - update - rasterdataset - WARNING - Dataset [11.599583338930609, 45.19958334863173, 12.999583333598485, 46.79958334242942] does not fully cover bbox [11.583, 45.167, 13.000, 46.833]
2024-12-18 18:40:11,696 - update - model_api - INFO - setup_other_demand.demand_fn: pcr_globwb
2024-12-18 18:40:11,696 - update - model_api - INFO - setup_other_demand.variables: ['ind_gross', 'ind_net', 'lsk_gross', 'lsk_net']
2024-12-18 18:40:11,696 - update - model_api - INFO - setup_other_demand.resampling_method: nearest
2024-12-18 18:40:11,696 - update - wflow - INFO - Preparing water demand maps for ['ind_gross', 'ind_net', 'lsk_gross', 'lsk_net'].
2024-12-18 18:40:11,698 - update - rasterdataset - INFO - Reading pcr_globwb netcdf data from /home/runner/.hydromt_data/wflow_artifacts/v0.5.0/data.tar/pcr_globwb.nc
2024-12-18 18:40:11,866 - update - model_api - INFO - setup_irrigation.irrigated_area_fn: irrigated_area
2024-12-18 18:40:11,866 - update - model_api - INFO - setup_irrigation.irrigation_value: [1]
2024-12-18 18:40:11,866 - update - model_api - INFO - setup_irrigation.cropland_class: [11, 14, 20, 30]
2024-12-18 18:40:11,866 - update - model_api - INFO - setup_irrigation.paddy_class: [12]
2024-12-18 18:40:11,866 - update - model_api - INFO - setup_irrigation.area_threshold: 0.6
2024-12-18 18:40:11,867 - update - model_api - INFO - setup_irrigation.lai_threshold: 0.2
2024-12-18 18:40:11,867 - update - wflow - INFO - Preparing irrigation maps.
2024-12-18 18:40:11,867 - update - rasterdataset - INFO - Reading irrigated_area raster data from /home/runner/.hydromt_data/wflow_artifacts/v0.5.0/data.tar/irrigated_area.tif
2024-12-18 18:40:11,878 - update - demand - INFO - Preparing irrigated areas map for non paddy.
2024-12-18 18:40:11,902 - update - demand - INFO - Preparing irrigated areas map for paddy.
2024-12-18 18:40:11,924 - update - demand - INFO - Calculating irrigation trigger.
2024-12-18 18:40:11,976 - update - wflow - INFO - Write model data to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_piave_water_demand
2024-12-18 18:40:11,976 - update - data_catalog - INFO - Parsing data catalog from /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_piave_water_demand/hydromt_data.yml
2024-12-18 18:40:12,040 - update - wflow - INFO - Write grid to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_piave_water_demand/staticmaps.nc
2024-12-18 18:40:21,056 - update - wflow - INFO - Writing model staticgeom to file.
2024-12-18 18:40:21,126 - update - wflow - INFO - Writing model config to /home/runner/work/hydromt_wflow/hydromt_wflow/docs/_examples/wflow_piave_water_demand/wflow_sbm.toml
NOTE: The second catalog wflow_artifacts.yml points to additional data that are not available in the hydromt artifact_data catalog such as extracts of the glcnmo landuse or the pcrglobwb gridded demands.
Looking at the added layers#
To understand what layers have been added, we’ll plot the new layers below. To do the plotting, we first have to import the required python libraries:
[4]:
import numpy as np
import matplotlib.pyplot as plt
from hydromt_wflow import WflowModel
mod = WflowModel(
root="wflow_piave_water_demand",
mode="r+",
data_libs=[
"artifact_data",
"https://github.com/Deltares/hydromt_wflow/releases/download/v0.5.0/wflow_artifacts.yml"
],
)
Landuse and rice fields#
Additional new parameters have been added to the model for landuse such as: - crop_factor: crop factor map that is used to convert the reference PET to the crop specific evaporation - h values: soil water pressure heads at which root water uptake is reduced (Feddes) [cm]. They are different for paddy and non paddy landuse types.
For paddies, new maps have been added and soil parameters updated to allow water to pool at the surface. These are the c maps and a new kvfrac map which is a factor used to multiply the vertical conductivity (ksatver
) in order to allow for a layer with very low conductivity (for the paddy fields).
[5]:
fig, axes = plt.subplots(1, 3, sharex=True, sharey=True, figsize=(10,5))
axes[0].set_title("Paddy fields [-]")
axes[1].set_title("Crop factor [-]")
axes[2].set_title("Soil water pressure head h1 [cm]")
rice = mod.grid["wflow_landuse"].where(mod.grid["wflow_landuse"] == 12, mod.grid["wflow_landuse"].raster.nodata)
rice.raster.mask_nodata().plot(ax=axes[0], add_labels=False)
mod.grid["kc"].raster.mask_nodata().plot(ax=axes[1], add_labels=False)
mod.grid["h1"].raster.mask_nodata().plot(ax=axes[2], add_labels=False)
fig.tight_layout()
A kvfrac
map is added that adds a layer with very low vertical hydraulic conductivity in the cells with paddy irrigation. The target conductivity value can be set for each layer using the target_conductivity
parameter, and sets a value for each layer in the wflow model (linked to the wflow_thicknesslayer
parameter). See the figures below for an indication of these maps and their effect on the vertical conductivity.
[6]:
fig, axes = plt.subplots(1, 3, figsize=(11,5))
ax1, ax2, ax3 = axes.flatten()
ax1.set_title("kvfrac for layer=0")
ax2.set_title("kvfrac for layer=2")
ax3.set_title("Effect on kv")
mod.grid["kvfrac"].sel(layer=0).raster.mask_nodata().plot(ax=ax1, add_labels=False, vmin=0, vmax=1)
mod.grid["kvfrac"].sel(layer=2).raster.mask_nodata().plot(ax=ax2, add_labels=False, vmin=0, vmax=1)
# Take the cumulative sum to get to the cumulative layers
layers = np.cumsum(mod.get_config("model.thicknesslayers"))
layers = np.append(layers, 2000)
# Add layers to figure
for layer in layers:
ax3.axhline(y=layer, c="0.8")
# Position of a paddy pixel
lat = 45.63
lon = 12.66
# Read required layers
kv_0 = mod.grid["KsatVer"].sel(latitude=lat, longitude=lon, method="nearest")
kvfrac = mod.grid["kvfrac"].sel(latitude=lat, longitude=lon, method="nearest")
f = mod.grid["f"].sel(latitude=lat, longitude=lon, method="nearest")
# Compute original kv values (without kvfrac)
depths = np.arange(0, 2000)
original = kv_0.values * np.exp(-f.values * depths)
# Compute new kv values
corrected = original.copy()
idxs = np.where(kvfrac.values != 1)[0]
for idx in idxs:
start_depth = layers[idx-1]
end_depth = layers[idx]
corrected[start_depth:end_depth] *= kvfrac.values[idx]
ax3.plot(original, depths, label="Without kvfrac")
ax3.plot(corrected, depths, label="With kvfrac")
# Flip y-axis for easier understanding of depth profile
ax3.set_ylim(2000, 0)
ax3.set_xlim(0, ax3.get_xlim()[1])
ax3.set_xlabel("Vertical conductivity [mm day$^{-1}$]")
ax3.set_ylabel("Depth below surface [mm]")
ax3.legend(loc = "lower right")
fig.tight_layout()
Industry, livestock and domestic demand#
For the non_irrigation related demand, we assume those to be already prepared datasets with gross and net (consumption) demands. In this example, we rely on data from the PCR-GLOBWB model. See the images below for an explanation of the data and added layers to the wflow model configuration.
[7]:
month = 6
fig, axes = plt.subplots(2, 3, sharex=True, sharey=True, figsize=(10, 8))
fig.suptitle(f"Demand values for month {month}")
axes[0][0].set_title("Industry [mm/day]")
axes[0][1].set_title("Livestock [mm/day]")
axes[0][2].set_title("Domestic [mm/day]")
axes[0][0].set_ylabel("Gross")
axes[1][0].set_ylabel("Net")
# Extracting the min-max ranges for consistent colorbars
ind_min = mod.grid["industry_gross"].min()
ind_max = mod.grid["industry_gross"].max()
lsk_min = mod.grid["livestock_gross"].min()
lsk_max = mod.grid["livestock_gross"].max()
dom_min = mod.grid["domestic_gross"].min()
dom_max = mod.grid["domestic_gross"].max()
# Plot industry
mod.grid["industry_gross"].sel(time=month).plot(ax=axes[0][0], add_labels=False, vmin=ind_min, vmax=ind_max)
mod.grid["industry_net"].sel(time=month).plot(ax=axes[1][0], add_labels=False, vmin=ind_min, vmax=ind_max)
# Plot livestock
mod.grid["livestock_gross"].sel(time=month).plot(ax=axes[0][1], add_labels=False, vmin=lsk_min, vmax=lsk_max)
mod.grid["livestock_net"].sel(time=month).plot(ax=axes[1][1], add_labels=False, vmin=lsk_min, vmax=lsk_max)
# Plot domestic (adjusted the max range to improve plotting)
mod.grid["domestic_net"].sel(time=month).plot(ax=axes[0][2], add_labels=False, vmin=dom_min, vmax=dom_max * .3)
mod.grid["domestic_net"].sel(time=month).plot(ax=axes[1][2], add_labels=False, vmin=dom_min, vmax=dom_max * .3)
fig.tight_layout()
In the figure above, we see a slight difference between the gross and net demand for the industry sector. This means that this sector consumes part of the demanded water, but returns a portion of the water back. On the other hand, the gross and net demands for both livestock and domestic are roughly the same, meaning that the majority of the water will be consumed.
For the industry and livestock sectors, we see the relatively low-resolution of the original data. This data is retrieved from the PCR-GLOBWB model, which was provided at a resolution of 0.5x0.5 degrees (roughly 40x40km). The same holds for the domestic demands data, but it was downscaled using population density in the setup_non_irrigation
workflow (using the dataset provided in population_fn
, which is an optional step). The population data is used to identify densely populated regions,
and downscales this to the cities/villages where the people actually live. To give an impression, see the figure below for an insight into the population data. Please note that this is the data at the original resolution of ~100x100m. The data at the wflow model resolution is provided in the staticmaps (see mod.grid["Population_scaled"]
).
[8]:
# Read original data and slice to model domain
pop_ds = mod.data_catalog.get_rasterdataset("worldpop_2020_constrained", geom=mod.geoms["basins"])
# Get mask of catchment
pop_ds_mask = pop_ds.raster.geometry_mask(mod.geoms["basins"])
pop_ds = pop_ds.raster.mask_nodata().where(pop_ds_mask)
# Plot data
fig, ax = plt.subplots(1, 1, figsize=(6,6))
# Add original population data to figure
pop_ds.plot(ax=ax, vmax=20, add_labels=False, cbar_kwargs={'label': "Population per pixel (~100x100m)"})
# Add basin geometry to plot
mod.geoms["basins"].plot(ax=ax, facecolor="none", edgecolor="red")
[8]:
<Axes: >
Irrigation maps#
For the setup_irrigation
workflow, a number of maps have been added to the model: - paddy_irrigation_areas: mask (0/1) of the cells that are considered to be paddy/rice fields - nonpaddy_irrigation_areas: mask (0/1) of the cells that are irrigated, but not paddy/rice fields - nonpaddy_irrigation_trigger: trigger (0/1) that indicates whether we expect irrigation to occur (based on the LAI, to identify the growing season) - paddy_irrigation_trigger: trigger (0/1) that indicates
whether we expect irrigation to occur on paddies (based on the LAI, to identify the growing season)
[9]:
fig, axes = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(10,5))
axes[0].set_title("Paddy irrigation [-]")
axes[1].set_title("Non-paddy irrigation [-]")
mod.grid["paddy_irrigation_areas"].raster.mask_nodata().plot(ax=axes[0], add_labels=False)
mod.grid["nonpaddy_irrigation_areas"].raster.mask_nodata().plot(ax=axes[1], add_labels=False)
fig.tight_layout()
In this figure, we see the cells with paddy (rice fields) and non-paddy irrigated areas. Cells are identified as such when they exceed a fractional threshold of the cell (set by area_threshold
). A cell can only be either paddy-irrigated, non-paddy-irrigated, or rain-fed. In the third panel, we see the crop factor associated for all of the model pixels.
In the figures below, we show the irrigation trigger maps for three months: before the growing season, during the growing season, and in the closing stages of the growing season. A map with a mask (0/1) contains information whether irrigation is allowed to occur during this month.
[10]:
fig, axes = plt.subplots(1, 3, sharex=True, sharey=True, figsize=(10,5))
fig.suptitle("Irrigation trigger [-]")
axes[0].set_title("February")
axes[1].set_title("July")
axes[2].set_title("October")
mod.grid["nonpaddy_irrigation_trigger"].sel(time=2).raster.mask_nodata().plot(ax=axes[0], add_labels=False, vmin=0, vmax=1)
mod.grid["nonpaddy_irrigation_trigger"].sel(time=7).raster.mask_nodata().plot(ax=axes[1], add_labels=False, vmin=0, vmax=1)
mod.grid["nonpaddy_irrigation_trigger"].sel(time=10).raster.mask_nodata().plot(ax=axes[2], add_labels=False, vmin=0, vmax=1)
fig.tight_layout()
Water allocation regions#
To define regions where water can be shared and allocated, a merge between catchment and water areas or administrative boundaries is computed. These result in regions where wflow can allocate available water. No water allocation is supported between these regions. To give an impression on how these regions look like, see the following figures for an example.
Note: Water areas or regions are generally defined by sub-river-basins within a Country. In order to mimick reality, it is advisable to avoid cross-Country-border abstractions. Whenever information is available, it is strongly recommended to align the water regions with the actual areas managed by water management authorities, such as regional water boards.
[11]:
# Read original data and slice to model domain
admin = mod.data_catalog.get_geodataframe("gadm_level2", geom=mod.geoms["basins"])
fig, ax = plt.subplots(1)
ax.set_title("Allocation areas")
mod.grid["allocation_areas"].raster.mask_nodata().plot(ax=ax, add_labels=False)
admin.plot(ax=ax, facecolor="none", edgecolor="red")
mod.geoms["rivers"].plot(ax=ax)
[11]:
<Axes: title={'center': 'Allocation areas'}>
When merging the wflow basins with the water regions, some small subbasins can be created that do not contain river cells. These small basins will be merged to larger basins. When merging, you can decide if you prefer to merge with the nearest downstream basin, or with any basin in the same water region that does contain river using the priotity_basins
argument. In the previous map, we gave priority to the basins, here is the results if priority is given to water regions instead:
[12]:
# Create allocations areas
mod.setup_allocation_areas(
waterareas_fn="gadm_level2",
priority_basins=False,
)
fig, ax = plt.subplots(1)
ax.set_title("Allocation areas")
mod.grid["allocation_areas"].raster.mask_nodata().plot(ax=ax, add_labels=False, cmap="viridis_r")
admin.plot(ax=ax, facecolor="none", edgecolor="red")
mod.geoms["rivers"].plot(ax=ax)
[12]:
<Axes: title={'center': 'Allocation areas'}>
Here we see a couple of distinct administrative boundaries (black lines), some of which already follow the catchment boundaries. When the catchment crosses an administrative boundary, that region receives a different but unique identifier. Note that we are using level 2 boundaries here, which might not be the most realistic for a region of this size.
Surface water frac used for water allocation#
By default, Wflow will allocate all water demands with water from the surface water (frac_sw_used=1). However, if in a certain areas, groundwater or other non conventional sources can be used, the frac_sw_used of each allocation area can be reduced and prepared using the setup_allocation_surfacewaterfrac method.
Here we used global data from GLOFAS (Lisflood) for the fraction of grounwater used, presence of groundwater bodies and non conventional sources (0 is Piave). The water allocations are the ones we prepared in the previous step in order to match better the wflow model basin delineation.
Let’s have a look at the resulting map:
[13]:
fig, ax = plt.subplots(1)
ax.set_title("Allocation surface water frac used")
mod.grid["frac_sw_used"].raster.mask_nodata().plot(ax=ax, add_labels=False)
mod.geoms["basins"].plot(ax=ax, facecolor="none", edgecolor="black")
mod.geoms["rivers"].plot(ax=ax)
[13]:
<Axes: title={'center': 'Allocation surface water frac used'}>