<s> """<STR_LIT>""" <EOL> import os <EOL> import sys <EOL> import traceback <EOL> from ecohydrolib . command . base import Command <EOL> from ecohydrolib . command . exceptions import MetadataException <EOL> from ecohydrolib . command . exceptions import RunException <EOL> from ecohydrolib . metadata import GenericMetadata <EOL> from ecohydrolib . metadata import AssetProvenance <EOL> from ecohydrolib . spatialdata . utils import bboxFromString <EOL> from ecohydrolib . geosciaus import soilwcs <EOL> from ecohydrolib . geosciaus . soilwcs import getSoilsRasterDataForBoundingBox <EOL> class SoilGridAustralia ( Command ) : <EOL> def __init__ ( self , projectDir , configFile = None , outfp = sys . stdout ) : <EOL> """<STR_LIT>""" <EOL> super ( SoilGridAustralia , self ) . __init__ ( projectDir , configFile , outfp ) <EOL> def checkMetadata ( self ) : <EOL> """<STR_LIT>""" <EOL> super ( SoilGridAustralia , self ) . checkMetadata ( ) <EOL> if not '<STR_LIT>' in self . studyArea : <EOL> raise MetadataException ( "<STR_LIT>" % ( self . context . projectDir , ) ) <EOL> if not '<STR_LIT>' in self . studyArea : <EOL> raise MetadataException ( "<STR_LIT>" % ( self . context . projectDir , ) ) <EOL> if not '<STR_LIT>' in self . studyArea : <EOL> raise MetadataException ( "<STR_LIT>" % ( self . context . projectDir , ) ) <EOL> if not '<STR_LIT>' in self . studyArea : <EOL> raise MetadataException ( "<STR_LIT>" % ( self . context . projectDir , ) ) <EOL> def run ( self , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> verbose = kwargs . get ( '<STR_LIT>' , False ) <EOL> overwrite = kwargs . get ( '<STR_LIT>' , False ) <EOL> self . checkMetadata ( ) <EOL> bbox = bboxFromString ( self . studyArea [ '<STR_LIT>' ] ) <EOL> try : <EOL> rasters = getSoilsRasterDataForBoundingBox ( self . context . config , <EOL> self . context . projectDir , <EOL> bbox , <EOL> srs = self . studyArea [ '<STR_LIT>' ] , <EOL> resx = self . studyArea [ '<STR_LIT>' ] , <EOL> resy = self . studyArea [ '<STR_LIT>' ] , <EOL> overwrite = overwrite , <EOL> verbose = verbose , <EOL> outfp = self . outfp ) <EOL> except Exception as e : <EOL> traceback . print_exc ( file = self . outfp ) <EOL> raise RunException ( e ) <EOL> cmdline = GenericMetadata . getCommandLine ( ) <EOL> for attr in rasters . keys ( ) : <EOL> ( filepath , url ) = rasters [ attr ] <EOL> filename = os . path . basename ( filepath ) <EOL> asset = AssetProvenance ( GenericMetadata . MANIFEST_SECTION ) <EOL> asset . name = attr <EOL> asset . dcIdentifier = filename <EOL> asset . dcSource = url <EOL> asset . dcTitle = attr <EOL> asset . dcPublisher = soilwcs . DC_PUBLISHER <EOL> asset . dcDescription = cmdline <EOL> asset . writeToMetadata ( self . context ) <EOL> GenericMetadata . appendProcessingHistoryItem ( self . context , cmdline ) </s>
