EcohydroLib  1.29
Functions | Variables
ecohydrolib.ssurgo.attributequery Namespace Reference

Make tabular queries against USDA Soil Data Mart SOAP web service interface. More...

Functions

def strListToString (strList)
 Converts a Python list of string values into a string containing quoted, comma separated representation of the list. More...
 
def computeWeightedAverageKsatClaySandSilt (soilAttrTuple)
 Computes weighted average for Ksat, clay/silt/sand for a SSURGO mukey based on values for each component in the mukey; weights based on component.comppct_r. More...
 
def joinSSURGOAttributesToFeaturesByMUKEY_GeoJSON (geojson, typeName, ssurgoAttributes)
 Join SSURGO tabular attributes to MapunitPoly or MapunitPolyExtended features based on MUKEY. More...
 
def getParentMatKsatTexturePercentClaySiltSandForComponentsInMUKEYs (mukeyList)
 Query USDA soil datamart tabular service for ksat, texture, % clay, % silt, % sand for all components in the specified map units. More...
 

Variables

int _BUFF_LEN = 4096
 
string ATTRIBUTE_NAMESPACE = 'ms'
 
list ATTRIBUTE_LIST
 
list ATTRIBUTE_LIST_NUMERIC
 
dictionary DERIVED_ATTRIBUTES = { 'drnWatCont': 'porosity - fieldCap' }
 

Detailed Description

Make tabular queries against USDA Soil Data Mart SOAP web service interface.

Note
Requires python-httplib2 to be installed, else requests to soil data mart may timeout

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.ssurgo.attributequery.computeWeightedAverageKsatClaySandSilt (   soilAttrTuple)

Computes weighted average for Ksat, clay/silt/sand for a SSURGO mukey based on values for each component in the mukey; weights based on component.comppct_r.

Parameters
soilAttrTupleTuple returned from getParentMatKsatTexturePercentClaySiltSandForComponentsInMUKEYs
Returns
Tuple containing: (1) a list containing column names; (2) a list of lists containing averaged soil properties for each mukey
def ecohydrolib.ssurgo.attributequery.getParentMatKsatTexturePercentClaySiltSandForComponentsInMUKEYs (   mukeyList)

Query USDA soil datamart tabular service for ksat, texture, % clay, % silt, % sand for all components in the specified map units.

Parameters
mukeyListList of strings representing the MUKEY of each map unit for which we would like to query attributes.
Returns
Tuple containing an ordered set (oset.oset) representing column names, and a list, each element containing a list of column values for each row in the SSURGO query result for each map unit

socket.error if there was an error reading the data from the web service Exception if webservice returned code other than 200

def ecohydrolib.ssurgo.attributequery.joinSSURGOAttributesToFeaturesByMUKEY_GeoJSON (   geojson,
  typeName,
  ssurgoAttributes 
)

Join SSURGO tabular attributes to MapunitPoly or MapunitPolyExtended features based on MUKEY.

Parameters
geojsonJSON object representing SSURGO MapunitPolyExtended or MapunitPoly features
typeNameString of either 'MapunitPoly' or 'MapunitPolyExtended'
ssurgoAttributesTuple containing two lists: (1) list of column names; (2) list of column values. Assumes the following column names and order: ['mukey', 'avgKsat', 'avgClay', 'avgSilt', 'avgSand', 'avgPorosity']
Note
geojson JSON object will be modified by this function
def ecohydrolib.ssurgo.attributequery.strListToString (   strList)

Converts a Python list of string values into a string containing quoted, comma separated representation of the list.

Parameters
strListList of strings
Returns
String containing quoted, comma separated representation of the list

Variable Documentation

int ecohydrolib.ssurgo.attributequery._BUFF_LEN = 4096
list ecohydrolib.ssurgo.attributequery.ATTRIBUTE_LIST
Initial value:
1 = ['ksat', 'pctClay', 'pctSilt', 'pctSand', 'porosity',
2  'pmgroupname', 'texture', 'tecdesc', 'fieldCap',
3  'avlWatCap']
list ecohydrolib.ssurgo.attributequery.ATTRIBUTE_LIST_NUMERIC
Initial value:
1 = ['ksat', 'pctClay', 'pctSilt', 'pctSand', 'porosity',
2  'fieldCap', 'avlWatCap']
string ecohydrolib.ssurgo.attributequery.ATTRIBUTE_NAMESPACE = 'ms'
dictionary ecohydrolib.ssurgo.attributequery.DERIVED_ATTRIBUTES = { 'drnWatCont': 'porosity - fieldCap' }