elevationTools Module

elevationTools.checkNoData(InGrid, tmpLoc, OutPolys_shp, version=None)

Generates a feature class of no data values.

Parameters:
InGridRaster

Input DEM grid to search for no data values.

tmpLocstr

Path to workspace.

OutPoly_shpstr

Name for output feature class.

versionstr, optional

StreamStats DataPrepTools version.

Returns:
featCountint

Count of no data features generated.

OutPoly_shpfeature class

No data feature class written to tmpLoc.

elevationTools.check_projection(ds1, ds2)

Check if the projections of the two files are the same.

Parameters:
ds1str

Path to first geospatial file.

ds2str

Path to second geospatial file.

Returns:
samebool

Boolean indicating if the projections are the same or not.

Notes

Slightly modified from Chris Wills’ post: https://gis.stackexchange.com/questions/170088/checking-if-two-feature-classes-have-same-spatial-reference-using-arcpy

elevationTools.compareSpatialRefUnits(grd)

Compare horizontal and vertical units from a raster dataset. Returns True if units are the same, returns False if they are different.

Parameters:
grdstr

Path to raster dataset.

Returns:
sameUnitsbool

True if units are the same, False if not.

elevationTools.elevIndex(OutLoc, rcName, coordsysRaster, InputELEVDATAws, version=None)

Make a raster mosaic dataset of the digital elevation model geospatial tiles supplied to the function.

Parameters:
OutLocstr

Path to output location for the raster catalog.

rcNamestr

Name of the output mosaic raster dataset.

coordsysRasterstr

Path to raster from which to base the mosaic dataset’s coordinate system.

InputELEVDATAwsstr

Path to workspace containing the elevation data to be included in the mosaic raster dataset. Rasters in this workspace should be either geoTiffs or ESRI grids. Rasters must be unzipped, but they may be in subfolders.

versionstr (optional)

StreamStats DataPrepTools version number.

Returns:
OutFCfeature class

Output feature class of polygons with an attribute describing the full path to the elevation data tiles.

elevationTools.extractPoly(Input_Workspace, nedindx, clpfeat, OutGrd, version=None)

Extracts watershed DEM from a raster mosaic dataset of tiles based on a watershed polygon feature.

Parameters:
Input_Workspacestr

Path to the workspace to work in.

nedindxstr

Path to the elevation data mosaic dataset.

clpfeatstr

Path to the clipping feature.

OutGrdstr

Name of the output grid to be generated in Input_Workspace.

versionstr, optional

StreamStats DataPrepTools version number.

Returns:
OutGrdraster

Output extracted raster to Input_Workspace.

elevationTools.fillNoData(workspace, InGrid, OutGrid, version=None)

Replaces NODATA values in a grid with mean values within 3x3 window around each NODATA value.

Parameters:
workspacestr

Path to the workspace to work in.

InGridstr

Name of the input grid to be filled.

OutGridstr

Name of the output grid.

Versionstr (optional)

Code version.

Returns:
OutGridraster

Filled raster grid output to workspace.

Notes

May be run repeatedly to fill in areas wider than 2 cells. Note that the output is floating point, even if the input is integer. This function will expand the data area of the grid around the outer edges of data, in addition to filling in NODATA gaps in the interior of the grid.

elevationTools.projScale(Input_Workspace, InGrd, OutGrd, OutCoordsys, OutCellSize, RegistrationPoint, scaleFact=100, version=None)

Projects a DEM grid to a user-specified coordinate system, handling cell registration and converts the output grid to integers using a scale factor. The default settings assume the digital elevation model uses meters (m) as the z-units.

Parameters:
Input_Workspacestr

Path to input workspace.

InGrdstr

Name of the grid to be projected and scaled.

OutGrdstr

Name of the output grid.

OutCoordsysstr

Path to the dataset to base the projection off of.

OutCellSizeint or float

Cell size for output grid.

RegistrationPointstr

Registration point for output grid so all grids snap correctly. In the format “0 0” where the zeros are the x and y of the registration point.

scaleFactint

Scale factor to convert grid values to integers, defaults to 100, converting m to cm.

versionstr

StreamStats version number.

Returns:
OutGrdraster

Rescaled and projected raster file in the input workspace.