Project

General

Profile

« Previous | Next » 

Revision d86b0a4a

Added by Adam Wilson almost 11 years ago

updates to MOD09 visualizations

View differences:

climate/procedures/MOD09_Visualize.R
14 14

  
15 15

  
16 16
#### Evaluate MOD35 Cloud data
17
mod09=brick("~/acrobates/adamw/projects/cloud/data/mod09.nc",varname="CF")
17
mc=brick("~/acrobates/adamw/projects/cloud/data/mod09.nc",varname="CF")
18 18
NAvalue(mod09)=-1
19 19

  
20 20
cols=colorRampPalette(c("#000000","#00FF00","#FF0000"))#"black","blue","red"))
21 21
for(i in 1:156){
22 22
png(paste("output/mod09_fullanimation_",i,".png",sep=""),width=2000,height=1000)
23 23
  print(i)
24
  r=mod09[[i]]
24
  r=mm[[i]]
25 25
  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])))+
26 26
    layer(sp.lines(coast))
27 27
dev.off()
28 28
}
29 29

  
30 30
#### Evaluate MOD35 Cloud data
31
mod09=brick("~/acrobates/adamw/projects/cloud/data/mod09_clim.nc",varname="CF")
32
NAvalue(mod09)=-1
31
mmc=brick("~/acrobates/adamw/projects/cloud/data/mod09_clim_mean.nc",varname="CF")
32
names(mmc)=month.name
33
NAvalue(mmc)=-1
33 34

  
34 35
cols=colorRampPalette(c("#000000","#00FF00","#FF0000"))#"black","blue","red"))
35 36
for(i in 1:12){
36 37
png(paste("output/mod09_animation_",i,".png",sep=""),width=2000,height=1000)
37 38
  print(i)
38
  r=mod09[[i]]
39
  print(levelplot(r,col.regions=cols(100),at=seq(0,100,len=100),margin=F,maxpixels=1e6,ylim=c(-60,70),main=paste(month.name[i])))+
39
  r=mmc[[i]]
40
  print(levelplot(r,col.regions=cols(100),at=seq(0,100,len=100),margin=F,maxpixels=1e7,ylim=c(-60,70),
41
                  main=paste(month.name[i]),cex.main=3,scales=list(draw=F),cuts=99))+
40 42
    layer(sp.lines(coast))
41 43
dev.off()
42 44
}
43 45

  
44 46

  
45 47
## climatologies
46
mod09a=brick("~/acrobates/adamw/projects/cloud/data/mod09_clim2.nc",varname="CF")
48
mac=brick("~/acrobates/adamw/projects/cloud/data/mod09_clim_mac.nc",varname="CF_annual")
47 49

  
48 50
pdf("output/mod09_climatology.pdf",width=11,height=8.5)
49
levelplot(mod09c,col.regions=cols(100),at=seq(0,100,len=100),margin=F,max.pixels=1e7)
51
levelplot(mac,col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,max.pixels=1e6)+
52
    layer(sp.lines(coast,lwd=.5,col="black"))
50 53
dev.off()
51 54

  
52 55

  
53
## Compare with worldclim
56
## Compare with worldclim and NPP
54 57
wc=stack(as.list(paste("/mnt/data/jetzlab/Data/environ/global/worldclim/prec_",1:12,".bil",sep="")))
55
reg=extent(c(-83,-45,-5,13))
56
reg2=extent(c(-81,-70,-4,10))
57

  
58
wc_map=stack(as.list(paste("/mnt/data/jetzlab/Data/environ/global/worldclim/bio_12.bil",sep="")))
59
npp=raster("/mnt/data/jetzlab/Data/environ/global/MODIS/MOD17A3/MOD17A3_Science_NPP_mean_00_12.tif",sep="")
58 60

  
59
wc_map=mean(crop(wc,reg))
60 61

  
61
twc_12=crop(wc[[12]],reg)
62
mod09_12=crop(mod09[[12]],reg)
62
pdf("output/mod09_worldclim.pdf",width=11,height=8.5)
63
p1=levelplot(wc_map,col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,maxpixels=1e5,colorkey=list("top"))
64
p2=levelplot(mac,col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,maxpixels=1e5,colorkey=list("bottom"))
65
p3=c(p1,p2,x.same=T,y.same=T,merge.legends=T)
66
print(p3)
63 67

  
64 68

  
65
p1=levelplot(wc_map,col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,colorkey=list("top"))
66
p2=levelplot(mod09_12,col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,colorkey=list("bottom"))
69
regs=list(
70
  Hawaii=extent(c(-156.5,-154,18.75,20.5)),
71
  Boliva=extent(c(-71,-63,-20,-15)),
72
  Venezuela=extent(c(-69,-59,0,7)),
73
  reg=extent(c(-83,-45,-5,13)),
74
  reg2=extent(c(-81,-70,-4,10))
75
  )
