def main(): sys.stdout = open('./Log/multicostModel.stdout.log', 'w') sys.stderr = open('./Log/multicostModel.stderr.log', 'w') # exportRaster('emp_centers4_47_98') # importVector('Data/FID4_47_98', EMPCENTERS) # print "list available raster maps in database..." # grass.run_command('g.mlist', type='rast') resultsdir = sys.argv[1] user = sys.argv[2] passwd = sys.argv[3] site = LEAMsite(resultsdir, user, passwd) global runlog runlog = RunLog(resultsdir, site, initmsg='Scenario ' + scenariotitle) runMulticostModel(user, passwd, runlog)
def main(): # Sample variable values # scenariotitle = 'test2_projection' # resultsdir = 'http://portal.leam.illinois.edu/chicago/luc/scenarios/test4_scenario' # demandgraphurl="http://portal.leam.illinois.edu/chicago/luc/projections/test2_projection/getGraph" resultsdir = sys.argv[1] scenariotitle = os.path.basename(resultsdir) global site global runlog site = LEAMsite(resultsdir, user=sys.argv[2], passwd=sys.argv[3]) runlog = RunLog(resultsdir, site, initmsg='Scenario ' + scenariotitle) demandgraphurl = sys.argv[4] demandstr = site.getURL(demandgraphurl).getvalue() executeGLUCModel(demandstr, scenariotitle, runlog)
def main(): # The system stdout and stderr will be in /leam/scratch/<scenarioname>/<scenarioname>.log jobstart = time.asctime() os.environ['PATH'] = ':'.join( ['./bin', os.environ.get('BIN', '.'), '/bin', '/usr/bin']) configurl, user, password = parseFlags() print "Parsing configuration file.............\n" configfile = get_config(configurl, user, password) luc = LUC(configfile) print luc.growthmap[0] # luc has sorted luc.growthmap(drivers) in year and luc.growth(projections) print "Setting up GRASS environment.............\n" get_grassfolder(luc.scenario['grass_loc'], user, password) grasssetup.grassConfig() global grass grass = grasssetup.grass print "Connect to the LEAM storage server............." resultsdir = luc.scenario['results'] print resultsdir, '\n' title = luc.scenario['title'] global site, runlog # run.log will be stored in Log repository site = LEAMsite(resultsdir, user=user, passwd=password) runlog = RunLog(resultsdir, site, initmsg='Scenario ' + title) runlog.p('started at ' + jobstart) global projectiontable projectiontable = ProjTable() growth = dict(deltapop=[0.0], deltaemp=[0.0]) if luc.growth: # note growthmap[0]...should change luc, using luc_new runlog.h('Processing Growth driver set.............') startyear, isprobmapcached = processDriverSets(luc.growthmap[0]) if not isprobmapcached: runlog.h('Building Probability Maps..............') runMulticostModel(resultsdir, site, runlog) if luc.growthmap: runlog.h('Processing Growth Projection set........') demandstr = processProjectionSet(luc.growth[0]) genYearChangemap.executeGLUCModel(demandstr, title, runlog) runlog.h('Publishing all results..............') publishResults(title, site, resultsdir)
def main(): # The system stdout and stderr will be in /leam/scratch/<scenarioname>/<scenarioname>.log jobstart = time.asctime() os.environ['PATH'] = ':'.join(['./bin', os.environ.get('BIN', '.'),'/bin', '/usr/bin']) configurl, user, password = parseFlags() print "Parsing configuration file.............\n" configfile = get_config(configurl, user, password) luc = LUC(configfile) print luc.growthmap[0] # luc has sorted luc.growthmap(drivers) in year and luc.growth(projections) print "Setting up GRASS environment.............\n" get_grassfolder(luc.scenario['grass_loc'], user, password) grasssetup.grassConfig() global grass grass = grasssetup.grass print "Connect to the LEAM storage server............." resultsdir = luc.scenario['results'] print resultsdir, '\n' title = luc.scenario['title'] global site, runlog # run.log will be stored in Log repository site = LEAMsite(resultsdir, user=user, passwd=password) #create runlog file site.createFolder("RunLog", resultsdir) runlog = RunLog(resultsdir+"/runlog", site, initmsg='Scenario ' + title) runlog.p('started at '+jobstart) # creat two folders site.createFolder("Details", resultsdir) site.createFolder("Results", resultsdir) global projectiontable projectiontable = ProjTable() growth = dict(deltapop=[0.0], deltaemp=[0.0]) if luc.growth: # note growthmap[0]...should change luc, using luc_new runlog.h('Processing Growth driver set.............') startyear, isprobmapcached = processDriverSets(luc.growthmap[0]) if not isprobmapcached: runlog.h('Building Probability Maps..............') runMulticostModel(resultsdir, site, runlog) cacheProbmaps(luc.growthmap[0]['url']) if luc.growthmap: runlog.h('Processing Growth Projection set........') demandstr = processProjectionSet(luc.growth[0]) genYearChangemap.executeGLUCModel(demandstr, title, runlog) runlog.h('Publishing all results..............') #wrap the simmap file to Results publishResults(title, site, resultsdir+"/results")