[STATSGRASS] R-GRASS scripting question

Thomas Adams Thomas.Adams at noaa.gov
Thu Jan 22 13:43:34 EST 2004


Skipped content of type multipart/alternative-------------- next part --------------
#---------------------------------------------------------
# R.precip_bias.batch
#---------------------------------------------------------
#usage:
# export R_BASIN_NAME=basinName
# export R_YEAR=year
# export R_INMAP_ANN=rastermap-1
# export R_INMAP_JJA=rastermap-2
# export R_INMAP_DJF=rastermap-3
# R BATCH R.precip_bias.batch
#---------------------------------------------------------

library(GRASS)
G<-gmeta()
library(MASS)

#read input map from environment variable $R_BASIN_NAME
basinname<-Sys.getenv("R_BASIN_NAME")
year<-Sys.getenv("R_YEAR")
year

#---------------------------------------------------------
#(1) read input map from environment variable $R_INMAP_ANN
#---------------------------------------------------------
mapname<-Sys.getenv("R_INMAP_ANN")
bias<-rast.get(G,rlist=c(Sys.getenv("R_INMAP_ANN")))
summary(bias$mapname)

tstr<-paste(c(basinname," Radar-Precipitation Bias - ",year),collapse="")

#Write Histogram to pdf
filename<-paste(c(basinname,".",year,".annual.hist.pdf"))
pdf(filename)
truehist(bias$mapname,xlab="XMRG Bias",ylab="Frequency",main=tstr,prob=F)
dev.off()

#Write Boxplot to pdf
filename<-paste(c(basinname,".",year,".annual.boxplot.pdf"),collapse="")
pdf(filename)
boxplot(bias$mapname,xlab=tstr,ylab="XMRG bias")
dev.off()

.
.
.
.

#cleanup workspace
rm(list = ls(all=TRUE))


More information about the grass-stats mailing list