EcohydroLib  1.29
Classes | Functions | Variables
ecohydrolib.nhdplus2.webservice Namespace Reference

Methods for querying the NHDPlus V2 data set via custom web service. More...

Classes

class  WebserviceError
 

Functions

def locateStreamflowGage (config, gageid)
 Query NHDPlus V2 web service for location information for streamflow gage listed in the NHDPlus V2 dataset. More...
 
def getCatchmentFeaturesForStreamflowGage
 Query NHDPlus V2 web service for features (in WGS 84) for the drainage area associated with a given NHD (National Hydrography Dataset) streamflow gage identified by a reach code and measure. More...
 

Variables

string _DEFAULT_CRS = 'EPSG:4326'
 
int _BUFF_LEN = 4096
 
string HOST = 'ga-dev-wssi.renci.org'
 
string URL_PROTO_GAGE_LOC = '/cgi-bin/LocateStreamflowGage?gageid={gageid}'
 
string URL_PROTO_CATCHMENT = '/cgi-bin/GetCatchmentFeaturesForStreamflowGage?reachcode={reachcode}&measure={measure}'
 
string CONTENT_TYPE = 'application/json'
 
string CONTENT_TYPE_ERROR = 'text/plain'
 
string RESPONSE_OK = 'OK'
 

Detailed Description

Methods for querying the NHDPlus V2 data set via custom web service.

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

Function Documentation

def ecohydrolib.nhdplus2.webservice.getCatchmentFeaturesForStreamflowGage (   config,
  outputDir,
  catchmentFilename,
  reachcode,
  measure,
  format = OGR_SHAPEFILE_DRIVER_NAME 
)

Query NHDPlus V2 web service for features (in WGS 84) for the drainage area associated with a given NHD (National Hydrography Dataset) streamflow gage identified by a reach code and measure.

Parameters
configA Python ConfigParser (not currently used)
outputDirString representing the absolute/relative path of the directory into which output rasters should be written
formatString representing OGR driver to use
catchmentFilenameString representing name of file to save catchment features to. The appropriate extension will be added to the file name
reachcodeString representing NHD streamflow gage
measureFloat 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)
Returns
Tuple(String representing the name of the dataset in outputDir created to hold the features, URL of the request)

IOError(errno.EACCESS) if OGR binary is not executable IOError(errno.ENOTDIR) if outputDir is not a directory IOError(errno.EACCESS) if outputDir is not writable Exception if output format is not known WebserviceError if an error occurred calling the web service

def ecohydrolib.nhdplus2.webservice.locateStreamflowGage (   config,
  gageid 
)

Query NHDPlus V2 web service for location information for streamflow gage listed in the NHDPlus V2 dataset.

Parameters
configA Python ConfigParser (not currently used)
gageidString representing streamflow gage ID (e.g. typically USGS site identifier)
Returns
Tuple(A dictionary with keys: message, measure, reachcode, gage_lon, gage_lat if location data were fetched or dictionary with key 'message' if not, URL of the request)

Variable Documentation

int ecohydrolib.nhdplus2.webservice._BUFF_LEN = 4096
string ecohydrolib.nhdplus2.webservice._DEFAULT_CRS = 'EPSG:4326'
string ecohydrolib.nhdplus2.webservice.CONTENT_TYPE = 'application/json'
string ecohydrolib.nhdplus2.webservice.CONTENT_TYPE_ERROR = 'text/plain'
string ecohydrolib.nhdplus2.webservice.HOST = 'ga-dev-wssi.renci.org'
string ecohydrolib.nhdplus2.webservice.RESPONSE_OK = 'OK'
string ecohydrolib.nhdplus2.webservice.URL_PROTO_CATCHMENT = '/cgi-bin/GetCatchmentFeaturesForStreamflowGage?reachcode={reachcode}&measure={measure}'
string ecohydrolib.nhdplus2.webservice.URL_PROTO_GAGE_LOC = '/cgi-bin/LocateStreamflowGage?gageid={gageid}'