RHESSysWorkflows  1.33
Namespaces | Variables
PatchToMap.py File Reference

Namespaces

 PatchToMap
 Tool for mapping patch-scale RHESSys yearly output variables.
 

Variables

int PatchToMap.INT_RESCALE = 100
 
tuple PatchToMap.VARIABLE_EXPR_RE = re.compile(r'\b([a-zA-z][a-zA-Z0-9_\.]+)\b')
 
tuple PatchToMap.RANDOM = random.randint(100000, 999999)
 
string PatchToMap.RECLASS_MAP_TMP = "patchzonalstats_cover_{0}"
 
string PatchToMap.STATS_MAP_TMP = "patchzonalstats_output_{0}"
 
list PatchToMap.methods
 
tuple PatchToMap.parser = argparse.ArgumentParser(description='Generate cummulative map of patch-scale RHESSys output variables')
 
string PatchToMap.help = 'The configuration file.'
 
tuple PatchToMap.args = parser.parse_args()
 
 PatchToMap.configFile = None
 
tuple PatchToMap.context = Context(args.projectDir, configFile)
 
tuple PatchToMap.metadata = RHESSysMetadata.readRHESSysEntries(context)
 
list PatchToMap.patchFilepaths = []
 
list PatchToMap.variables = ['patchID']
 
tuple PatchToMap.m = VARIABLE_EXPR_RE.findall(args.outputVariable)
 
tuple PatchToMap.tmpDir = tempfile.mkdtemp()
 
tuple PatchToMap.reclassRule = os.path.join(tmpDir, 'reclass.rule')
 
tuple PatchToMap.grassDbase = os.path.join(context.projectDir, metadata['grass_dbase'])
 
tuple PatchToMap.grassConfig = GRASSConfig(context, grassDbase, metadata['grass_location'], metadata['grass_mapset'])
 
tuple PatchToMap.grassLib = GRASSLib(grassConfig=grassConfig)
 
tuple PatchToMap.result
 
list PatchToMap.variablesList = []
 
tuple PatchToMap.data = np.genfromtxt(patchFilepath, names=True)
 
list PatchToMap.patchIDs = [ int(p) for p in data['patchID'] ]
 
tuple PatchToMap.expr = VARIABLE_EXPR_RE.sub(r'data["\1"]', args.outputVariable)
 
list PatchToMap.reclass_map = args.mapNames[i]
 
tuple PatchToMap.reclass = open(reclassRule, 'w')