RHESSysWorkflows  1.33
Namespaces | Variables
GenerateWorldTemplate.py File Reference

Namespaces

 GenerateWorldTemplate
 
 CreateWorldfile
 Create RHESSys worldfile.
 

Variables

tuple GenerateWorldTemplate.parser = argparse.ArgumentParser(description='Create RHESSys world template used to create initial world file')
 
string GenerateWorldTemplate.help = 'The configuration file. Must define section "GRASS" and option "GISBASE"'
 
tuple GenerateWorldTemplate.args = parser.parse_args()
 
tuple GenerateWorldTemplate.cmdline = RHESSysMetadata.getCommandLine()
 
 GenerateWorldTemplate.configFile = None
 
tuple GenerateWorldTemplate.context = Context(args.projectDir, configFile)
 
tuple GenerateWorldTemplate.studyArea = RHESSysMetadata.readStudyAreaEntries(context)
 
tuple GenerateWorldTemplate.grassMetadata = RHESSysMetadata.readGRASSEntries(context)
 
tuple GenerateWorldTemplate.metadata = RHESSysMetadata.readRHESSysEntries(context)
 
list GenerateWorldTemplate.climateStations = metadata['climate_stations']
 
list GenerateWorldTemplate.rhessysDir = metadata['rhessys_dir']
 
tuple GenerateWorldTemplate.paths = RHESSysPaths(args.projectDir, rhessysDir)
 
tuple GenerateWorldTemplate.paramDbPath = os.path.join(context.projectDir, metadata['paramdb'])
 
tuple GenerateWorldTemplate.params = importlib.import_module('rhessys.params')
 
tuple GenerateWorldTemplate.paramConst = importlib.import_module('rhessys.constants')
 
tuple GenerateWorldTemplate.paramDB = params.paramDB(filename=paramDbPath)
 
tuple GenerateWorldTemplate.modulePath = context.config.get('GRASS', 'MODULE_PATH')
 
tuple GenerateWorldTemplate.grassDbase = os.path.join(context.projectDir, metadata['grass_dbase'])
 
tuple GenerateWorldTemplate.grassConfig = GRASSConfig(context, grassDbase, metadata['grass_location'], metadata['grass_mapset'])
 
tuple GenerateWorldTemplate.grassLib = GRASSLib(grassConfig=grassConfig)
 
list GenerateWorldTemplate.demRast = grassMetadata['dem_rast']
 
tuple GenerateWorldTemplate.result = grassLib.script.run_command('g.region', rast=demRast)
 
string GenerateWorldTemplate.dem1000Rast = "%s_1000"
 
list GenerateWorldTemplate.basinRast = grassMetadata['basin_rast']
 
tuple GenerateWorldTemplate.bbox = bboxFromString(studyArea['bbox_wgs84'])
 
tuple GenerateWorldTemplate.paramsFound
 
dictionary GenerateWorldTemplate.defFiles = {}
 
tuple GenerateWorldTemplate.contents = os.listdir(paths.RHESSYS_DEF)
 
tuple GenerateWorldTemplate.typeRe = re.compile("^%s_.+\.def$" % (type,) )
 
list GenerateWorldTemplate.defs = defFiles[type]
 
tuple GenerateWorldTemplate.m = typeRe.match(entry)
 
tuple GenerateWorldTemplate.templateTemplatePath = os.path.join(context.projectDir, metadata['template_template'])
 
tuple GenerateWorldTemplate.templateTemplateFile = open(templateTemplatePath)
 
tuple GenerateWorldTemplate.templateTemplate = string.Template(templateTemplateFile.read())
 
dictionary GenerateWorldTemplate.subs = {}
 
tuple GenerateWorldTemplate.numDefin = len(defs)
 
string GenerateWorldTemplate.numDefinKey = "num_%s_defs"
 
tuple GenerateWorldTemplate.defStr = os.path.join(paths._DEF, defs[0])
 
string GenerateWorldTemplate.defStrKey = "%s_defs"
 
string GenerateWorldTemplate.climParamFilename = "%s.base"
 
tuple GenerateWorldTemplate.baseFile = os.path.join(paths._CLIM, climParamFilename)
 
tuple GenerateWorldTemplate.climParams = readParameterFile( os.path.join(paths.RHESSYS_CLIM, climParamFilename) )
 
string GenerateWorldTemplate.climateStationIDStr = "base_station_ID\tdvalue %s"
 
tuple GenerateWorldTemplate.rasterIds = oset()
 
tuple GenerateWorldTemplate.pipe = grassLib.script.pipe_command('r.stats', flags='licn', input=grassMetadata['basestations_rast'])
 
tuple GenerateWorldTemplate.values = line.strip()
 
tuple GenerateWorldTemplate.baseIds = oset()
 
dictionary GenerateWorldTemplate.baseFiles = {}
 
tuple GenerateWorldTemplate.id = int(climParams['base_station_id'])
 
 GenerateWorldTemplate.includedBaseIds = rasterIds&baseIds
 
list GenerateWorldTemplate.climateStationsStr = baseFiles[includedBaseIds[0]]
 
list GenerateWorldTemplate.isohyet = grassMetadata['isohyet_rast']
 
string GenerateWorldTemplate.isohyet100 = isohyet+'100'
 
string GenerateWorldTemplate.templateStr = ''
 
tuple GenerateWorldTemplate.templateFilename = os.path.splitext( os.path.split( metadata['template_template'] )[1] )
 
tuple GenerateWorldTemplate.templateFilepath = os.path.join(paths.RHESSYS_TEMPLATES, templateFilename)
 
tuple GenerateWorldTemplate.f = open(templateFilepath, 'w')