RHESSysWorkflows  1.33
Variables
ImportClimateData Namespace Reference

Import climate station and corrsponding data, already in RHESSys format, into project directory. More...

Variables

string STATION_FILE_EXTENSION = 'base'
 
tuple parser = argparse.ArgumentParser(description='Import RHESSys climate data into 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 metadata = RHESSysMetadata.readRHESSysEntries(context)
 
tuple paths = RHESSysPaths(args.projectDir, metadata['rhessys_dir'])
 
tuple contents = os.listdir(paths.RHESSYS_CLIM)
 
tuple fileToDelete = os.path.join(paths.RHESSYS_CLIM, entry)
 
tuple stationRegex = re.compile("^(.+)\.%s$" % (STATION_FILE_EXTENSION,) )
 
list stations = []
 
tuple m = stationRegex.match(entry)
 
string stationFileName = "%s%s%s"
 
tuple stationFilePath = os.path.join(args.sourceDir, stationFileName)
 
tuple dataRegex = re.compile("^%s\.(.+)$" % (station,) )
 
tuple extension = m.group(1)
 

Detailed Description

Import climate station and corrsponding data, already in RHESSys format, into project directory.

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. The following metadata entry(ies) must be present in the RHESSys section of the metadata associated with the project directory: rhessys_dir

Post conditions

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

Usage:

1 ImportClimateData.py -p /path/to/project_dir -s /path/to/existing/rhessys/climate/data

Variable Documentation

tuple ImportClimateData.args = parser.parse_args()
tuple ImportClimateData.cmdline = RHESSysMetadata.getCommandLine()
ImportClimateData.configFile = None
tuple ImportClimateData.contents = os.listdir(paths.RHESSYS_CLIM)
tuple ImportClimateData.context = Context(args.projectDir, configFile)
tuple ImportClimateData.dataRegex = re.compile("^%s\.(.+)$" % (station,) )
tuple ImportClimateData.extension = m.group(1)
tuple ImportClimateData.fileToDelete = os.path.join(paths.RHESSYS_CLIM, entry)
string ImportClimateData.help = 'The configuration file. Must define section "GRASS" and option "GISBASE"'
tuple ImportClimateData.m = stationRegex.match(entry)
tuple ImportClimateData.metadata = RHESSysMetadata.readRHESSysEntries(context)
tuple ImportClimateData.parser = argparse.ArgumentParser(description='Import RHESSys climate data into project directory')
tuple ImportClimateData.paths = RHESSysPaths(args.projectDir, metadata['rhessys_dir'])
string ImportClimateData.STATION_FILE_EXTENSION = 'base'
string ImportClimateData.stationFileName = "%s%s%s"
tuple ImportClimateData.stationFilePath = os.path.join(args.sourceDir, stationFileName)
tuple ImportClimateData.stationRegex = re.compile("^(.+)\.%s$" % (STATION_FILE_EXTENSION,) )
list ImportClimateData.stations = []