RHESSysWorkflows  1.33
Variables
GenerateBaseStationMap Namespace Reference

Generate climate base station raster map in GRASS for a list of base stations using Thiessen polygons. More...

Variables

tuple parser = argparse.ArgumentParser(description='Generate climate base station raster map in GRASS for a list of base stations using Thiessen polygons.')
 
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 metadata = RHESSysMetadata.readRHESSysEntries(context)
 
tuple paths = RHESSysPaths(args.projectDir, metadata['rhessys_dir'])
 
 projectDirClimDir = paths.RHESSYS_CLIM
 
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)
 
tuple basestationsDest = os.path.join(projectDirClimDir, 'basestations.txt')
 
tuple p
 
 result = p.returncode
 

Detailed Description

Generate climate base station raster map in GRASS for a list of base stations using Thiessen polygons.

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 RHESSys section of the metadata associated with the project directory: grass_dbase grass_location grass_mapset rhessys_dir

Post conditions

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

Usage:

1 GenerateBaseStationMap.py -p /path/to/project_dir -b /path/to/base/station/file
Note
GRASS v.voronoi routine used to generate Thiessen polygons has difficulties when there are only two points. This may be fixed in GRASS 6.4.3. Until then, do not use two climate stations.
EcoHydroWorkflowLib configuration file must be specified by environmental variable 'ECOHYDROWORKFLOW_CFG', or -i option must be specified.

Variable Documentation

tuple GenerateBaseStationMap.args = parser.parse_args()
tuple GenerateBaseStationMap.basestationsDest = os.path.join(projectDirClimDir, 'basestations.txt')
tuple GenerateBaseStationMap.cmdline = RHESSysMetadata.getCommandLine()
GenerateBaseStationMap.configFile = None
tuple GenerateBaseStationMap.context = Context(args.projectDir, configFile)
tuple GenerateBaseStationMap.grassConfig = GRASSConfig(context, grassDbase, metadata['grass_location'], metadata['grass_mapset'])
tuple GenerateBaseStationMap.grassDbase = os.path.join(context.projectDir, metadata['grass_dbase'])
tuple GenerateBaseStationMap.grassLib = GRASSLib(grassConfig=grassConfig)
string GenerateBaseStationMap.help = 'The configuration file. Must define section "GRASS" and option "GISBASE"'
tuple GenerateBaseStationMap.metadata = RHESSysMetadata.readRHESSysEntries(context)
tuple GenerateBaseStationMap.modulePath = context.config.get('GRASS', 'MODULE_PATH')
tuple GenerateBaseStationMap.p
Initial value:
1 = grassLib.script.pipe_command('v.in.ascii', input=basestationsDest, out='basestation_points', x=2, y=3, cat=1,
2  columns='cat int, x double precision, y double precision, name varchar(15)',
3  overwrite=args.overwrite)
tuple GenerateBaseStationMap.parser = argparse.ArgumentParser(description='Generate climate base station raster map in GRASS for a list of base stations using Thiessen polygons.')
tuple GenerateBaseStationMap.paths = RHESSysPaths(args.projectDir, metadata['rhessys_dir'])
GenerateBaseStationMap.projectDirClimDir = paths.RHESSYS_CLIM
GenerateBaseStationMap.result = p.returncode