Project

General

Profile

Download (1.74 KB) Statistics
| Branch: | Revision:
1 9a19743f Adam M. Wilson
## script to visualize cloud frequency data
2
3
setwd("~/acrobates/adamw/projects/cloud/")
4
5
library(rasterVis)
6
7 d7dc526e Adam M. Wilson
## read in global coasts for nice plotting
8
library(maptools)
9
10
#coast=spTransform(coast,CRS(projection(mod35)))
11 77d8eaf2 Adam M. Wilson
land=readShapePoly("/mnt/data/jetzlab/Data/environ/global/gshhg/GSHHS_shp/c/GSHHS_c_L1.shp",force_ring=TRUE)
12
projection(land)="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"
13
CP <- as(extent(-180, 180, -60, 84), "SpatialPolygons")
14
proj4string(CP) <- CRS(proj4string(land))
15
coast=as(land[land$area>50,],"SpatialLines")
16 d7dc526e Adam M. Wilson
17 9a19743f Adam M. Wilson
18
#### Evaluate MOD35 Cloud data
19 d86b0a4a Adam M. Wilson
mc=brick("~/acrobates/adamw/projects/cloud/data/mod09.nc",varname="CF")
20 d6ddb3e2 Adam M. Wilson
NAvalue(mc)=-1
21 9a19743f Adam M. Wilson
22 d7dc526e Adam M. Wilson
cols=colorRampPalette(c("#000000","#00FF00","#FF0000"))#"black","blue","red"))
23
for(i in 1:156){
24
png(paste("output/mod09_fullanimation_",i,".png",sep=""),width=2000,height=1000)
25
  print(i)
26 d86b0a4a Adam M. Wilson
  r=mm[[i]]
27 d7dc526e Adam M. Wilson
  print(levelplot(r,col.regions=cols(100),at=seq(0,100,len=100),margin=F,maxpixels=1e6,ylim=c(-60,70),main=paste(names(mod09)[i])))+
28
    layer(sp.lines(coast))
29
dev.off()
30
}
31 9a19743f Adam M. Wilson
32 d7dc526e Adam M. Wilson
#### Evaluate MOD35 Cloud data
33 77d8eaf2 Adam M. Wilson
mmc=brick("~/acrobates/adamw/projects/cloud/data/cloud_ymonmean.nc",varname="CF")
34 d86b0a4a Adam M. Wilson
names(mmc)=month.name
35 9a19743f Adam M. Wilson
36 d7dc526e Adam M. Wilson
cols=colorRampPalette(c("#000000","#00FF00","#FF0000"))#"black","blue","red"))
37 77d8eaf2 Adam M. Wilson
png("output/CF_Animation_%03d.png",width=5000,height=4000,res=600,pointsize=96,bg="white")
38 d7dc526e Adam M. Wilson
for(i in 1:12){
39 77d8eaf2 Adam M. Wilson
    print(i)
40
    r=mmc[[i]]
41
    print(levelplot(r,col.regions=cols(100),at=seq(1,100,len=100),margin=F,maxpixels=1e6,ylim=c(-60,73),
42
                    main=paste(month.name[i]),cex.main=3,scales=list(draw=F),cuts=99,ylab="",xlab="")+
43
                        layer(panel.polygon(x=c(-180,-180,180,180),y=c(-90,90,90,-90),col="black"),under=T)+
44
                        layer(sp.lines(coast,col="black"),under=F))
45 d6ddb3e2 Adam M. Wilson
}
46 d86b0a4a Adam M. Wilson
dev.off()
47 d7dc526e Adam M. Wilson