This repository houses a Python toolbox of tools for preprocessing inputs and postprocessing outputs of the RAPID (Routing Application for Parallel computation of Discharge) model. To find out more about RAPID, please visit http://rapid-hub.org/.
- Ensure you have ArcGIS for Desktop installed.
- If your version of ArcGIS for Desktop is previous to 10.2, you must install the [netCDF4 Python package] (https://pypi.python.org/pypi/netCDF4). An executable for installing netCDF4-1.0.8 with Python 2.7 is available [here] (http://downloads.esri.com/archydro/archydro/Setup/10.2.x/rapid/).
- Download the toolbox and place it in an appropriate folder on your machine. Navigate to the folder in Catalog. If you expand all the toolsets, you will see the following:
-
In order to use the Preprocessing tools, you will need to have the following inputs available:
- Drainage Line and Catchment feature classes for the watersheds of interests. To learn about how to create them, please refer to the workflow of Basic Dendritic Terrain Processing with ArcHydro tools.
- For WRF-Hydro, you will need both its geogrid file and runoff file; for ECMWF, you will need only the runoff file.
Find a bug or want to request a new feature? Please let us know by submitting an issue.
Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.
The tools are organized into four toolsets. One for preprocessing and preparing the input datasets for RAPID. The second is for generating calibrated values for the Muksingum Paremeters. The third is for doing some postprocessing especially for visualizing the RAPID output of stream flow. The fourth toolset has some utilities to assist you with the workflow and sharing the visualization as web map service.
-
This tool is used to generate values of Kfac based on the flow wave celerity (Co) for the basin as well as length and slope of each stream reach.
There are three options:
- River Length/Co
- Eta*River Length/Sqrt(River Slope)
- Eta*River Length/Sqrt(River Slope) [0.05, 0.95] - this option filters out slopes outside the 5th and 95th percentiles.
Note: Eta = Average(River Length/Co of all rivers) / Average(River Length/Sqrt(River Slope) of all rivers)
-
Using lambda, this tool modifies each of the Kfac values by multiplying by lambda and generates the calibrated Muskgingum K file (e.g. k.csv). The value for lambda is obtained by running the calibration routine in RAPID for your simulation.
-
This tool adds or updates the Musk_x field to the drainage line and sets the value to the input provided by the user (Default is 0.3). If a shapefile with reservoirs is given, then it will set the value to "0" where it intersects the drainage line.
-
This tool generates the Muskingum X file based on the Musk_x field in the drainage lines.
-
This tool creates the stream network connectivity file based on two fields in the input Drainage Line feature class: HydroID, and NextDownID. It does the following:
- Finds the HydroID of each stream.
- Counts the total number of its upstreams.
- Writes the stream HydroID, the total number of its upstreams, and the HydroID(s) of all upstream(s) into the output file. The records are sorted in the ascending order based on the stream HydroID.
-
This tool creates the stream network connectivity file based on four fields in the input Drainage Line feature class: COMID, FROMNODE, TONODE, DIVERGENCE. It does the following:
- Disconnects streams with divergence greater than 1.
- Creates NextDownID based on COMID, FROMNODE, and TONODE fields.
- Runs the Create Connectivity File tool with updated fields.
-
This tool writes the HydroID of a subset of the stream features. The subset is created by selecting stream features in the input layer.
-
This tool writes the values of the Muskingum parameter fields (Musk_kfac, Musk_k, and Musk_x) into individual parameter files. The three fields can be calculated using the Calculate Muskingum Parameters tool in the ArcHydro toolbox. The records in all files are sorted in the ascending order based on the stream HydroID.
-
This tool creates a table that represents the runoff contribution of the ECMWF/WRF-Hydro computational grid to the catchment. It requires that the input Catchment feature class has a drainage line ID field that corresponds to the HydroID of the Drainage Line feature class. If your input Catchment feature class does not have that field, you can use the Add DrainLnID to Catchment tool in the ArcHydro toolbox. This tool does the following:
For ECMWF,
- Creates computational grid point feature class based on the latitude and longitude in the ECMWF runoff file.
- Creates Thiessen polygons from the computational grid points. The Thiessen polygons represent computational grids.
For WRF-Hydro,
- Creates a raster based on the spatial resolution, extent, and projection information in the WRF geogrid file.
- Creates fishnet polygons and points based on the raster. The polygons and points represent the computational grids and points.
Then for both,
- Intersects the computational polygons with the input catchments.
- Calculates the geodesic area for each intersected polygon.
- Calculates the area ratio of each intersected polygon to its corresponding catchment, which is defined as the weight representing the contribution of the computational grid to the catchment (drainage line segment).
- Writes the stream ID, the coordinates of the contributing computational grid, the contributing area, and the weight, etcetera, into the weight table.
The records in the weight table are sorted in the ascending order based on the stream ID.
-
This tool updates the weight table specifically for the scenario in which the Drainage Line and the Catchment features are not one-to-one relationship. It does the following to the weight table:
- Removes the rows with stream IDs that don’t have a match in the Drainage Line feature class.
- Adds rows with stream IDs that are in the Drainage Line but not in the Catchment feature class. In these newly added rows, the contributing area and the weight are given values of 0. And the "npoints" (number of points) column that represents the total number of computational grids contributing to the same catchment is given the value of 1.
-
This tool creates the RAPID inflow file from ECMWF / WRF-Hydro runoff data. It does the following:
- Obtains a list of stream IDs based on the input drainage line feature class.
- For each stream feature, obtains the information of all contributing computational grids from the weight table.
- Calculates the runoff to each stream feature based on the computational-grid-specific runoff rates from the ECMWF / WRF-Hydro runoff data file and the contributing areas from the weight table.
- If a stream ID does not have a corresponding record in the weight table, specifies its runoff as 0.
- Writes the runoff data into the inflow file in netCDF format.
-
This tool creates a discharge table converted from the RAPID discharge file. In the discharge table, each row contains the information of COMID (an ID field of the NHDPlus dataset), time, and the discharge of the stream at the time step. Time in date/time format is calculated based on the start date and time input by the user and the time dimension of the stream flow variable in the RAPID discharge file. Attribute indexes are added respectively for COMID, and the time fields in the table. The discharge table is saved in a SQL Server geodatabase or a file geodatabase.
-
This tool creates a map document with time-enabled stream flow layer(s) showing stream- and time-specific discharge amounts. Stream flow can be animated in the discharge map. The tool does the following:
- If the layer information is not specified, all stream features that have records in the discharge table will be copied into the same geodatabase where the discharge table is. If the layer information is specified, based on the information of minimum stream order for each layer, stream features are selected using the query definition of stream order >= the minimum, then the selected stream features are copied into the same geodatabase where the discharge table is.
- Creates a map document and add all the copied stream feature classes into the map.
- For each layer, adds a join to the discharge table based on COMID as the join field.
- For each layer, defines the minScale and maxScale based on the user-specified information.
- Applies symbology to each layer based on the same template layer file. Note that the layers of data in SQL Server geodatabase and file geodatabase have different templates.
- Updates the time properties for each layer based on the time-enabled template.
-
This tool updates the existing map document by applying symbology from a template layer file to the layer(s) in the map document. The tool is run only if the discharge table has been updated.
-
This tool adds the fields required to be used in the Streamflow Prediction Tool web application (https://github.com/erdc/tethysapp-streamflow_prediction_tool).
-
This tool writes the file with rivid and gage ids used in the Streamflow Prediction Tool forecast framework for data assimilation (https://github.com/erdc/spt_ecmwf_autorapid_process).
-
This tool copies the discharge table, the drainage line features, or both to the ArcGIS server machine from the author/publisher machine.
-
This tool writes the centroid coordinates of flowlines into a CSV file.
-
This tool publishes a discharge map service of stream flow visualization to an ArcGIS server.
-
This tool creates the stream network reqired for RAPID input from the DEM(s) provided using ArcHydro Tools.
-
This tool creates the required RAPID input files automatically using the defaults provided by the tools. These files include:
- The connectivity file.
- The subset file.
- The Muskingum K & Kfac files.
- The Muskingum X file.
- The comid_lat_lon_z file.
There is an option to add the catchments for the stream network. If added, it will also generate:
- The High-Resolution ECMWF forecast weight table.
- The Low-Resolution ECMWF forecast weight table.
- The ERA Interim weight table.
-
This tool will run the "Add Streamflow Prediction Tool Fields" tool and generate the shapefiles needed for the Streamflow Prediction Tool web application (https://github.com/erdc/tethysapp-streamflow_prediction_tool).
-
This tool requires the HydroSHEDS 3 arc-second hydrologically conditioned .bil DEM data (www.hydrosheds.org). It also requires the HydroBASINS (www.hydrosheds.org) level 3 boundaries with the associated "RegionName" field added manually with a descriptive region name for each region. With all of the .bil DEM files in one folder, it will determine the DEM(s) required for the watershed and run automatically:
- DEM to Stream Network
- Stream Network to RAPID
- Stream Network to SPT
Copyright 2016 Esri
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
A copy of the license is available in the repository's License.txt file.
[](Esri Tags: ArcGIS Python Toolbox of Preprocessing and Postprocessing for a River Routing Model RAPID) [](Esri Language: Python)