RHESSysWorkflows  1.33
Variables
GeneratePatchMap Namespace Reference

Generate patch map in the GRASS location associated with the project directory. More...

Variables

string PATCH_RAST = 'patch'
 
tuple parser = argparse.ArgumentParser(description='Generate patch maps or in GRASS location associated with the project directory.')
 
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 studyArea = RHESSysMetadata.readStudyAreaEntries(context)
 
tuple grassMetadata = RHESSysMetadata.readGRASSEntries(context)
 
tuple metadata = RHESSysMetadata.readRHESSysEntries(context)
 
tuple modulePath = context.config.get('GRASS', 'MODULE_PATH')
 
tuple grassDbase = os.path.join(context.projectDir, metadata['grass_dbase'])
 
tuple grassConfig = GRASSConfig(context, grassDbase, metadata['grass_location'], metadata['grass_mapset'])
 
tuple grassLib = GRASSLib(grassConfig=grassConfig)
 
list demRast = grassMetadata['dem_rast']
 
tuple result = grassLib.script.run_command('g.region', rast=demRast)
 
list basinRast = grassMetadata['basin_rast']
 
tuple demCols = int(studyArea['dem_columns'])
 
list clumpMap = grassMetadata['wetness_index_rast']
 

Detailed Description

Generate patch map in the GRASS location associated with the project directory.

Note
Will set the zone map to be the patch map if no zone map exists

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'
  2. The following metadata entry(ies) must be present in the study area section of the metadata associated with the project directory: dem_columns (if patch type is grid)
  3. The following metadata entry(ies) must be present in the GRASS section of the metadata associated with the project directory: basin_rast dem_rast wetness_index_rast [if clump map wetness_index is selected]
  4. The following metadata entry(ies) must be present in the RHESSys section of the metadata associated with the project directory: grass_dbase grass_location grass_mapset

Post conditions

  1. Will write the following entry(ies) to the GRASS section of metadata associated with the project directory: patch_rast

Usage:

1 GeneratePatchMap.py -p /path/to/project_dir
Note
EcoHydroWorkflowLib configuration file must be specified by environmental variable 'ECOHYDROWORKFLOW_CFG', or -i option must be specified.

Variable Documentation

tuple GeneratePatchMap.args = parser.parse_args()
list GeneratePatchMap.basinRast = grassMetadata['basin_rast']
list GeneratePatchMap.clumpMap = grassMetadata['wetness_index_rast']
tuple GeneratePatchMap.cmdline = RHESSysMetadata.getCommandLine()
GeneratePatchMap.configFile = None
tuple GeneratePatchMap.context = Context(args.projectDir, configFile)
tuple GeneratePatchMap.demCols = int(studyArea['dem_columns'])
list GeneratePatchMap.demRast = grassMetadata['dem_rast']
tuple GeneratePatchMap.grassConfig = GRASSConfig(context, grassDbase, metadata['grass_location'], metadata['grass_mapset'])
tuple GeneratePatchMap.grassDbase = os.path.join(context.projectDir, metadata['grass_dbase'])
tuple GeneratePatchMap.grassLib = GRASSLib(grassConfig=grassConfig)
tuple GeneratePatchMap.grassMetadata = RHESSysMetadata.readGRASSEntries(context)
string GeneratePatchMap.help = 'The configuration file. Must define section "GRASS" and option "GISBASE"'
tuple GeneratePatchMap.metadata = RHESSysMetadata.readRHESSysEntries(context)
tuple GeneratePatchMap.modulePath = context.config.get('GRASS', 'MODULE_PATH')
tuple GeneratePatchMap.parser = argparse.ArgumentParser(description='Generate patch maps or in GRASS location associated with the project directory.')
string GeneratePatchMap.PATCH_RAST = 'patch'
tuple GeneratePatchMap.result = grassLib.script.run_command('g.region', rast=demRast)
tuple GeneratePatchMap.studyArea = RHESSysMetadata.readStudyAreaEntries(context)