Skip to content
Renato Figueiredo edited this page Oct 6, 2015 · 7 revisions

Welcome to GRAPLEr!

GRAPLEr brings the power of distributing computing to the fingertips of lake ecology modelers. It is a Web Service that allows you to submit batches of GLM (General Lake Model) simulations to a distributed computing system, directly from your R/Rstudio environment.

GRAPLEr has been developed as a collaboration between researchers in PRAGMA and GLEON, with support from a supplement the the PRAGMA award (NSF OCI-1234983). For additional information, contact Renato Figueiredo (renato at acis.ufl.edu), Cayelan Carey (cayelan at vt.edu) or Paul Hanson (pchanson at wisc.edu)

You can use the following commands to get started using GRAPLEr in your R environment (these are extracted from a project EDDIE module used in a workshop at GLEON17)

Install glmtools:

install.packages('glmtools', repos=c('http://cran.rstudio.com', 'http://owi.usgs.gov/R'))
library(glmtools)
library(GLMr)

Install GRAPLEr:

install.packages("devtools")
library("devtools")
devtools::install_github("GRAPLE/GRAPLEr") 
library("bitops")
library("RCurl")
library("GrapleR")

Copy a template file that comes with glmtools to a simulation directory:

nml_template_path() 
# this should give you a path that tells you where the example GLM nml file is. E.g.:
# "/Library/Frameworks/R.framework/Versions/3.1/Resources/library/GLMr/extdata/glm2.nml"
# copy glm2.nml, met_hourly.csv to another folder, e.g. "/Users/yourname/Desktop/GRAPLEr"

Connect to the GRAPLEr Web service:

graplerURL<-"http://graple-service.cloudapp.net"
GrapleCheckService(graplerURL)  
# this will print a string that includes “I am alive, and at your service.” if everything went well.

Configure a test batch of 100 simulations to send to GRAPLEr (replace the sim_folder path to your computer's path)

sim_folder<-'/Users/yourname/Desktop/GRAPLEr'
driverFileName="met_hourly.csv"
parameterName="AirTemp"
startValue=-2
endValue=2
numberOfIncrements=100

Start the simulations:

expId<-GrapleRunExperimentSweep(graplerURL, sim_folder, driverFileName, parameterName, startValue, endValue, numberOfIncrements)

Check their status; repeat until the command returns a message that they are completed:

GrapleCheckExperimentCompletion(graplerURL, expId)

Once complete, download results:

GrapleGetExperimentResults(graplerURL, expId)

Plot two sample outputs:

sim_folder_1<-paste(sim_folder,sep='/','Sims','Sim1','Results')
sim_folder_101<-paste(sim_folder,sep='/','Sims','Sim100','Results')
nc_file_1 <- file.path(sim_folder_1, 'output.nc')
nc_file_101 <- file.path(sim_folder_101, 'output.nc')
plot_temp(file=nc_file_1, fig_path=FALSE)
plot_temp(file=nc_file_101, fig_path=FALSE) 
Clone this wiki locally