EcohydroWorkflowLib  0.973
 All Classes Namespaces Files Functions Variables Pages
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 config ConfigParser.RawConfigParser()
 
 projectDir args.projectDir
 
 outfile args.outfile
 
list gageProvenance [i for i in GenericMetadata.readAssetProvenanceObjects(projectDir) if i.name == 'gage']
 
tuple studyArea GenericMetadata.readStudyAreaEntries(projectDir)
 
list reachcode studyArea['nhd_gage_reachcode']
 
list measure studyArea['nhd_gage_measure_pct']
 
string shapeFilename "%s.shp"
 
tuple shapeFilepath os.path.join(projectDir, shapeFilename)
 
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'
  1. 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
EcoHydroWorkflowLib 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()
tuple GetCatchmentShapefileForNHDStreamflowGage.config ConfigParser.RawConfigParser()
list GetCatchmentShapefileForNHDStreamflowGage.configFile None
list GetCatchmentShapefileForNHDStreamflowGage.gageProvenance [i for i in GenericMetadata.readAssetProvenanceObjects(projectDir) 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')
tuple GetCatchmentShapefileForNHDStreamflowGage.projectDir args.projectDir
list GetCatchmentShapefileForNHDStreamflowGage.reachcode studyArea['nhd_gage_reachcode']
string GetCatchmentShapefileForNHDStreamflowGage.shapeFilename "%s.shp"
tuple GetCatchmentShapefileForNHDStreamflowGage.shapeFilepath os.path.join(projectDir, shapeFilename)
tuple GetCatchmentShapefileForNHDStreamflowGage.studyArea GenericMetadata.readStudyAreaEntries(projectDir)