EcohydroLib  1.29
Variables
GetCatchmentShapefileForNHDStreamflowGage Namespace Reference

Query NHDPlus2 database for shapefile of the drainage area of the given streamflow gage. More...

Variables

tuple parser = argparse.ArgumentParser(description='Get shapefile for the drainage area of an NHDPlus2 streamflow gage')
 
string help = 'The configuration file'
 
tuple args = parser.parse_args()
 
tuple cmdline = GenericMetadata.getCommandLine()
 
 configFile = None
 
tuple context = Context(args.projectDir, configFile)
 
 outfile = args.outfile
 
string tmpFilename = "%s%s%s"
 
tuple shapeFilepath = os.path.join(context.projectDir, tmpFilename)
 
list gageProvenance = [i for i in GenericMetadata.readAssetProvenanceObjects(context) if i.name == 'gage']
 
tuple studyArea = GenericMetadata.readStudyAreaEntries(context)
 
list reachcode = studyArea['nhd_gage_reachcode']
 
list measure = studyArea['nhd_gage_measure_pct']
 
 writeMetadata = False
 
tuple shapeFilename
 
string source = 'http://www.horizon-systems.com/NHDPlus/NHDPlusV2_home.php'
 
 format = OGR_SHAPEFILE_DRIVER_NAME)
 
tuple asset = AssetProvenance(GenericMetadata.MANIFEST_SECTION)
 

Detailed Description

Query NHDPlus2 database for shapefile of the drainage area of the given streamflow gage.

Resulting shapefile will use WGS84 (EPSG:4326) for its spatial reference.

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.

Author
Brian Miles brian.nosp@m._mil.nosp@m.es@un.nosp@m.c.ed.nosp@m.u

Pre conditions

  1. Configuration file must define the following sections and values: 'NHDPLUS2', 'PATH_OF_NHDPLUS2_DB' 'NHDPLUS2', 'PATH_OF_NHDPLUS2_CATCHMENT'
  2. The following metadata entry(ies) must be present in the study area section of the metadata associated with the project directory: nhd_gage_reachcode nhd_gage_measure_pct

Post conditions

  1. Will write the following entry(ies) to the manifest section of metadata associated with the project directory: study_area_shapefile [the name of the catchment shapefile]

Usage:

1 GetCatchmentShapefileForNHDStreamflowGage.py -p /path/to/project_dir
Note
EcohydroLib configuration file must be specified by environmental variable 'ECOHYDROWORKFLOW_CFG', or -i option must be specified.

Variable Documentation

tuple GetCatchmentShapefileForNHDStreamflowGage.args = parser.parse_args()
tuple GetCatchmentShapefileForNHDStreamflowGage.asset = AssetProvenance(GenericMetadata.MANIFEST_SECTION)
tuple GetCatchmentShapefileForNHDStreamflowGage.cmdline = GenericMetadata.getCommandLine()
GetCatchmentShapefileForNHDStreamflowGage.configFile = None
tuple GetCatchmentShapefileForNHDStreamflowGage.context = Context(args.projectDir, configFile)
GetCatchmentShapefileForNHDStreamflowGage.format = OGR_SHAPEFILE_DRIVER_NAME)
list GetCatchmentShapefileForNHDStreamflowGage.gageProvenance = [i for i in GenericMetadata.readAssetProvenanceObjects(context) if i.name == 'gage']
string GetCatchmentShapefileForNHDStreamflowGage.help = 'The configuration file'
list GetCatchmentShapefileForNHDStreamflowGage.measure = studyArea['nhd_gage_measure_pct']
string GetCatchmentShapefileForNHDStreamflowGage.outfile = args.outfile
tuple GetCatchmentShapefileForNHDStreamflowGage.parser = argparse.ArgumentParser(description='Get shapefile for the drainage area of an NHDPlus2 streamflow gage')
list GetCatchmentShapefileForNHDStreamflowGage.reachcode = studyArea['nhd_gage_reachcode']
tuple GetCatchmentShapefileForNHDStreamflowGage.shapeFilename
Initial value:
1 = getCatchmentFeaturesForGage(context.config, context.projectDir, outfile,
2  reachcode, measure,
3  format=OGR_SHAPEFILE_DRIVER_NAME)
def getCatchmentFeaturesForGage
Get features (in WGS 84) for the drainage area associated with a given NHD (National Hydrography Data...
Definition: networkanalysis.py:710
tuple GetCatchmentShapefileForNHDStreamflowGage.shapeFilepath = os.path.join(context.projectDir, tmpFilename)
string GetCatchmentShapefileForNHDStreamflowGage.source = 'http://www.horizon-systems.com/NHDPlus/NHDPlusV2_home.php'
tuple GetCatchmentShapefileForNHDStreamflowGage.studyArea = GenericMetadata.readStudyAreaEntries(context)
string GetCatchmentShapefileForNHDStreamflowGage.tmpFilename = "%s%s%s"
GetCatchmentShapefileForNHDStreamflowGage.writeMetadata = False