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.3, 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 three toolsets. One for preprocessing and preparing the input datasets for RAPID. Another for doing some postprocessing especially for visualizing the RAPID output of stream flow. The third toolset has some utilities to assist you with the workflow and sharing the visualization as web map service.
-
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 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 writes the centroid coordinates of flowlines into a CSV file.
-
This tool copies the discharge table, the drainage line features, or both to the ArcGIS server machine from the author/publisher machine.
-
This tool publishes a discharge map service of stream flow visualization to an ArcGIS server.
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)