EcohydroWorkflowLib  0.973
 All Classes Namespaces Files Functions Variables Pages
Functions | Variables
ecohydroworkflowlib.ssurgo.attributequery Namespace Reference

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

Functions

def strListToString
 Converts a Python list of string values into a string containing quoted, comma separated representation of the list.
 
def computeWeightedAverageKsatClaySandSilt
 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.
 
def joinSSURGOAttributesToFeaturesByMUKEY
 Join SSURGO tabular attributes to MapunitPoly or MapunitPolyExtended features based on MUKEY.
 
def getParentMatKsatTexturePercentClaySiltSandForComponentsInMUKEYs
 Query USDA soil datamart tabular service for ksat, texture, % clay, % silt, % sand for all components in the specified map units.
 

Variables

list attributeList ['avgKsat', 'avgClay', 'avgSilt', 'avgSand', 'avgPorosity','pmgroupname','texture','tecdesc']
 
list attributeListNumeric ['avgKsat', 'avgClay', 'avgSilt', 'avgSand', 'avgPorosity']
 

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 ecohydroworkflowlib.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 ecohydroworkflowlib.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
def ecohydroworkflowlib.ssurgo.attributequery.joinSSURGOAttributesToFeaturesByMUKEY (   gmlFile,
  typeName,
  ssurgoAttributes 
)

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

Will write GML file and shapefile for features, and raster layers for each column vallue (see below).

Parameters
gmlFileA file handle associated with a SSURGO MapunitPoly or MapunitPolyExtended
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']
Returns
String representing the GML file with attributes joined
def ecohydroworkflowlib.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

list ecohydroworkflowlib.ssurgo.attributequery.attributeList ['avgKsat', 'avgClay', 'avgSilt', 'avgSand', 'avgPorosity','pmgroupname','texture','tecdesc']
list ecohydroworkflowlib.ssurgo.attributequery.attributeListNumeric ['avgKsat', 'avgClay', 'avgSilt', 'avgSand', 'avgPorosity']