make_hydrodem Module
- make_hydrodem.SnapExtent(lExtent, lRaster)
Returns a given extent snapped to the passed raster.
- Parameters:
- lExtentstr
ESRI ArcPy extent string.
- lRasterstr
Path to raster dataset.
- Returns:
- extentstr
ESRI ArcPy extent string.
- make_hydrodem.adjust_accum(facPth, fdrPth, upstreamFACpths, upstreamFDRpths, workspace, version=None)
Adjust a downstream flow accumulation (FAC) raster based on upstream flow accumulation rasters.
This function adjusts the FAC of a downstream HUC to include flow accumulations from upstream HUCs. Run this from the downstream HUC workspace. The function will leave the original FAC grids intact and will create a grid named “fac_global” in the same directory as the original FAC raster. To get true accumulation values in HUCs downstream of other non-headwater HUCs, proceed from upstream HUCs to downstream HUCs in order, and specify the fac_global grid for any upstream HUC that has one. (It is not essential that the fac_global contain true global fac values, and in some cases it is not possible since the values get too large to be stored in a raster file. In practice, as long as the receiving cells have accumulation values larger than the stream definition threshold (150,000 cells for 10-m grids), then the ESRI ArcHydro data model will still function.
- Parameters:
- facPthstr
Path to downstream flow accumulation grid.
- fdrPthstr
Path to downstream flow direction grid.
- upstreamFACpthslist
List of paths to upstream flow accumulation grids. Must be entered in same order as upstreamFDRpths.
- upstreamFDRpthslist
List of paths to upstream flow direction grids. Must be entered in same order as upstreamFACpths.
- workspacestr
local geodatabase to work in.
- versionstr (optional)
Stream Stats datapreptool version number.
- Returns:
- facGlobalraster
Adjusted flow accumulation raster created in the same directory as fac.
Examples
adjust_accum(“./01010001/fac”, 2, [“./01010002/fac”, “./01010003/fac”])
- make_hydrodem.adjust_accum_simple(ptin, fdrin, facin, filin, facout, incrval, version=None)
Simple flow accumulation grid adjustment.
Adds a value to the flow accumulation grid given an input point using a least-cost-path to cascade down through the flow direction grid.
- Parameters:
- ptinstr (feature class)
Point feature class representing one inlet to the downstream DEM.
- fdrinstr (raster)
Flow direction raster.
- facinstr (raster)
Name of the flow accumulation raster.
- filinstr (raster)
Burned DEM to use as cost surface.
- facoutstr (raster)
Output name of adjusted FAC grid.
- incrvalint
Value to adjust the downstream FAC grid by.
- versionstr
Stream Stats version number.
- Returns:
- fac_globalraster
Adjusted FAC grid written to facout.
- make_hydrodem.aggregate2huc6(wkspcH8, wkspcH6, huc6nm, version=None)
Aggregates already processed huc8 folders to huc6 folder format.
This tool aggregates data prepped huc8 folders to huc6 folder structures. The process mosaics fdr rasters from huc8 folders, creates a larger merged fdr at huc6 level and calculates huc6 level fac which allows users to skip adjust accumulation tool in most cases; and will be simpler to assemble hucpolys for global GDB. A user can then skipped to the posthydrodem tool to generate required layers.
- Parameters:
- wkspcH8str
Path to top level folder where huc8 folders exist.
- wkspcH6str
Path to top level folder where huc6 folders will exist. Must first create this folder if it does not exist.
- huc6nmstr
6 digit huc number as string.
- Returns:
- fdrraster
merged huc6 level fdr.
- facraster
huc6 level fac.
- make_hydrodem.agree(origdem, dendrite, agreebuf, agreesmooth, agreesharp)
Function to adjust a DEM to match a vector.
- Parameters:
- origdemRaster Object
Original DEM with the desired cell size.
- dendriteRaster Object
Dendrite feature layer to adjust the DEM.
- agreebuffloat
Buffer smoothing distance (same units as horizontal map units).
- agreesmoothfloat
Smoothing distance (same units as the vertical map units).
- agreesharpfloat
Distance for sharp feature (same units as the vertical map units).
- Returns:
- elevgridRaster Object
Conditioned elevation grid.
Notes
Original function by Ferdi Hellweger, http://www.ce.utexas.edu/prof/maidment/gishydro/ferdi/research/agree/agree.html
- make_hydrodem.bathymetricGradient(workspace, snapGrid, hucPoly, hydrographyArea, hydrographyFlowline, hydrographyWaterbody, cellsize, version=None)
Generates the input datasets from hydrography features for enforcing a bathymetic gradient in hydroDEM (bowling).
- Parameters:
- workspacestr
Path to the geodatabase workspace.
- snapGridstr
Path to the raster snap grid used for the project.
- hucPolystr
Path to the bounding polygon for the local folder for which inputs are generated.
- hydrographyAreastr
Path to the double line stream features.
- hydrographyFlowlinestr
Path to the flowline features.
- hydrographyWaterbodystr
Path to the waterbody features.
- cellsizestr
Output cell size to use for rasterization.
- versionstr (optional)
Package version number.
- Returns:
- hydro_flowlinesraster
Grid representation of flowlines.
- hydro_areasraster
Grid representation of double line streams and flowlines.
Notes
Outputs are written to the workspace.
- make_hydrodem.coastaldem(Input_Workspace, grdNamePth, InFeatureClass, OutRaster, seaLevel, version=None)
Sets elevations for water and other areas in digital elevation model.
- Parameters:
- Input_Workspacestr
Input workspace, output raster will be written to this location.
- grdNamePthstr
Path to the input DEM grid.
- InFeatureClassstr
Path to the LandSea feature class.
- OutRasterstr
Output DEM grid name.
- seaLevelfloat
Elevation at which to make the sea.
- versionstr (optional)
StreamStats Data Preparation Tools version number
- Returns:
- OutRasterraster
Output raster with coastal areas corrected.
Notes
Outputs are written to the workspace.
- make_hydrodem.convertAllRegionsTiffs(workspace)
For each HUC region, convert output rasters from posthydrodem tool to geotiff format. Assumes HUC directories contain input_data.gdb. Parameters ———- workspace : str
Path to archydro directory containing HUC directories.
Returns
None
- make_hydrodem.convertDemEnfRaster(workspace)
For each HUC# or top-level archydro folder where all of HUC# folders exist, runs generateDemEnfPolys module.
- Parameters:
- workspacestr
Path to either HUC# folders or archydro folder containing HUC# folders.
- Returns
- ——-
- None
- make_hydrodem.convertTiffs(workspace)
Use the arcpy Raster To Other Format tool to convert outputs of Post Hydrodem tool to GeoTIFFs Parameters ———- workspace : str
Path to directory containing the output posthydrodem rasters.
Returns
None
- make_hydrodem.generateDemEnfPolys(workspace)
Generates demEnflines and demEnfpolys (by converting dem-enforced raster) which can help detect digital loops that can occur when NHDflowlines are too close to each other and may cause the flow to go different direction than the originally intended path of the vector lines.
- Parameters:
- workspacestr
Path to HUC# folders
- Returns
- ——-
- demEnfLinefeature class
Lines generated from dem-enforced raster with elevation values less than 0
- demEnfPolyfeature class
Polygons generated from demEnfLines
- make_hydrodem.hydrodem(outdir, huc8cov, origdemPth, dendrite, snap_grid, bowl_polys, bowl_lines, inwall, drainplug, buffdist, inwallbuffdist, inwallht, outwallht, agreebuf, agreesmooth, agreesharp, bowldepth, scratchWorkspace, version=None)
Hydro-enforce a DEM using hydrography data sets.
This function is used by the National StreamStats Team as the optimal approach for preparing a state’s physiographic datasets for watershed delineations. It takes as input, a digital elevation model (DEM), and enforces this data to recognize the supplied hydrography as correct. Supplied watershed boundaries can also be recognized as correct if available for a given state/region. This function assumes that the DEM has first been projected to a state’s projection of choice. This function prepares data to be used in the ESRI ArcHydro data model (the GIS database environment for National StreamStats).
- Parameters:
- outdirDEworkspace
Working directory.
- huc8covDEFeatureClass
Local division feature class, often HUC8, this will be the outer wall of the hydroDEM. (No outer wall option: this tool can be used without the huc8cov when NHD and/or DEM does not match well with the existing huc8cov)
- origdemPthstr
Path to the original, projected DEM.
- dendritestr
Path to the dendrite feature class to be used.
- snap_gridstr
Path to a raster dataset to use as a snap_grid to align all the watersheds, often the same as the DEM.
- bowl_polysstr
Path to the bowling area raster generated from the bathymetric gradient tool.
- bowl_linesstr
Path to the bowling line raster generated from the bathymetric gradient tool.
- inwallstr
Path to the feature class to be used for inwalling.
- drainplug
Path to the feature class used for inserting sinks into the dataset.
- buffdistfloat
Distance to buffer the outer wall, same units as the projection.
- inwallbuffdist
Distance to buffer the inner walls, same units as the projection.
- inwallht
Inwall height, same units as the projection.
- outwallht
Inwall height, same units as the projection.
- agreebuf
AGREE function buffer distance, same units as the projection.
- agreesmooth
AGREE function smoothing distance, same units as the projection.
- agreesharp
AGREE function sharp distance, same units as the projection.
- bowldepth
Bowling depth, same units as the projection.
- scratchWorkspacestr
Path to scratch workspace.
- versionstr (optional)
Package version number.
- Returns (saved to outDIR)
- ——-
- filldemraster
hydro-enforced DEM raster grid saved to outDir.
- fdirgraster
HydroDEM FDR raster grid saved to outDir.
- faccgraster
HydroDEM FAC raster grid saved to outDir.
- sink_pathfeature class
Sink feature class saved to outDir.
- make_hydrodem.moveRasters(source, dest, rasters, fmt=None)
Move raster out of a working geodatabase to a destination folder.
- Parameters:
- sourcestr
Path to geodatabase containing the rasters.
- deststr
Path to destination location.
- rasterslist
List of rasters to move from source to dest.
- fmtstr (optional)
Extension indicating the raster format the output without the leading period, e.g. “tif”.
- Returns:
- None
- make_hydrodem.postHydroDEM(workspace, facPth, fdrPth, thresh1, thresh2, convTiffs, sinksPth=None, version=None)
Generate stream reaches, adjoint catchments, and drainage points
- Parameters:
- workspacestr
database-type workspace to output rasters and feature classes.
- facPthstr
Path to the flow accumulation grid produced by hydroDEM.
- fdrPthstr
Path to the flow direction grid produced by hydroDEM.
- thresh1int
Threshold used to produce the str grid, in raster cells, usually equal to 15,000,000 \(m^2\).
- thresh2int
Threshold used to produce the str900 grid or similar, in raster cells, usually equal to 810,000 \(m^2\).
- convTiffs: boolean
Whether or not to save outputs in GeoTIFF format in addition to ESRI grids
- sinksPthstr (optional)
Path to the sinklnk grid, optional.
- versionstr (optional)
StreamStats DataPrepTools version to be printed.
- Returns:
- strraster
Stream raster where fac > 15,000,000 \(m^2\).
- str<thresh2>raster
Stream raster where fac > 810,000 \(m^2\).
- strlnkraster
Raster with streams labeled with index values.
- lnkraster
Merged stream and sink raster.
- catraster
Catchment raster.
- drainageLinefeature class
Vectorized streams.
- catchmentfeature class
Vectorized catchments.
- adjointCatchmentfeature class
Vectorized catchments for use in delineation.
- drainagePointfeature class
Point located at the greatest flow accumulation value in each catchment.
Notes
This tool requires ESRI ArcHydro to be installed and currently works with Python 2 or 3.