VIC Routing Model Preprocessing
VIC Routing Model Preprocessing
Generating a watershed boundary and fraction file for a specific pour point (gage
station location)
• a polygon file with the outlines of the VIC grid cells for the domain of interest.
The hydrosheds files are available globally at 15s resolution (approximately 500 m).
For reference, I also downloaded the ‘rivers’ layer from the hydrosheds, as it will be
useful for checking locations. Here I have downloaded them, and clipped them to
the general region of interest in central Chile, which are my first two input files. How
to generate the polygon file of the VIC grid is described in Appendix A. For the outlet
point, this begins with a shapefile of river flow stations, which will be candidate
routing points, and one is extracted as shown below. These are all in WGS84
geographical coordinates (or have been projected into that). The one highlighted
below is used to demonstrate the following steps.
Mataquito
watershed
outlet
1
Zoom into the point of interest, and identify the latitude/longitude coordinates of it.
Hover the curser over the point where the true outlet is, based on the defined
rivers.
By selecting the one point and using the editing tool, you can move the point
to the exact location noted above:
After saving edits and stopping the editor, the point will be where you
specified. Now select the point again, and export this point as its own
shapefile, in this case as mataquito_outlet.shp.
2
Now open the ArcGIS model VICrouteprep. This shows the workflow to
produce the fraction file.
Specify your four input files by right-clicking on each, selecting ‘open’ and
pointing to the appropriate file. Rename the output file to what you would
like. Run the model. This will produce a fraction file. Alternatively, you can
load the python code generated by ArcGIS from this model and edit it
directly. After successfully running the script, model, or the individual steps,
you can check the VIC-scale fraction file by adding it to the ArcGIS display:
If you want to walk through the steps one at a time, the following describes
each step.
1) Use the snap pour point function to make sure the outlet point is on a line
of high flow accumulation.
3
This produces a raster of the outlet point.
The result of this can be checked against the other layers to see if it is
reasonable.
4
2) Convert the watershed raster to a polygon
3) Now add the vic grid to the map. This is a polygon file (created from raster to
polygon conversion) at the larger VIC grid resolution. This is used to develop the
fraction file for the basin.
4) Add a field to the output of the intersection called “int_area” to contain the area
internal to the delineated basin:
5
Then populate it:
Add another field to contain the fraction of the VIC grid cell within the delineated
basin:
6
5) Now the “frac” field can be joined to the large-scale VIC grid polygon, since they
share an attribute called “GRIDCODE” which is the VIC ID number assigned
originally.
Then dump out the rasters for fraction and flow accumulation (see Appendix B) as
ascii grids. These need to have the same extent. Make sure the fraction file has the
same number of rows and columns, and the same cellsize as the original VIC grid
from which the polygon was created.
6) A secondary calculation produces an output file with the VIC grid cell ID for the
basin outlet.
7
After the model runs, add this layer to the map and look at its properties. The
GRIDCODE should correspond to the VIC cell ID where the outlet is located. This will
be useful to note later.
8
Appendix A: To create the VIC grid polygon that is an input to the above:
1) Get a list of <lat> <lon> <ID> values for the grid cell centers of the VIC
domain. Each grid cell must have a unique ID number. These should be
placed in a 3-column text file.
2) Use grid_latlon.c to convert the 3-column format to a grid ascii format. The
output may need to be modified to convert values to integers.
3) Use the arcgis function to convert the ascii file from step 2 to raster format
5) Similar to the above, use the Add Field data management tool in ArcGIS to
add a base_area attribute to the polygon shapefile. Populate it with
calculated values using the same formula as above.
9
Appendix B: Creating an auxiliary grid to define the domain for output files (for
having multiple stations use the same flow direction file)
Create a regular raster grid at the same resolution as the fine fdir and facc files, and
covering the desired domain equal to the domain of the VIC grid created in
Appendix A. All of the generated frac, fdir output files will use this grid, aggregated
to the final VIC resolution, and station files will identify the drainage points relative
to it as well.
Turn it into a true no_data raster with the spatial analyst con command (not exactly
as typed in the window below; use > instead of = in the expression):
Merge it with the flow accumulation and flow direction rasters so everything has the
same extent, and the outer boundaries coincide with the large-scale VIC cells.
Use the spatial analyst toolbar to set this up to union the extents:
10
From the dropdown menu go to raster calculator and type in the expression to
merge:
Te output is labeled “calculation” and will look the same as the acc grid, but have
the complete extent needed.
Use the raster to ascii conversion to dump this file out as an ascii grid, which will be
used by later programs (outside of arcgis) to determine the flow directions at the
VIC scale.
11