Theanalysis
API
analysis
API Reference¶
Top-level functions for python-tidegates.
This contains main functions to evaluate the extent of floodinga and damage due to floods.
- Geosyntec Consultants, 2015.
Released under the BSD 3-clause license (see LICENSE file for more info)
Written by Paul Hobson (phobson@geosyntec.com)
-
tidegates.analysis.
process_dem_and_zones
(dem, zones, ID_column, cleanup=True, **verbose_options)¶ Convert DEM and Zones layers to numpy arrays.
This is a pre-processor of the DEM and Zone of Influent input data. Both are converted to numpy arrays and returned along with a raster template so that the arrays can be correctly georeferenced if necessary. These returned values are intended to be fed directly to
flood_area()
.Parameters: dem : str or arcpy.Raster
The topographic data needed to assess flood impacts.
zones : str or arcpy.mapping.Layer
The shapefile or feature class representing the tidegates’ zones of influence.
ID_column : str
Name of the column in the attribute table of
zones
that uniquely identifies each tidegate.cleanup : bool, optional (True)
Toggles the removal of temporary files.
Returns: topo_array, zones_array : numpy.ndarray
Arrays of the topo data and zones of influence.
template : tidegates.utils.RasterTemplate
A raster template that can be used to georeference the returned arrays.
Other Parameters: verbose : bool (default = False)
Toggles the printing of messages communication the progress of the processing.
asMessage : bool (default = False)
When True, progress messages are passed through
arcpy.AddMessage
. Otherwise, the msg is simply printed to stdin.See also
-
tidegates.analysis.
flood_area
(topo_array, zones_array, template, ID_column, elevation_feet, filename=None, cleanup=True, **verbose_options)¶ Mask out portions of a a tidegates area of influence below a certain elevation.
Parameters: topo_array : numpy array
Floating point array of the digital elevation model.
zones_array : numpy array
Categorical (integer) array of where each non-zero value delineates a tidegate’s zone of influence.
template : arcpy.Raster or utils.RasterTemplate
A raster or raster-like object that define the spatial extent of the analysis area. Required attributes are:
- templatemeanCellWidth
- templatemeanCellHeight
- templateextent.lowerLeft
ID_column : str
Name of the column in the
zones
layer that associates each geomstry with a tidegate.elevation_feet: float
The theoritical flood elevation (in ft MSL) that will be analyzed.
filename : str, optional
Filename to which the flooded zone will be saved.
cleanup : bool (default = True)
When True, temporary results are removed from disk.
Returns: flood_zones : arcpy.mapping.Layer
arcpy Layer of the zones showing the extent flooded behind each tidegate.
Other Parameters: verbose : bool (default = False)
Toggles the printing of messages communication the progress of the processing.
asMessage : bool (default = False)
When True, progress messages are passed through
arcpy.AddMessage
. Otherwise, the msg is simply printed to stdin.
-
tidegates.analysis.
assess_impact
(floods_path, flood_idcol, cleanup=False, wetlands_path=None, wetlands_output=None, buildings_path=None, buildings_output=None, bldg_idcol='STRUCT_ID', **verbose_options)¶ Assess the extent of damage due to flooding in wetlands and buildings.
Parameters: floods_path : str or arcpy.mapping.Layer
The (filepath to the) layer of the extent of flooding. Ideally, this layer should be generated with
flood_area
.flood_idcol : str
Name of the column in the
floods_path
layer that associates each geomstry with a tidegate.wetlands_path, buildings_path : str
Paths to layers containing wetlands and building footprints.
wetlands_output, buildings_output : str
Path to where the final output of the assessed damage to the wetlands and buildings should be saved.
cleanup : bool (default = True)
When True, temporary results are removed from disk.
Returns: flooded_areas : arcpy.mapping.Layer
flooded_wetlands : arcpy.mapping.Layer
flooded_buildings : arcpy.mapping.Layer
Other Parameters: verbose : bool (default = False)
Toggles the printing of messages communication the progress of the processing.
asMessage : bool (default = False)
When True, progress messages are passed through
arcpy.AddMessage
. Otherwise, the msg is simply printed to stdin.See also
-
tidegates.analysis.
area_of_impacts
(*args, **kwargs)¶ Computes the area of assets impacted by a flooded area.
The impacted area is anywhere an asset and the flooded areas overlap. This is useful for such tasks as determine the amount of wetlands inundated by a flood.
Parameters: floods_path : str
Path/filename of the dataset of flooded areas. Ideally this is output from
flood_area()
.flood_idcol : str
Name of the field in
floods_path
that associates each flooded area with a tidegate.assets_input : str
Path/filename of the dataset of assets (e.g., wetland boundaries).
fieldname : str, optional (‘wetlands’)
The name of the field that will be added to
floods_path
containing the count of impacted assets for each flooded area.assets_output : str, optional
Path/filename of the dataset in which only the impacted assets will be saved.
Returns: flooded_assets : arcpy.mapping.Layer
Layer of the flooded assets.
See also
-
tidegates.analysis.
count_of_impacts
(*args, **kwargs)¶ Counts of the number of assets impacted by a flooded area.
An asset is considered impacted if a flooded area overlaps its boundary in anyway. This is useful for such tasks as counting the number of building footprints within a flood area.
Parameters: floods_path : str
Path/filename of the dataset of flooded areas. Ideally this is output from
flood_area()
.flood_idcol : str
Name of the field in
floods_path
that associates each flooded area with a tidegate.assets_input : str
Path/filename of the dataset of assets (e.g., building footprints).
fieldname : str, optional (‘buildings’)
The name of the field that will be added to
floods_path
containing the count of impacted assets for each flooded area.assets_output : str, optional
Path/filename of the dataset in which only the impacted assets will be saved.
Returns: touched_assets : arcpy.mapping.Layer
Layer of the impacted assets.
See also