Skip to content

waterregions

casadoj edited this page Aug 30, 2024 · 1 revision

The modelling of water abstraction for domestic, industrial, energetic, agricoltural and livestock use can require a map of the water regions. The concept of water regions and information for their definition are explained here. Since groundwater and surface water resources demand and abstraction are spatially distributed inside each water region, each model set-up must include all the pixels of the water region. This requirement is crucial for the succes of the calibration of the model. This utility allows the user to meet this requirement. More specifically, this utility can be used to:

  1. create a water region map which is consistent with a set of calibration points: this purpose is achieved by using the script define_waterregions.
  2. verify the consistency between an existing water region map and an exixting map of calibration catchments: this purpose is achieved by using the script verify_waterregions It is here reminded that when calibrating a catchment which is a subset of a larger computational domain, and the option wateruse is switched on, then the option groudwatersmooth must be switched off. The explanation of this requirement is provided in the chapter Water use of the LISFLOOD documentation.

Requirements: python3, pcraster 4.3. The protocol was tested on Linux.

define_waterregions

This utility allows to create a water region map which is consistent with a set of calibration points. The protocol was created by Ad De Roo (Unit D2, Joint Research Centre).

Input

  • List of the coordinates of the calibration points. This list must be provided in a .txt file with three columns: LONGITUDE(or x), LATITUDE(or y), point ID.
  • LDD map can be in NetCDF format or pcraster format. When using pcraster format, the following condition must be satisfied: PCRASTER_VALUESCALE=VS_LDD.
  • Countries map in NetCDF format or pcraster format. When using pcraster format, the following condition must be satisfied: PCRASTER_VALUESCALE=VS_NOMINAL. This map shows the political boundaries of the Countries, each Coutry is identified by using a unique ID. This map is used to ensure that the water regions are not split accross different Countries.
  • Map of the initial definition of the water regions in NetCDF format or pcraster format. When using pcraster format, the following condition must be satisfied: PCRASTER_VALUESCALE=VS_NOMINAL. This map is used to attribute a water region to areas not included in the calibration catchments. In order to create this map, the user can follow the guidelines provided here.
  • file .yaml or .json to define the metadata of the output water regions map in NetCDF format. An example of the structure of these files is provided here

Input data provided by this utility:

This utility provides three maps of Countries IDs: 1arcmin map of Europe (EFAS computational domain), 0.1 degree and 3arcmin maps of the Globe. ACKNOWLEDGEMENTS: both the rasters were retrieved by upsampling the original of the World Borders Datase provided by http://thematicmapping.org/ (the dataset is available under a Creative Commons Attribution-Share Alike License).

Output

Map of the water regions which is consistent with the calibration catchments. In other words, each water region is entirely included in one calibration catchment. The test to check the consistency between the newly created water regions map and the calibration catchments is implemented internally by the code and the outcome of the test is printed on the screen. In the output map, each water region is identified by a unique ID. The format of the output map can be NetCDF or pcraster.

Usage

The following command lines allow to produce a water region map which is consistent with the calibration points (only one commad line is required: each one of the command lines below shows a different combination of input files format):

python define_waterregions.py -p calib_points_test.txt -l ldd_test.map -C countries_id_test.map -w waterregions_initial_test.map -o my_new_waterregions.map
python define_waterregions.py -p calib_points_test.txt -l ldd_test.nc -C countries_id_test.nc -w waterregions_initial_test.nc -o my_new_waterregions.nc -m metadata.test.json
python define_waterregions.py -p calib_points_test.txt -l ldd_test.map -C countries_id_test.nc -w waterregions_initial_test.map -o my_new_waterregions.nc -m metadata.test.yaml

The input maps can be in NetCDF format or PCRaster format (the same command line can accept a mix of PCRaster and NetCDF formats).It is imperative to write the file name in full, that is including the extension (which can be either .nc or .map).

The utility can return either a file in PCRaster or NetCDF format. The users select their preferred format by specifying the extension of the file in the output option (i.e. either .nc or .map).

The metadata file in YAML format must be provided only if the output file is a NetCDF.

The code internally verifies that each one of the newly created water regions is entirely included within one calibration catchment. If this condition is satisfied, the following message in printed out:

“OK! Each water region is completely included inside one calibration catchment”

If the condition is not satisfied, the error message is:

“ERROR: The water regions WR are included in more than one calibration catchment”

Moreover, the code provides the list of the water regions WR and the calibration catchments that do not meet the requirement. This error highlights a problem in the input data: the user is recommended to check (and correct) the list of calibration points and the input maps.

The input and output arguments are listed below.

usage: define_waterregions.py [-h] -p CALIB_POINTS -l LDD -C COUNTRIES_ID -w
                              WATERREGIONS_INITIAL -o OUTPUT_WR

Define Water Regions consistent with calibration points: {}

optional arguments:
  -h, --help            show this help message and exit
  -p CALIB_POINTS, --calib_points CALIB_POINTS
                        list of calibration points: lon or x, lat or y, point id. File extension: .txt,
  -l LDD, --ldd LDD     LDD map, file extension: .nc or .map
  -C COUNTRIES_ID, --countries_id COUNTRIES_ID
                        map of Countries ID, fike extension .nc or .map 
  -w WATERREGIONS_INITIAL, --waterregions_initial WATERREGIONS_INITIAL
                        initial map of water regions, file extension: .nc or .map
  -o OUTPUT_WR, --output_wr OUTPUT_WR
                        output map of water regions, file extension: .nc or .map 
  -m METADATA, --metadata_file METADATA
                        Path to metadata file for NetCDF, .yaml or .json format                     

verify_waterregions

This function verifies the consistency between a water region map and a map of calibration catchments. This function must be used when the water region map and the map of calibration catchments have been defined in an independent manner (i.e. not using the utility define_waterregions). The function verifies that each water region map is entirely included in one calibration catchment. If this condition is not satisfied, an error message is printed on the screen.

Input

  • Map of calibration catchments in NetCDF format.
  • Water regions map in NetCDF format.

Output

The output is a message on the screen. There are two options:

  • 'OK! Each water region is completely included inside one calibration catchment.'
  • 'ERROR: The water regions WR are included in more than one calibration catchment’: this message is followed by the list of the water regions and of the catchment that raised the isuue.

In case of error message, the user can implement the function define_waterregions.

Usage

The following command line produces a water region map which is consistent with the calibration points:

python verify_waterregions.py -cc calib_catchments_test.nc -wr waterregions_test.nc

The input and output arguments are listed below. All the inputs are required.

usage: verify_waterregions.py [-h] -cc CALIB_CATCHMENTS -wr WATERREGIONS

Verify that the Water Regions map is consistent with the map of the
calibration catchments

optional arguments:
  -h, --help            show this help message and exit
  -cc CALIB_CATCHMENTS, --calib_catchments CALIB_CATCHMENTS
                        map of calibration catchments, NetCDF format
  -wr WATERREGIONS, --waterregions WATERREGIONS
                        map of water regions, NetCDF format

Note: the utility pcr2nc can be used to convert a map from PCRaster to NetCDF format.

Clone this wiki locally