RHESSysWorkflows  1.33
Variables
CreateGRASSLocationFromDEM Namespace Reference

Import DEM into new GRASS GIS location. More...

Variables

tuple parser = argparse.ArgumentParser(description='Import spatial data needed to create RHESSys worldfile into the PERMANENT mapset of a new GRASS location')
 
string help = 'The configuration file. Must define section "GRASS" and option "GISBASE"'
 
tuple args = parser.parse_args()
 
tuple cmdline = RHESSysMetadata.getCommandLine()
 
 configFile = None
 
tuple context = Context(args.projectDir, configFile)
 
tuple paths = RHESSysPaths(args.projectDir)
 
string dbase = 'GRASSData'
 
tuple grassDbase = os.path.join(context.projectDir, dbase)
 
 location = None
 
 mapset = None
 
tuple manifest = RHESSysMetadata.readManifestEntries(context)
 
tuple studyArea = RHESSysMetadata.readStudyAreaEntries(context)
 
tuple srsPattern = re.compile('EPSG:(\d+)')
 
tuple result = srsPattern.search(studyArea['dem_srs'])
 
tuple srs = int(result.group(1))
 
tuple grassConfig = GRASSConfig(context, grassDbase, location, mapset, newLocation=True, overwrite=args.overwrite)
 
tuple grassLib = GRASSLib(grassConfig=grassConfig)
 
tuple demFilepath = os.path.join(context.projectDir, manifest['dem'])
 

Detailed Description

Import DEM into new GRASS GIS location.

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

Pre conditions

  1. Configuration file must define the following sections and values: 'GRASS', 'GISBASE' 'GRASS', 'MODULE_PATH'
  2. The following metadata entry(ies) must be present in the manifest section of the metadata associated with the project directory: dem
  3. The following metadata entry(ies) must be present in the study area section of the metadata associated with the project directory: dem_srs

Post conditions

  1. Will write the following entry(ies) to the RHESSys section of metadata associated with the project directory: grass_dbase grass_location grass_mapset rhessys_dir model_description
  2. GRASS location and mapset will be created in grass_dbase
  3. Will write the following entry(ies) to the GRASS section of metadata associated with the project directory: dem_rast

Usage:

1 CreateGRASSLocationFromDEM.py -p /path/to/project_dir -script GRASSData -l default -m "Grass location for RHESSys model of Dead Run watershed in Baltimore, MD"
Note
EcoHydroWorkflowLib configuration file must be specified by environmental variable 'ECOHYDROWORKFLOW_CFG', or -i option must be specified.

Variable Documentation

tuple CreateGRASSLocationFromDEM.args = parser.parse_args()
tuple CreateGRASSLocationFromDEM.cmdline = RHESSysMetadata.getCommandLine()
CreateGRASSLocationFromDEM.configFile = None
tuple CreateGRASSLocationFromDEM.context = Context(args.projectDir, configFile)
string CreateGRASSLocationFromDEM.dbase = 'GRASSData'
tuple CreateGRASSLocationFromDEM.demFilepath = os.path.join(context.projectDir, manifest['dem'])
tuple CreateGRASSLocationFromDEM.grassConfig = GRASSConfig(context, grassDbase, location, mapset, newLocation=True, overwrite=args.overwrite)
tuple CreateGRASSLocationFromDEM.grassDbase = os.path.join(context.projectDir, dbase)
tuple CreateGRASSLocationFromDEM.grassLib = GRASSLib(grassConfig=grassConfig)
string CreateGRASSLocationFromDEM.help = 'The configuration file. Must define section "GRASS" and option "GISBASE"'
CreateGRASSLocationFromDEM.location = None
tuple CreateGRASSLocationFromDEM.manifest = RHESSysMetadata.readManifestEntries(context)
CreateGRASSLocationFromDEM.mapset = None
tuple CreateGRASSLocationFromDEM.parser = argparse.ArgumentParser(description='Import spatial data needed to create RHESSys worldfile into the PERMANENT mapset of a new GRASS location')
tuple CreateGRASSLocationFromDEM.paths = RHESSysPaths(args.projectDir)
tuple CreateGRASSLocationFromDEM.result = srsPattern.search(studyArea['dem_srs'])
tuple CreateGRASSLocationFromDEM.srs = int(result.group(1))
tuple CreateGRASSLocationFromDEM.srsPattern = re.compile('EPSG:(\d+)')
tuple CreateGRASSLocationFromDEM.studyArea = RHESSysMetadata.readStudyAreaEntries(context)