The makertn utility was created to help automate the process of preparing the return flow input file (*.rtn) for the State of Colorados Stream Simulation Model (StateMod). The *.rtn file is used by StateMod to specify the spatial and temporal return flow patterns for diversion nodes in the StateMod network.. This documentation has been updated for version 01.00.00 of the makertn software.
The makertn StateMod utility was created to help automate the process of preparing the return flow input file (*.rtn) for the State of Colorados Stream Simulation Model (StateMod). Groundwater and surface water return flows for each diversion location (diversion node) in the network are specified to StateMod by describing the spatial and temporal return flow patterns. The rtn file specifies the set of StateMod network nodes to which groundwater and surface water returns from a diversion go. It also specifies the percentages of the total returns that accrue to each of the return flow nodes, and which of the temporal delay (lag) patterns in the StateMod Return Flow Delay file (*.dly) to use. The watright DMI reads the information in the *.rtn file and merges it with other data into the *.dds file, which is read by StateMod (See the StateMod documentation for a description of StateMod input files).
makertn combines the location information for irrigated lands associated with diversions in the StateMod model with return flow information for return flow "zones" resulting from the State's groundwater modeling efforts. GIS databases have been developed which contain maps of irrigated parcels and associations of these parcels with surface diversion structures. The GIS databases also contain the spatial definition of return flow "zones" in the basin being modeled. For each of these return flow "zones," groundwater modeling has defined a "unit response function" or "URF" to specify the spatial and temporal effects on surface water systems of a unit recharge or pumping in the zone.
These URF's are developed by the State's groundwater model between every zone in the basin and every river reach in the basin. However, only a subset of these are significant enough to use to define return flow patterns. Criteria developed by the State's groundwater modelers establishes the set of URF's to use in the StateMod surface water model. These URF's are imported directly to the StateMod delay table input file, *.dly.
The URF's define the return flow (or depletion in the case of groundwater pumping) relationship between groundwater activity in the URF zones and a discrete number of river reaches. makertn uses the final URF list and a "river reach to node" database to define which StateMod nodes that recharge and/or pumping in each URF zone affects.
The information from the GIS and URF databases is processed and exported to text input files for makertn to use. makertn reads these files, integrates the irrigated parcel and URF information, and then prepares the rtn file as output. A makertn command file defines the input and output file names and locations. The default values for some key return flow parameters can be specified in the command file as well. Additionally, the user can place commands in the makertn command file to replace the calculated surface and groundwater return flows with a new set specified by the user.
makertn takes input from several data files. These include the makertn command file, the StateMod river network file (*.rin), the diversion node to irrigated parcel database (*.n2p; node2par.dat), the irrigated parcel to URF zone database (*.p2z; par2urfz.dat), the URF zone to URF database (*.z2u; urfz2urf.dat), the URF to river reach database (*.u2r; urf2rr.dat), and finally the river reach to return flow node database (*.r2n; rr2node.dat). In general all the input files are free-format space delimited ASCII data files. Text values should be delimited by double quotes when they contain spaces. Each of the input files is discussed in the table below.
It is important to take care when entering percentages in the various StateMod and makertn data input files. Conventions for how to enter percentages vary. Some files require percentages between 0% and 100%, others require the values 0.0 and 1.0. Each of the percentages necessary in the makertn data input and the convention for entering it is described in the following documentation.
makertn Input Files | File Naming Convention (* is basin application abbrev.) | File Description |
makertn command file | *_makertn.cf | ASCII text data file; space
delimited; double quote string delimiters OK Ignores records with # as first character Specified as the one and only argument to makertn when it is executed from the command line. First field is always the makertn command token label; subsequent fields on each record depend on the command token. See Tables 2 and 3 for a list of recognized makertn command tokens and their arguments. The commands in this file are not order dependent. |
StateMod river network file | *.rin | rin file exactly as created by the StateMod makenet DMI |
Diversion node to irrigated parcel database | *.n2p | ASCII text data file; space
delimited; double quote string delimiters OK if needed Ignores records with # as first character Three fields on each record: Field 1 - Diversion node ID (text) Field 2 - Parcel ID (text) Field 3 - Parcel percentage of total diversion node ID acreage (a number between 0.0 and 1.0) One to many (node to parcels) database |
Irrigated parcel to URF zone database | *.p2z | ASCII text data
file; space delimited; double quote string delimiters OK |
URF zone to URF database | *.z2u | ASCII text data file; space
delimited; double quote string delimiters OK Ignores records with # as first character Two fields on each record: Field 1 - URF Zone ID (text) Field 2 - URF ID (number - same as in *.dly file) One to many (URF zone to URFs) database |
URF to river reach database | *.u2r | ASCII text data file; space
delimited; double quote string delimiters OK Ignores records with # as first character Two fields on each record: Field 1 - URF ID (number - same as in *.dly file) Field 2 - River Reach ID (text) One to one (URF to river reach) database |
River reach to return flow node database | *.r2n | ASCII text data file; space
delimited; double quote string delimiters OK Ignores records with # as first character Three fields on each record: Field 1 - River Reach ID (text) Field 2 - Return Flow Node ID (text - same as in *.rin file) Field 3 - The percentage (a number between 0.0 and 1.0) of return flows to this reach that go to this node One to many (River reach to return flow nodes) database |
Table 1. makertn Input Files
This ASCII text file contains the required and optional makertn commands that control the makertn program. Table 2 below contains the required commands and their arguments, and Table 3 below contains the optional commands and their arguments. The required commands describe the names and locations of all the input and output files for makertn. The optional commands specify changes to default return flow parameters and allow the user to specify the return flow parameters for specific diversion nodes. The commands in the makertn command file can be entered in any order.
Figure 1 below contains an example makertn command file.
makertn Required Commands | Command Description |
ReturnFlowFileName | Field one is the command token
"ReturnFlowFileName", but it is not case sensitive. Field two on this record should be a text string containing the full file name (including directory) of the rtn file to be created by makertn. This text string should be delimited by double quotes if it contains spaces. This command is REQUIRED in the makertn command file. |
RINFileName | Field one is the command token
"RINFileName", but it is not case sensitive. Field two on this record should be a text string containing the full file name (including directory) of the StateMod river network file (*.rin) to be read by makertn. This text string should be delimited by double quotes if it contains spaces. This command is REQUIRED in the makertn command file. |
NodeToParcelFileName | Field one is the command token
"NodeToParcelFileName", but it is not case sensitive. Field two on this record should be a text string containing the full file name (including directory) of the diversion node to irrigated parcel database file (*.n2p) to be read by makertn. This text string should be delimited by double quotes if it contains spaces. This command is REQUIRED in the makertn command file. |
ParcelToURFZoneFileName | Field one is the
command token "ParcelToURFZoneFileName", but it is not case
sensitive. |
URFZoneToURFFileName | Field one is the command token
"URFZoneToURFFileName", but it is not case sensitive. Field two on this record should be a text string containing the full file name (including directory) of the URF zone to URF database file (*.p2z) to be read by makertn. This text string should be delimited by double quotes if it contains spaces. This command is REQUIRED in the makertn command file. |
URFToRiverReachFileName | Field one is the command token
"URFToRiverReachFileName", but it is not case sensitive. Field two on this record should be a text string containing the full file name (including directory) of the URF to river reach database file (*.p2z) to be read by makertn. This text string should be delimited by double quotes if it contains spaces. This command is REQUIRED in the makertn command file. |
RiverReachToNodeFileName | Field one is the command token
"RiverReachToNodeFileName", but it is not case sensitive. Field two on this record should be a text string containing the full file name (including directory) of the river reach to return flow node database file (*.p2z) to be read by makertn. This text string should be delimited by double quotes if it contains spaces. This command is REQUIRED in the makertn command file. |
Table 2. makertn Required Commands
makertn Required Commands | Command Description |
ReplaceSurfaceWaterReturn | Allows the user to specifiy the
surface water return flow location, percentage, and delay pattern for each diversion node.
Five required fields on this record: Field one is the command token "ReplaceSurfaceWaterReturn", but it is not case sensitive. Field two on this record should be a text string denoting the StateMod diversion node ID Field three on this record should be a text string denoting the StateMod surface water return flow node ID. Field four on this record should be a number containing the percentage (a number between 0% and 100%) of the unconsumed water to be returned to the node denoted in field three with the delay pattern in field five. Field five two on this record should be an integer number denoting the index of the delay pattern in the *.dly file to use for this surface water return. This command is OPTIONAL in the makertn command file. |
ReplaceGroundWaterReturn | Allows the user to specifiy the
ground water return flow location(s), percentage(s), and delay pattern(s) for each
diversion node. The required fields on this record are: Field one is the command token "ReplaceGroundWaterReturn", but it is not case sensitive. Field two on this record should be a text string denoting the StateMod diversion node ID Field three on this record should be an integer number denoting the number of return flow nodes that will be defined for the groundwater returns from this diversion node. The number of remaining fields depends on the value specified in field three. There should be three fields in the following order for each and every return flow node: A text string denoting the StateMod groundwater return flow node ID. A number containing the percentage (a number between 0% and 100%) of the unconsumed water to be returned to the node denoted in the previous field with the delay pattern in the following field. (See the important note regarding this perceantage value in the text of this documentation.) An integer number denoting the index of the delay pattern in the *.dly file to use for this ground water return. This command is OPTIONAL in the makertn command file. |
DefaultSurfaceWaterDelayPatternIndex | Allows the user to specifiy the default
surface water return flow delay pattern index. Two required fields on this record: Field one is the command token "DefaultSurfaceWaterDelayPatternIndex", but it is not case sensitive. Field two on this record should be an integer number denoting the default delay pattern index to use for surface water return flows. This command is OPTIONAL in the makertn command file. |
DefaultSurfaceWaterReturnPercentage | Allows the user to
specifiy the default surface water return flow percentage. |
DefaultGroundwaterDelayPatternIndex | Allows the user to specifiy the default
ground water return flow delay pattern index. Two required fields on this record: Field one is the command token "DefaultGroundwaterDelayPatternIndex", but it is not case sensitive. Field two on this record should be an integer number denoting the default delay pattern to use for ground water return flows. This command is OPTIONAL in the makertn command file. |
Table 3. makertn Optional Commands
# makertn command file # space delimited, but CAN handle quoted text strings # # these are the required input parameters for makertf (space delimited) #================================================================= ReturnFlowFileName "G:\PROJECTS\297\Task 6\RGModel\Return Flows\rg.rtn" RINFileName "G:\PROJECTS\297\Task 6\RGModel\Return Flows\rg.rin" NodeToParcelFileName "G:\PROJECTS\297\Task 6\RGModel\Return Flows\rg.n2p" ParcelToURFZoneFileName "G:\PROJECTS\297\Task 6\RGModel\Return Flows\rg.p2z" URFZoneToURFFileName "G:\PROJECTS\297\Task 6\RGModel\Return Flows\rg.z2u" URFToRiverReachFileName "G:\PROJECTS\297\Task 6\RGModel\Return Flows\rg.u2r" RiverReachToNodeFileName "G:\PROJECTS\297\Task 6\RGModel\Return Flows\rg.r2n" # # # these are optional input parameters for makertn (space delimited) #================================================================= #DefaultSurfaceWaterDelayPatternIndex delaypatternid DefaultSurfaceWaterDelayPatternIndex 1 #DefaultSurfaceWaterReturnPercentage returnpercentage DefaultSurfaceWaterDelayPatternIndex 5.0 #DefaultGroundWaterDelayPatternIndex delaypatternid DefaultGroundWaterDelayPatternIndex 2 # ReplaceSurfaceWaterReturn 20ANWR 08240000 5.0 1 ReplaceSurfaceWaterReturn 350597 08251500 5.0 1 ReplaceSurfaceWaterReturn 24_EastLand RG_RFNode 5.0 1 ReplaceSurfaceWaterReturn 240537 RG_RFNode 5.0 1 #replacegroundwaterreturn divnodeid numberofreturnpatterns [retnodeid returnpercentage delaypatternid] ... ReplaceGroundWaterReturn 20ANWR 2 08240000 50.0 2 08251500 45.0 19015 ReplaceGroundWaterReturn 350597 1 08251500 95.0 19015 ReplaceGroundWaterReturn 24_EastLand 1 RG_RFNode 95.0 2 ReplaceGroundWaterReturn 240537 1 RG_RFNode 95.0 2 |
Figure 1. Sample makertn Command File
This ASCII text file is created by the makenet StateMod DMI. It contains the order and organization (or topology) of the nodes in the StateMod model network. This file is used by makertn to identify all the diversion nodes in the network and to detemine which return flow nodes might be upstream of the diversion location. Diversion nodes are currently the only nodes which will potentially have return flows. See the CDSS makenet DMI documentation for more information on this file.
This ASCII text file (space delimited) contains the
diversion node to irrigated parcel database. This database is typically created by special GIS database queries based on irrigated parcel maps developed as part of the State's CDSS project. Each record in this file represents the relationship between a diversion structure and an irrigated parcel. There may be and often are several lines for each diversion structure since multiple irrigated parcels can be served by the same source (ditch or well). This relationship is therefore "one to many."Each record of this file has 3 space delimited fields as follows:
Field 1. contains the diversion structure ID.
Field 2. contains the parcel ID.
Field 3. contains the percentage (a number between 0.0 and 1.0) of the total irrigated
area for this structure (created by summing all the irrigated parcel acreages for this
structure) that is in this particular parcel.
Not every diversion structure in the model needs to be represented in this file. For structures that are modeled in the StateMod network but are without any mapped irrigated parcels, makertn uses the default return flow location (next downstream node), as well as the default delay patterns and return flow percentages. Also, the order of the records in this file is not important. Example lines from a typical diversion node to irrigated parcel database (*.n2p) file is shown below in Figure 2.
... 200812 11200 0.001675810 ... |
Figure 2. Sample Node to Parcel Database File
This ASCII text file (space delimited) contains the
irrigated parcel to URF zone database. This database is typically created by special GIS database queries based on irrigated parcel and URF zone maps developed as part of the State's CDSS project. Each record in this file represents the relationship between an irrigated parcel and a URF zone. There should only be one line or record in this file for an irrigated parcel. This relationship is therefore "one to one."Each record of this file has 2 space delimited fields as follows:
Field 1. contains the parcel ID.
Field 2. contains the ID of the URF Zone in which this parcel is located.
Not every parcel needs to be represented in this file. Some parcels can be in areas for which no URF zones are defined. For structures that are modeled in the StateMod network but are serving parcels that are not within a URF zone, makertn uses the default return flow location (next downstream node), as well as the default delay patterns. Also, the order of the records in this file is not important. Example lines from a typical irrigated parcel to URF zone database (*.p2z) file is shown below in Figure 3.
... 10163 21 ... |
Figure 3. Parcel to URF Zone Database File
This ASCII text file (space delimited) contains the
URF zone to URF database. This database defines which Unit Response Functions (URF's) to use as delay patterns for groundwater returns and/or depletions due to recharge and/or pumping within the URF zones. The actual URF data is stored in the StateMod delay file (*.dly). This file is typically created manually after the URF's have been developed based on groundwater modeling activities in the State's CDSS project. Each record in this file represents the relationship between a URF zone and a URF describing the stream impacts of recharge or pumping in this zone on a particular river reach. Since several reaches could be affected by activities in one URF zone, there can be multiple records for the same zone. This relationship is therefore "one to many."Each record of this file has 2 space delimited fields as follows:
Field 1. contains the ID (integer) of a URF Zone
Field 2. contains the ID (integer) of the Unit Response Function (URF) in the StateMod
delay file defined for this URF zone
Currently, the URFs are defined such that the sum of each URF pattern represents the percentage of the total impact from this URF zone for a particular reach. Therefore the full amount of the unconsumed diversion applied to parcels within this URF zone must be multiplied by EACH URF. This can results in nodal return flow percentages that sum to more than 100% for URF zones with multiple URF's defined. This is compensated by the fact that the URF's themselves only sum to a fraction of the total returns.
Not every URF zone needs to be represented in this file. Some URF zones may not have URFs defined because the groundwater model showed that pumping and/or recharge in this URF zone did not have a significant effect on any river reach in the basin. For structures that are modeled in the StateMod network but are serving parcels within URF zones with no URF defined, makertn uses the default return flow location (next downstream node) and delay pattern. Also, the order of the records in this file is not important. Example lines from a typical URF zone to URF database (*.z2u) file is shown below in Figure 4.
1 10108 2 10208 3 10308 4 10408 5 10508 6 10608 7 10708 8 10808 8 10816 9 10916 10 11016 11 11116 12 11216 13 11316 14 11416 15 11516 16 11616 18 11816 19 11916 20 12016 24 12401 28 12801 28 12802 29 12901 29 12902 29 12903 32 13204 32 13213 32 13214 32 13215 ... |
Figure 4. URF Zone to URF Database File
This ASCII text file (space delimited) contains the
URF to river reach database. This database defines the river reach with which each URF is associated. The URF describes the delay pattern of stream effects for recharge and/or pumping between a particular URF zone and a particular river reach. This file is typically created manually after the URF's have been developed based on groundwater modeling activities in the State's CDSS project. The river reach ID is actually embedded in the URF ID as the fourth and fifth characters. Each record in this file represents the relationship between a URF and a river reach which is "one to one."Each record of this file has 2 space delimited fields as follows:
Field 1. contains the ID (integer) of a URF
Field 2. contains the ID (integer) of the river reach with which this URF is associated
Every URF zone needs to be represented in this file. However, , the order of the records in this file is not important. Example lines from a typical URF to riiver reach database (*.u2r) file is shown below in Figure 5.
10108 8 10208 8 10308 8 10408 8 10508 8 10608 8 10708 8 10808 8 10816 16 10916 16 11016 16 11116 16 11216 16 11316 16 11416 16 11516 16 11616 16 11816 16 11916 16 12016 16 12401 1 12801 1 12802 2 12901 1 12902 2 12903 3 13204 4 13213 13 13214 14 13215 15 ... |
Figure 5. URF to River Reach Database File
This ASCII text file (space delimited) contains the
river reach to return flow node database. This database defines the nodes to which return flows are delivered within each river reach and the distribution of the return flows between these nodes. The URFs assign return flows (or depletions) from recharge (or pumping) occurring within URF zones to specific river reaches within the basin. The last step, therefore, in the automation of return flow development for StateMod is the assignment of the river reach returns flows to specific nodes in the StateMod network. This file is created manually after the StateMod network has been developed and the URF's have been generated based on groundwater modeling activities in the State's CDSS project. The definition of the river reaches depends on the groundwater modeling. Each record in this file represents the relationship between a river reach and a node in the Statemod network. There are usually multiple nodes for return flows assigned to each river reach, so there will be multiple records for each river reach in this file, making this a "one to many" relationship. The sum of the nodal percentages for each river reach should equal 100%.Each record of this file has 3 space delimited fields as follows:
Field 1. contains the ID (integer) of a river reach
Field 2. contains the ID (text string) of a node within this river
Field 3. contains the percentage (number between 0% and 100%) of the river reach's return
flows to assign to this node
Every river reach needs to be represented in this file. However, the order of the records in this file is not important. Example lines from a typical riiver reach to node database (*.r2n) file is shown below in Figure 6.
1 200846 33 1 200671 33 1 200677 34 2 200775 50 2 20_MS_2 50 3 200627 50 3 200680 50 4 200575 33 4 08240000 67 5 08251500 100 6 220562 33 6 220627 33 6 220501 34 7 220525 50 7 220899_Dwn 50 8 25_MS_11 33 8 250661 67 9 240589 100 10 240581 100 11 210566 25 11 210521 25 11 210565 25 11 210536 25 12 210593 25 12 210513 25 12 210529 25 12 210557 25 13 08241000 100 14 35_MS_3 100 15 350597 100 16 260584 25 16 260655 25 16 26_MS_5 25 16 26_MS_1 25 17 NORDLSCO 100 18 CerroDamC 33 18 90_METRJ 33 18 240537 34 |
Figure 6. River Reach to Node Database File
makertn was created using Microsoft Visual Basic 6.0, and was compiled to create an executable (makertn.exe) file. It should be executed in the Windows (95, 98, 2000, NT, etc.) environment and requires one command line argument, the name of the makertn command file described in Section 2.0. It should be executed from a command line prompt as show below.
makertn will execute in the background until the return flow file, *.rtn, is complete. Errors in reading input will result in a message to the user and stopping the execution of the program.
Output generated by makertn consists of the following file:
the StateMod return flow file (*.rtn) specified in the ReturnFlowFileName variable in the makertn command file.
See also: