Methods for querying the NHDPlus V2 data set. More...
Functions | |
def | getNHDReachcodeAndMeasureForGageSourceFea |
Get NHD Reachcode and measure along reach for a streamflow gage identified by a source_fea (e.g. | |
def | getLocationForStreamGageByGageSourceFea |
Get lat/lon, in WGS84 (EPSG:4326), from gage point layer (Gage_Loc) for gage identified by a source_fea (e.g. | |
def | getLocationForStreamGageByReachcodeAndMeasure |
Get lat/lon, in WGS84 (EPSG:4326), from gage point layer (Gage_Loc) for gage identified by reachcode and measure. | |
def | getLocationForStreamGage |
Get lat/lon, in WGS84 (EPSG:4326), from gage point layer (Gage_Loc) for gage identified by reachcode and measure. | |
def | getComIdForStreamGage |
Uses NHDFlowline and/or NHDReachCode_ComID table(s) to lookup the ComID associated with a stream gage identified by reach code and measure. | |
def | getPlusFlowPredecessors |
Get the immediate predecessors of the NHDPlus2 PlusFlow feature of comID. | |
def | getUpstreamReachesSQL |
Recursively searches PlusFlow table in an SQLite database for all stream reaches upstream of a given reach. | |
def | getBoundingBoxForCatchmentsForGage |
Get bounding box coordinates (in WGS 84) for the drainage area associated with a given NHD (National Hydrography Dataset) streamflow gage identified by a reach code and measure. | |
def | getCatchmentShapefileForGage |
Get shapefile (in WGS 84) for the drainage area associated with a given NHD (National Hydrography Dataset) streamflow gage identified by a reach code and measure. | |
def | getCatchmentShapefileForGageOGR |
Get shapefile (in WGS 84) for the drainage area associated with a given NHD (National Hydrography Dataset) streamflow gage identified by a reach code and measure. | |
Variables | |
int | NORTH 0 |
int | EAST 90 |
string | OGR_SHAPEFILE_DRIVER_NAME "ESRI Shapefile" |
int | UPSTREAM_SEARCH_THRESHOLD 998 |
Methods for querying the NHDPlus V2 data set.
Requires that a NHDPlus V2 database be initialized from data archive files using NHDPlusSetup.py
This software is provided free of charge under the New BSD License. Please see the following license information:
Copyright (c) 2013, University of North Carolina at Chapel Hill All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
def ecohydroworkflowlib.nhdplus2.networkanalysis.getBoundingBoxForCatchmentsForGage | ( | config, | |
outputDir, | |||
reachcode, | |||
measure, | |||
deleteIntermediateFiles = True |
|||
) |
Get bounding box coordinates (in WGS 84) for the drainage area associated with a given NHD (National Hydrography Dataset) streamflow gage identified by a reach code and measure.
config | A Python ConfigParser containing the following sections and options: 'GDAL/OGR' and option 'PATH_OF_OGR2OGR' (absolute path of ogr2ogr binary) 'NHDPLUS2' and option 'PATH_OF_NHDPLUS2_DB' (absolute path to SQLite3 DB of NHDFlow data) 'NHDPLUS2', 'PATH_OF_NHDPLUS2_CATCHMENT' (absolute path to NHD catchment SQLite3 spatial DB) |
outputDir | String representing the absolute/relative path of the directory into which output rasters should be written |
reachcode | String representing NHD streamflow gage |
measure | Float representing the measure along reach where Stream Gage is located in percent from downstream end of the one or more NHDFlowline features that are assigned to the ReachCode (see NHDPlusV21 GageLoc table) |
deleteIntermediateFiles | A boolean, True if intermediate files generated from the analysis should be deleted |
@exception ConfigParser.NoSectionError @exception ConfigParser.NoOptionError @exception IOError(errno.ENOTDIR) if outputDir is not a directory @exception IOError(errno.EACCESS) if outputDir is not writable
def ecohydroworkflowlib.nhdplus2.networkanalysis.getCatchmentShapefileForGage | ( | config, | |
outputDir, | |||
catchmentFilename, | |||
reachcode, | |||
measure, | |||
deleteIntermediateFiles = True |
|||
) |
Get shapefile (in WGS 84) for the drainage area associated with a given NHD (National Hydrography Dataset) streamflow gage identified by a reach code and measure.
config | A Python ConfigParser containing the following sections and options: 'GDAL/OGR' and option 'PATH_OF_OGR2OGR' (absolute path of ogr2ogr binary) 'NHDPLUS2' and option 'PATH_OF_NHDPLUS2_DB' (absolute path to SQLite3 DB of NHDFlow data) 'NHDPLUS2', 'PATH_OF_NHDPLUS2_CATCHMENT' (absolute path to NHD catchment shapefile) |
outputDir | String representing the absolute/relative path of the directory into which output rasters should be written |
catchmentFilename | String representing name of file to save catchment shapefile to |
reachcode | String representing NHD streamflow gage |
measure | Float representing the measure along reach where Stream Gage is located in percent from downstream end of the one or more NHDFlowline features that are assigned to the ReachCode (see NHDPlusV21 GageLoc table) |
ConfigParser.NoSectionError | |
ConfigParser.NoOptionError | |
IOError(errno.ENOTDIR) | if outputDir is not a directory |
IOError(errno.EACCESS) | if outputDir is not writable |
Exception | if number of upstream reaches is greater than 1000 |
Exception | of catchment shapefile extraction fails |
def ecohydroworkflowlib.nhdplus2.networkanalysis.getCatchmentShapefileForGageOGR | ( | config, | |
outputDir, | |||
catchmentFilename, | |||
reachcode, | |||
measure, | |||
deleteIntermediateFiles = True |
|||
) |
Get shapefile (in WGS 84) for the drainage area associated with a given NHD (National Hydrography Dataset) streamflow gage identified by a reach code and measure.
config | A Python ConfigParser containing the following sections and options: 'NHDPLUS2' and option 'PATH_OF_NHDPLUS2_DB' (absolute path to SQLite3 DB of NHDFlow data) 'NHDPLUS2', 'PATH_OF_NHDPLUS2_CATCHMENT' (absolute path to NHD catchment shapefile) |
outputDir | String representing the absolute/relative path of the directory into which output rasters should be written |
catchmentFilename | String representing name of file to save catchment shapefile to |
reachcode | String representing NHD streamflow gage |
measure | Float representing the measure along reach where Stream Gage is located in percent from downstream end of the one or more NHDFlowline features that are assigned to the ReachCode (see NHDPlusV21 GageLoc table) |
ConfigParser.NoSectionError | |
ConfigParser.NoOptionError | |
IOError(errno.ENOTDIR) | if outputDir is not a directory |
IOError(errno.EACCESS) | if outputDir is not writable |
def ecohydroworkflowlib.nhdplus2.networkanalysis.getComIdForStreamGage | ( | conn, | |
reachcode, | |||
measure | |||
) |
Uses NHDFlowline and/or NHDReachCode_ComID table(s) to lookup the ComID associated with a stream gage identified by reach code and measure.
conn | An sqlite3 connection to a database that has the NHDFlowline and NHDReachCode_Comid tables |
reachcode | An string representing the Reachcode #param measure A float representing the measure along reach where Stream Gage is located in percent from downstream end of the one or more NHDFlowline features that are assigned to the ReachCode (see NHDPlusV21 GageLoc table) |
def ecohydroworkflowlib.nhdplus2.networkanalysis.getLocationForStreamGage | ( | config, | |
whereFilter | |||
) |
Get lat/lon, in WGS84 (EPSG:4326), from gage point layer (Gage_Loc) for gage identified by reachcode and measure.
config | A Python ConfigParser containing the following sections and options: 'NHDPLUS2', 'PATH_OF_NHDPLUS2_GAGELOC' (absolute path to NHD GageLoc SQLite3 spatial database) |
whereFilter | String representing the whereFilter to use |
@exception ConfigParser.NoSectionError @exception ConfigParser.NoOptionError @exception IOError(errno.ENOTDIR) if GageLoc is not readable
def ecohydroworkflowlib.nhdplus2.networkanalysis.getLocationForStreamGageByGageSourceFea | ( | config, | |
source_fea | |||
) |
Get lat/lon, in WGS84 (EPSG:4326), from gage point layer (Gage_Loc) for gage identified by a source_fea (e.g.
USGS Site Number)
config | A Python ConfigParser containing the following sections and options: 'NHDPLUS2', 'PATH_OF_NHDPLUS2_GAGELOC' (absolute path to NHD GageLoc SQLite3 spatial database) |
source_fea | String representing source_fea of GageLoc gage |
def ecohydroworkflowlib.nhdplus2.networkanalysis.getLocationForStreamGageByReachcodeAndMeasure | ( | config, | |
reachcode, | |||
measure | |||
) |
Get lat/lon, in WGS84 (EPSG:4326), from gage point layer (Gage_Loc) for gage identified by reachcode and measure.
config | A Python ConfigParser containing the following sections and options: 'NHDPLUS2', 'PATH_OF_NHDPLUS2_GAGELOC' (absolute path to NHD GageLoc SQLite3 spatial database) |
reachcode | String representing NHD streamflow gage |
measure | Float representing the measure along reach where Stream Gage is located in percent from downstream end of the one or more NHDFlowline features that are assigned to the ReachCode (see NHDPlusV21 GageLoc table) |
def ecohydroworkflowlib.nhdplus2.networkanalysis.getNHDReachcodeAndMeasureForGageSourceFea | ( | config, | |
source_fea | |||
) |
Get NHD Reachcode and measure along reach for a streamflow gage identified by a source_fea (e.g.
USGS Site Number)
config | A Python ConfigParser containing the following sections and options: 'NHDPLUS2', 'PATH_OF_NHDPLUS2_DB' (absolute path to NHDPlus2 SQLite3 database) |
source_fea | String representing source_fea of GageLoc gage |
@exception ConfigParser.NoSectionError @exception ConfigParser.NoOptionError @exception IOError(errno.EACCES) if NHDPlus2 DB is not readable
def ecohydroworkflowlib.nhdplus2.networkanalysis.getPlusFlowPredecessors | ( | conn, | |
comID | |||
) |
Get the immediate predecessors of the NHDPlus2 PlusFlow feature of comID.
conn | A connection an SQLite3 database |
comdID | String representing the ComID of the reach whose immediate predecessor reaches are to be discovered |
def ecohydroworkflowlib.nhdplus2.networkanalysis.getUpstreamReachesSQL | ( | conn, | |
comID, | |||
allUpstreamReaches | |||
) |
Recursively searches PlusFlow table in an SQLite database for all stream reaches upstream of a given reach.
conn | A connection to an SQLite3 database |
comID | The ComID of the reach whose upstream reaches are to be discovered |
allUpstreamReaches | A list containing integers representing comIDs of upstream reaches |
int ecohydroworkflowlib.nhdplus2.networkanalysis.EAST 90 |
int ecohydroworkflowlib.nhdplus2.networkanalysis.NORTH 0 |
string ecohydroworkflowlib.nhdplus2.networkanalysis.OGR_SHAPEFILE_DRIVER_NAME "ESRI Shapefile" |
int ecohydroworkflowlib.nhdplus2.networkanalysis.UPSTREAM_SEARCH_THRESHOLD 998 |