Module Expr Str Import alias alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias Import alias Assign NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam NameParam defaults body Expr Str For NameStore Call AttributeLoad NameLoad attr body If CompareEq Call AttributeLoad NameLoad attr Str Num body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad Expr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str Str If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad AttributeLoad NameLoad attr BinOpMod Str NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Raise Call NameLoad AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Raise Call NameLoad AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad If CompareLtE NameLoad Num body Raise Call NameLoad Str Assign NameStore Call NameLoad NameLoad If CompareLtE NameLoad Num body Raise Call NameLoad Str orelse If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad AttributeLoad NameLoad attr BinOpMod Str NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad SubscriptLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Index Num attr Str attr If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse Raise Call NameLoad Str If CompareIsNot NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore Call AttributeLoad NameLoad attr If CompareEq Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Num body Assign NameStore Call AttributeLoad NameLoad attr If CompareNotEq NameLoad NameLoad body Assign NameStore BinOpMult SubscriptLoad NameLoad Index Num NameLoad Assign NameStore BinOpMult SubscriptLoad NameLoad Index Num NameLoad orelse Pass orelse Pass Assign NameStore BinOpDiv NameLoad NameLoad Assign NameStore BinOpDiv NameLoad NameLoad Assign NameStore SubscriptLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Index Num Assign NameStore Call NameLoad For NameStore NameLoad body Assign NameStore BinOpMod Str TupleLoad NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Assign NameStore BinOpMod Str TupleLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareNotEq NameLoad Num body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad Return NameLoad decorator_list
N/A N/A @package ecohydrolib.ssurgo.rasterize
    