67 76

  
68
p3=c(p1,p2,x.same=T,y.same=T,merge.legends=F)
77
r=3  #set region
78
p_map=levelplot(crop(wc_map,regs[[r]]),col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,maxpixels=1e5,colorkey=list(space="bottom",height=.75),xlab="",ylab="",main=names(regs)[r],useRaster=T)
79
p_mac=levelplot(crop(mac,regs[[r]]),col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,maxpixels=1e5,colorkey=list(space="bottom",height=.75),useRaster=T)
80
p_npp=levelplot(crop(npp,regs[[r]]),col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,maxpixels=1e5,colorkey=list(space="bottom",height=.5),zscaleLog=T,useRaster=T)
81
p3=c("WorldClim Mean Annual Precip (mm)"=p_map,"MOD09 Cloud Frequency (%)"=p_mac,"NPP"=p_npp,x.same=T,y.same=T,merge.legends=T,layout=c(3,1))
69 82
print(p3)
70 83

  
71
plot(mod09_12)
84
dev.off()
72 85

  
73 86

  
74 87
## reduced resolution
75
mod09_8km=aggregate(mod09_12,8)
76
mod09_1deg=aggregate(mod09_12,110)
88
mod09_8km=aggregate(mod09_mac,8)
89
mod09_1deg=aggregate(mod09_mac,110)
77 90

  
78 91
pdf("output/mod09_resolution.pdf",width=11,height=8.5)
79
p1=levelplot(mod09_12,col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,max.pixels=1e6)
80
p2=levelplot(mod09_8km,col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,max.pixels=1e6)
81
p3=levelplot(mod09_1deg,col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,max.pixels=1e6)
82
print(c(p1,p2,p3))
92
p1=levelplot(mod09_mac,col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,max.pixels=1e5)
93
p2=levelplot(mod09_8km,col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,max.pixels=1e5)
94
p3=levelplot(mod09_1deg,col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,max.pixels=1e5)
95
print(c(p1,p2,p3,x.same=T,y.same=T,merge.legends=F))
83 96

  
84 97

  
85
p1=levelplot(crop(mod09_12,reg2),col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,max.pixels=1e6)
86
p2=levelplot(crop(mod09_8km,reg2),col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,max.pixels=1e6)
87
p3=levelplot(crop(mod09_1deg,reg2),col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,max.pixels=1e6)
88
print(c(p1,p2,p3),x.same=T,y.same=T)
98
p1=levelplot(crop(mod09_mac,reg2),col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,max.pixels=1e5)
99
p2=levelplot(crop(mod09_8km,reg2),col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,max.pixels=1e5)
100
p3=levelplot(crop(mod09_1deg,reg2),col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,max.pixels=1e5)
101
print(c(p1,p2,p3,x.same=T,y.same=T,merge.legends=F))
89 102

  
90
dev.off()
103
p1=levelplot(crop(mod09_mac,reg3),col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,max.pixels=1e5)
104
p2=levelplot(crop(mod09_8km,reg3),col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,max.pixels=1e5)
105
p3=levelplot(crop(mod09_1deg,reg3),col.regions=grey(seq(0,1,len=100)),cuts=99,margin=F,max.pixels=1e5)
106
print(c(p1,p2,p3,x.same=T,y.same=T,merge.legends=F))
91 107

  
108
dev.off()
92 109

  

Also available in: Unified diff