This page describes how to use MESH to create a WATFLOOD "map" file from an existing MESH_drainage_database.r2c file.
Configuring SHDFILEFLAG
This process requires a drainage database and to activate the option via SHDFILEFLAG in MESH_input_run_options.ini.
If the setup already has SHDFILEFLAG with option 1
, the "to_map
" option can be appended to the flag:
##### Control Flags ##### ----# 1 # Number of control flags SHDFILEFLAG 1 to_map
If the setup already has SHDFILEFLAG with option "r2c
", the "to_map
" option can be appended to the flag:
##### Control Flags ##### ----# 1 # Number of control flags SHDFILEFLAG r2c to_map
Running the Model
An existing MESH setup can be run as-is. The model will create a new file named "MESH_basin.map".
If no existing MESH setup exists, a MESH_input_run_options.ini file can be created with only the following options (a sample file is attached for reference):
MESH run options input file ##### Control Flags ##### ----# 1 # Number of control flags SHDFILEFLAG r2c to_map ##### Output Grid selection ##### ----# 0 # Number of output grid points (5 points maximum) ---------# 1 #1 Grid number 1 #2 Land class . #3 Output directory ##### Output Directory ##### ---------# . # Output Directory for total-basin files ##### Simulation Run Times ##### ---#---#---#---# 0 0 0 0 # Start year, day, hour, minute 0 0 0 0 # Stop year, day, hour, minute
The model can then be run. The model will exit when it fails to read other input files, but before existing will have created a new file named "MESH_basin.map".
Limitations
Some variables cannot be derived from the attributes of MESH_drainage_database.r2c alone. The following table lists the "map" file attributes created by this process.
WATFLOOD "map" file attribute | Restored? | Detail | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Channel Elevation (ELV ) | From the native "Elev " attribute | |||||||||||||||||||
Drainage Area (FRAC ) | Calculated as the "
`"FRAC" = "GridArea"//"AL"//"AL"`
| |||||||||||||||||||
Drainage direction (S ) | Derived from the " do y = 1, yCount do x = 1, xCount if (RNKGRD(y, x) .gt. 0) then if (NEXT(RNKGRD(y, x)) .gt. 0) then grid(y, x) = -1 if (y .gt. 1) then if (x .gt. 1) then if (RNKGRD(y - 1, x - 1) .eq. NEXT(RNKGRD(y, x))) DDIR(y, x) = 5 end if if (x .lt. shd%xCount) then if (RNKGRD(y - 1, x + 1) .eq. NEXT(RNKGRD(y, x))) DDIR(y, x) = 3 end if if (RNKGRD(y - 1, x) .eq. NEXT(RNKGRD(y, x))) DDIR(y, x) = 4 end if if (y .lt. yCount) then if (x .gt. 1) then if (RNKGRD(y + 1, x - 1) .eq. NEXT(RNKGRD(y, x))) DDIR(y, x) = 7 end if if (x .lt. xCount) then if (RNKGRD(y + 1, x + 1) .eq. NEXT(RNKGRD(y, x))) DDIR(y, x) = 1 end if if (RNKGRD(y + 1, x) .eq. NEXT(RNKGRD(y, x))) DDIR(y, x) = 8 end if if (x .gt. 1) then if (RNKGRD(y, x - 1) .eq. NEXT(RNKGRD(y, x))) DDIR(y, x) = 6 end if if (x .lt. xCount) then if (RNKGRD(y, x + 1) .eq. NEXT(RNKGRD(y, x))) DDIR(y, x) = 2 end if end if end if end do end do The WATFLOOD "map" file does not use standard D8 drainage directions, instead using:
| |||||||||||||||||||
River Class (IBN ) | From the native "IAK " attribute | |||||||||||||||||||
Contour Density (IROUGH ) | Not calculated, but speculated to be the following equation based using the "
`"IROUGH" = ("IntSlope"*"AL")/("ContourInterval" - 0.0001)`
| |||||||||||||||||||
Channel Density (ICHNL ) | From the native "Chnl" attribute | |||||||||||||||||||
Reach Number (IREACH ) | From the native "Reach" attribute | |||||||||||||||||||
GRU/Land cover fractions | From the native "
`"PERC" = "ACLASS"*100.0`
|
Considerations
This process will decrease the number of cells in the domain "TotalNumOfGrids
" when converting from a MESH_drainage_database.r2c file where an outlet is not properly defined (e.g., when "numGridsInBasin
" is equal to "TotalNumOfGrids
").
In this case, the last cell in the domain likely drains into itself, and thus a representative drainage direction cannot be derived from "Rank
" and "Next
" alone.
Related articles
-
SHDFILEFLAG — The SHDFILEFLAG control flag specifies the basin information file format.
-
How to define river classes (IAK) using drainage area (DA) and optional GRU filtering — This page describes how to create river classes in MESH_drainage_database.r2c using drainage area (DA) and optional GRU filtering.
-
How to create WATFLOOD "map" file attributes from MESH_drainage_database.r2c — This page describes how to use MESH to create a WATFLOOD "map" file from an existing MESH_drainage_database.r2c file.
-