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.
- upstreamFDRpthslist
List of paths to upstream flow direction grids.
- 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:
- hydrodemfac_globalraster
Adjusted FAC grid written to facout.
- 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.hydrodem(outdir, huc8cov, origdemPth, dendrite, snap_grid, bowl_polys, bowl_lines, inwall, drainplug, buffdist, inwallbuffdist, inwallht, outwallht, agreebuf, agreesmooth, agreesharp, bowldepth, cellsz, 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.
- 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.
- cellsz
Cell size, 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, 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\).
- sinksPthstr (optional)
Path to the snklnk 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 only works with Python 2.