Revision ac284468
Added by Adam Wilson almost 11 years ago
climate/research/cloud/MOD09/MOD09_Visualize.R | ||
---|---|---|
84 | 84 |
r="Venezuela" |
85 | 85 |
|
86 | 86 |
## print global map with box for region |
87 |
png(paste("output/CF_mean_regbox.png",sep=""),width=1920,height=round(1920*d1),res=300,pointsize=46,bg="white") |
|
87 | 88 |
print(levelplot(mc[[1]],col.regions=cols(100),at=seq(1,100,len=100),margin=F,maxpixels=2.1e6,ylim=c(extent(coast2)@ymin,extent(coast2)@ymax), |
88 | 89 |
main=paste(month.name[i]),cex.main=3,scales=list(draw=F),cuts=99,ylab="",xlab="")+ |
89 | 90 |
layer(panel.polygon(c(extent(world)@xmin,extent(world)@xmin,extent(world)@xmax,extent(world)@xmax),y=c(extent(world)@ymin,extent(world)@ymax,extent(world)@ymax,extent(world)@ymin),col="black"),under=T)+ |
90 | 91 |
layer(sp.lines(coast2,col="black"),under=F)+ |
91 | 92 |
layer(sp.lines(world,col="black"),under=F)+ |
92 |
layer(sp.lines(regs[[r]],col="blue",lwd=2),under=F))
|
|
93 |
|
|
93 |
layer(sp.lines(as(regs2[[r]],"SpatialLines"),col="blue",lwd=2),under=F))
|
|
94 |
dev.off() |
|
94 | 95 |
|
95 | 96 |
# ylab.right = "Cloud Frequency (%)",par.settings = list(layout.widths = list(axis.key.padding = 0.1,axis.left=0.6,ylab.right = 3,right.padding=2)), |
96 | 97 |
|
climate/research/cloud/MOD09/ee/ee_compile.R | ||
---|---|---|
66 | 66 |
|
67 | 67 |
## mask no data regions (with less than 1 observation per day within that month) |
68 | 68 |
biasf=function(cf,cfsd,nobs,pobs) { |
69 |
## drop data in areass with nobs<1 or pobs<=50 or where sd=0 and cf=0 or 50 (some polar regions)
|
|
69 |
## drop data in areas with nobs<1 or pobs<=50 or where sd=0 and cf=0 or 50 (some polar regions) |
|
70 | 70 |
drop=nobs<=0|pobs<=50|(cf==0&cfsd==0)|(cf==50&cfsd==0) |
71 | 71 |
cf[drop]=NA |
72 | 72 |
cfsd[drop]=NA |
73 | 73 |
return(c(cf=cf,cfsd=cfsd,nobs=nobs,pobs=pobs))} |
74 |
|
|
75 | 74 |
|
76 | 75 |
mod2=overlay(mod,fun=biasf,unstack=TRUE,filename=ttif1,format="GTiff", |
77 | 76 |
dataType="INT1U",overwrite=T,NAflag=255, options=c("COMPRESS=LZW","BIGTIFF=YES")) |
... | ... | |
124 | 123 |
ttif2=paste(tmpfs,"/",s,"_",m,"_wgs84.tif",sep="") |
125 | 124 |
ncfile=paste("data/mcd09nc/",s,"_",m,".nc",sep="") |
126 | 125 |
|
126 |
## set up processing chunks |
|
127 |
nrw=nrow(mod) |
|
128 |
nby=20 |
|
129 |
nrwg=seq(1,nrw,by=nby) |
|
130 |
writeLines(paste("Processing ",length(nrwg)," groups and",nrw,"lines")) |
|
131 |
|
|
132 |
|
|
127 | 133 |
modpts=sampleRandom(cmod, size=10000, na.rm=TRUE, xy=T, sp=T) |
128 | 134 |
rm(cmod) #remove temporary raster to save space |
129 | 135 |
modpts=modpts[modpts$nobs>0,] #drop data from missing tiles |
... | ... | |
133 | 139 |
modbeta1=coef(modlm1)["pobs"] |
134 | 140 |
|
135 | 141 |
writeLines(paste(date," slope:",round(modbeta1,4))) |
136 |
## Smooth data to remove large-grain variability |
|
137 |
# system(paste("pkfilter -f mean -dx 99 -dy 99 -ot Byte -i ",df$path[df$month==m&df$sensor==s][1]," -o ",ttif1)) |
|
138 | 142 |
|
139 | 143 |
## mask no data regions (with less than 1 observation per day within that month) |
140 | 144 |
## use model above to correct for orbital artifacts |
Also available in: Unified diff
Update visualization for Berkeley talk