154 |
154 |
mod06s$glon2=cut(mod06s$lon,breaks=c(-125,-122,-115),labels=c("Coastal","Inland"),include.lowest=T,ordered=T)#gq(mod06s$lon,n=3))
|
155 |
155 |
mod06s$gelev=cut(mod06s$elev,breaks=gq(mod06s$elev,n=3),labels=c("Low","Mid","High"),include.lowest=T,ordered=T)
|
156 |
156 |
mod06s$gbin=factor(paste(mod06s$gelev,mod06s$glon2,sep="_"),levels=c("Low_Coastal","Mid_Coastal","High_Coastal","Low_Inland","Mid_Inland","High_Inland"),ordered=T)
|
157 |
|
|
|
157 |
mod06s$LWP_mean=(2/3)*mod06s$CER_mean*mod06s$COT_mean
|
158 |
158 |
|
159 |
159 |
## melt it
|
160 |
160 |
mod06sl=melt(mod06s[,!grepl("lppt",colnames(mod06s))],id.vars=c("id","lon","lat","elev","month","ppt","glon","glon2","gelev","gbin"))
|
161 |
|
levels(mod06sl$variable)=c("Effective Radius (um)","Cloudy Days (%)","Optical Thickness (%)")
|
|
161 |
levels(mod06sl$variable)=c("Effective Radius (um)","Cloudy Days (%)","Optical Thickness (%)","Liquid Water Path")
|
162 |
162 |
|
163 |
163 |
###################################################################
|
164 |
164 |
###################################################################
|
165 |
165 |
|
166 |
166 |
bgyr=colorRampPalette(c("blue","green","yellow","red"))
|
167 |
167 |
|
|
168 |
X11.options(type="cairo")
|
168 |
169 |
pdf("output/MOD06_summary.pdf",width=11,height=8.5)
|
169 |
170 |
|
170 |
171 |
# % cloudy maps
|
... | ... | |
243 |
244 |
|
244 |
245 |
## ppt~metric with longitude bins
|
245 |
246 |
xyplot(ppt~value|variable,groups=glon,data=mod06sl,
|
246 |
|
scales=list(y=list(log=T),x=list(relation="free")),
|
247 |
|
par.settings = list(superpose.symbol = list(col=bgyr(5),pch=16,cex=.5)),auto.key=list(space="right",title="Station Longitude"),
|
248 |
|
main="Comparison of MOD06_L2 and Precipitation Monthly Climatologies",ylab="Precipitation",xlab="MOD06_L2 Product",layout=c(3,1))+
|
|
247 |
scales=list(y=list(log=T),x=list(relation="free",log=F)),
|
|
248 |
par.settings = list(superpose.symbol = list(col=bgyr(5),pch=16,cex=.5)),auto.key=list(space="top",title="Station Longitude"),
|
|
249 |
main="Comparison of MOD06_L2 and Precipitation Monthly Climatologies",ylab="Mean Monthly Station Precipitation (mm)",xlab="MOD06_L2 Product",layout=c(4,1))+
|
249 |
250 |
layer(panel.text(9,2.5,label="Coastal stations",srt=30,cex=1.3,col="blue"),columns=1)+
|
250 |
251 |
layer(panel.text(13,.9,label="Inland stations",srt=10,cex=1.3,col="red"),columns=1)
|
251 |
252 |
|
|
253 |
## ppt~metric with longitude bins
|
|
254 |
#CairoPNG("output/COT.png",width=10,height=5,units="in",dpi=300,pointsize=20)
|
|
255 |
#png("output/COT.png",width=10,height=5,units="in",res=150)
|
|
256 |
#trellis.par.set("fontsize",12)
|
|
257 |
at=quantile(as.matrix(subset(m01,subset=3)),seq(0,1,len=100),na.rm=T)
|
|
258 |
p1=levelplot(subset(m01,subset=3),xlab.top="Optical Thickness (%)",at=at,col.regions=bgyr(length(at)),margin=F,
|
|
259 |
)+layer(sp.lines(roi_geo, lwd=1.2, col='black'))+layer(sp.points(st2, cex=.5,col='black'))
|
|
260 |
at=quantile(as.matrix(subset(m01,subset=4)),seq(0,1,len=100),na.rm=T)
|
|
261 |
p2=levelplot(subset(m01,subset=4),xlab.top="PRISM MAP",at=at,col.regions=bgyr(length(at)),margin=F,
|
|
262 |
)+layer(sp.lines(roi_geo, lwd=1.2, col='black'))+layer(sp.points(st2, cex=.5, col='black'))
|
|
263 |
|
|
264 |
p3=xyplot(ppt~value,groups=glon,data=mod06sl[mod06sl$variable=="Optical Thickness (%)",],
|
|
265 |
scales=list(y=list(log=T),x=list(relation="free",log=F)),
|
|
266 |
par.settings = list(superpose.symbol = list(col=bgyr(5),pch=16,cex=.3)),auto.key=list(space="right",title="Station \n Longitude"),
|
|
267 |
ylab="Mean Monthly Station Precipitation (mm)",xlab="Cloud Optical Thickness from MOD06_L2 (%)",layout=c(1,1))+
|
|
268 |
layer(panel.text(9,2.6,label="Coastal stations",srt=10,cex=1.3,col="blue"),columns=1)+
|
|
269 |
layer(panel.text(13,.95,label="Inland stations",srt=10,cex=1.3,col="red"),columns=1)
|
|
270 |
|
|
271 |
save(p1,p2,p3,file="plotdata.Rdata")
|
|
272 |
load("plotdata.Rdata")
|
|
273 |
|
|
274 |
CairoPDF("output/MOD06_Summaryfig.pdf",width=11,height=8.5)
|
|
275 |
print(p3,position=c(0,0,1,.5),save.object=F)
|
|
276 |
print(p1,split=c(1,1,2,2),new=F)
|
|
277 |
print(p2,split=c(2,1,2,2),new=F)
|
|
278 |
dev.off()
|
|
279 |
system("convert output/MOD06_Summaryfig.pdf output/MOD06_Summaryfig.png")
|
|
280 |
#dev.off()
|
|
281 |
|
252 |
282 |
## with elevation
|
253 |
283 |
# xyplot(ppt~value|variable,groups=gbin,data=mod06sl,
|
254 |
284 |
# scales=list(y=list(log=T),x=list(relation="free")),
|
... | ... | |
295 |
325 |
ylab="Precipitation (mm, log axis)",xlab="Mean Monthly Cloud Optical Thickness (%)")+
|
296 |
326 |
layer(panel.text(10,.5,round(summary(lm(y~x))$r.squared,2),pos=4,cex=.75,col="grey"))
|
297 |
327 |
|
|
328 |
xyplot(ppt~LWP_mean|id,data=mod06s,panel=function(x,y,group){
|
|
329 |
panel.xyplot(x,y,type=c("r"),cex=.5,pch=16,col="red")
|
|
330 |
panel.xyplot(x,y,type=c("p"),cex=.5,pch=16,col="black")
|
|
331 |
} ,scales=list(y=list(log=T)),strip=F,main="Monthly Mean Precipitation and Liquid Water Path by station",
|
|
332 |
sub="Each panel is a station, each point is a monthly mean \n Number in lower right of each panel is R^2",
|
|
333 |
ylab="Precipitation (mm, log axis)",xlab="Mean Monthly Liquid Water Path")+
|
|
334 |
layer(panel.text(10,.5,round(summary(lm(y~x))$r.squared,2),pos=4,cex=.75,col="grey"))
|
298 |
335 |
|
299 |
336 |
### Calculate the slope of each line
|
300 |
337 |
mod06s.sl=dapply(mod06s,list(id=mod06s$id),function(x){
|
added processing for 'very cloudy days'