@brief Rasterize SSURGO features

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:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of the University of North Carolina at Chapel Hill nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

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_miles@unc.edu>
 N/A os.path errno N/A osr ecohydrolib.spatialdata.utils deleteGeoTiff ecohydrolib.spatialdata.utils getSpatialReferenceForRaster ecohydrolib.spatialdata.utils getMeterConversionFactorForLinearUnitOfShapefile ecohydrolib.spatialdata.utils getMeterConversionFactorForLinearUnitOfGMLfile N/A attributequery N/A RASTER_ATTRIBUTES N/A attributequery ATTRIBUTE_LIST_NUMERIC N/A N/A N/A RASTER_ATTRIBUTES append brockdepmin deleteSoilRasters N/A N/A context manifest N/A N/A N/A  Delete soil raster maps stored in a project
    
        @param context Context object containing projectDir, the path of the project whose 
        metadata store is to be read from
        @param manifest Dict containing manifest entries.  Files associted with entries
        whose key begins with 'soil_raster_' will be deleted
     N/A entry N/A N/A manifest keys N/A N/A N/A N/A N/A entry find soil_raster_ 0 N/A N/A filePath N/A N/A N/A os path join N/A context projectDir N/A manifest N/A entry N/A N/A deleteGeoTiff filePath N/A rasterizeSSURGOFeatures N/A N/A config outputDir featureFilename featureLayername featureAttrList getResolutionFromRasterFileNamed rasterResolutionX rasterResolutionY N/A None None None N/A N/A  Create raster maps, in GeoTIFF format, for SSURGO attributes associated with SSURGO MapunitPoly/MapunitPolyExtended features
        
        @note Will silently exit if rasters already exist.
        @note If getResolutionFromRasterFileNamed as well as rasterResolutionX and rasterResolutionY are specified,
        output raster resolution will be determined from the file named by getResolutionFromRasterFileNamed. 
        
        @param config onfigParser containing the section 'GDAL/OGR' and option 'PATH_OF_GDAL_RASTERIZE'
        @param outputDir String representing the absolute/relative path of the directory into which output rasters should be written
        @param featureFilename String representing the absolute/relative path of the input feature in ESRI shapefile or OGC GML format
        @param featureLayername String representing the name of feature layer whose features are to be rasterize
        @param featureAttrList List containing the SSURGO attributes for which raster maps are to be created
        @param getResolutionFromRasterFileNamed String representing the absolute path of an existing raster file from which the
            output raster resolution should be determined
        @param rasterResolutionX Float representing the X resolution of the output rasters
        @param rasterResolutionY Float representing the Y resolution of the output rasters
        
        @return Dictionary containing the keys for each soil attribute and values of the names of the raster files generated for that attribute
        
        @exception ConfigParser.NoSectionError
        @exception ConfigParser.NoOptionError
        @exception Exception if featureFilename is neither a SHP nor a GML file
        @exception IOError(errno.ENOTDIR) if outputDir is not a directory
        @exception IOError(errno.EACCESS) if outputDir is not writable
        @exception IOError(errno.EACCESS) if featureFilename is not readable
        @exception IOError(errno.ENOENT) if featureFilename is not a file
        @exception IOError(errno.EACCES) if getResolutionFromRasterFileNamed is not readable
        @exception ValueError if rasterResolutionX or rasterResolutionY are not floating point numbers greater than 0
        @exception Exception if a gdal_rasterize command fails
     N/A gdalCmdPath N/A N/A config get GDAL/OGR PATH_OF_GDAL_RASTERIZE N/A N/A N/A N/A os access gdalCmdPath N/A os X_OK N/A N/A N/A IOError N/A errno EACCES N/A The gdal_rasterize binary at %s is not executable gdalCmdPath N/A gdalCmdPath N/A N/A N/A os path abspath gdalCmdPath N/A N/A N/A N/A N/A os path isdir outputDir N/A N/A N/A IOError N/A errno ENOTDIR N/A Output directory %s is not a directory N/A outputDir N/A N/A N/A N/A os access outputDir N/A os W_OK N/A N/A N/A IOError N/A errno EACCES N/A Not allowed to write to output directory %s N/A outputDir N/A outputDir N/A N/A N/A os path abspath outputDir N/A featureFilepath N/A N/A N/A os path join outputDir featureFilename N/A N/A N/A N/A os access featureFilepath N/A os R_OK N/A N/A N/A IOError N/A errno EACCES N/A Not allowed to read feature file %s N/A featureFilepath N/A N/A N/A N/A N/A os path isfile featureFilepath N/A N/A N/A IOError N/A errno ENOENT N/A Feature file %s does not exist N/A featureFilepath N/A N/A getResolutionFromRasterFileNamed None N/A N/A rasterResolutionX N/A float rasterResolutionX N/A N/A rasterResolutionX 0.0 N/A N/A N/A ValueError rasterResolutionX must be > 0.0 N/A rasterResolutionY N/A float rasterResolutionY N/A N/A rasterResolutionY 0.0 N/A N/A N/A ValueError rasterResolutionY must be > 0.0 N/A N/A N/A N/A N/A os access getResolutionFromRasterFileNamed N/A os R_OK N/A N/A N/A IOError N/A errno EACCES N/A Not allowed to read existing raster file %s from which to get resolution getResolutionFromRasterFileNamed N/A featureType N/A N/A N/A N/A N/A N/A N/A N/A os path splitext featureFilepath N/A 1 lstrip . upper N/A N/A featureType GML N/A N/A soilMeterConvFactor N/A getMeterConversionFactorForLinearUnitOfGMLfile featureFilepath N/A N/A N/A featureType SHP N/A N/A soilMeterConvFactor N/A getMeterConversionFactorForLinearUnitOfShapefile featureFilepath N/A N/A N/A Exception Argument featureFilename must be either a GML or SHP file N/A N/A getResolutionFromRasterFileNamed None N/A N/A demPixelSizeAndUnits N/A getSpatialReferenceForRaster getResolutionFromRasterFileNamed N/A rasterResolutionX N/A demPixelSizeAndUnits N/A 0 N/A rasterResolutionY N/A demPixelSizeAndUnits N/A 1 N/A demSrs N/A N/A osr SpatialReference N/A N/A N/A N/A demSrs ImportFromWkt N/A demPixelSizeAndUnits N/A 4 0 N/A N/A demMeterConvFactor N/A N/A demSrs GetLinearUnits N/A N/A soilMeterConvFactor demMeterConvFactor N/A N/A rasterResolutionX N/A N/A demPixelSizeAndUnits N/A 0 demMeterConvFactor N/A rasterResolutionY N/A N/A demPixelSizeAndUnits N/A 1 demMeterConvFactor N/A N/A N/A N/A N/A rasterResolutionX N/A rasterResolutionX soilMeterConvFactor N/A rasterResolutionY N/A rasterResolutionY soilMeterConvFactor N/A rasterFilenameProto N/A N/A N/A N/A os path splitext featureFilename N/A 0 N/A filesCreated N/A dict N/A attr featureAttrList N/A N/A rasterFilename N/A %s_%s.tif N/A rasterFilenameProto attr N/A N/A filesCreated N/A attr rasterFilename N/A rasterFilepath N/A N/A N/A os path join outputDir rasterFilename N/A N/A N/A N/A N/A os path exists rasterFilepath N/A N/A gdalCommand N/A %s -q -of GTiff -co 'COMPRESS=LZW' -tr %d %d -a_nodata -9999 -a %s -l %s %s %s N/A gdalCmdPath rasterResolutionX rasterResolutionY attr featureLayername featureFilepath rasterFilepath N/A returnCode N/A N/A os system gdalCommand N/A N/A returnCode 0 N/A N/A N/A Exception N/A GDAL command %s failed.  Check spatial reference system of input vector dataset (geographic coordinate systems may not work). N/A gdalCommand N/A filesCreated N/A