1
|
## explore the MOD35 data downloaded and gridded by the DAAC
|
2
|
setwd("~/acrobates/projects/interp/data/modis/mod35")
|
3
|
|
4
|
library(raster)
|
5
|
library(rgdal)
|
6
|
|
7
|
f=list.files(pattern="*.hdf")
|
8
|
|
9
|
Sys.setenv(GEOL_AS_GCPS = "PARTIAL")
|
10
|
|
11
|
GDALinfo(f[1])
|
12
|
system(paste("gdalinfo",f[1]))
|
13
|
GDALinfo("HDF4_EOS:EOS_SWATH:\"MOD35_L2.A2000100.1445.006.2012252024758.hdf\":mod35:Cloud_Mask")
|
14
|
system("gdalinfo HDF4_EOS:EOS_SWATH:\"MOD35_L2.A2000100.1445.006.2012252024758.hdf\":mod35:Cloud_Mask | tail -n 200")
|
15
|
|
16
|
system("gdalwarp -overwrite -geoloc -order 2 -r near -s_srs \"EPSG:4326\" HDF4_EOS:EOS_SWATH:\"MOD35_L2.A2000100.1445.006.2012252024758.hdf\":mod35:Cloud_Mask cloudmask.tif")
|
17
|
system("gdalwarp -overwrite -r near -s_srs \"EPSG:4326\" HDF4_EOS:EOS_SWATH:\"MOD35_L2.A2000100.1445.006.2012252024758.hdf\":mod35:Cloud_Mask:1 cloudmask2.tif")
|
18
|
|
19
|
|
20
|
## get tile
|
21
|
tile=raster("~/acrobates/projects/interp/data/modis/mod06/summary/MOD06_h09v04.nc",varname="CER")
|
22
|
h11v08=extent(tile)
|
23
|
|
24
|
r=raster(f[1])
|
25
|
extent(r)
|
26
|
|
27
|
|
28
|
st=lapply(f[1:10],raster)
|
29
|
str=lapply(2:length(st),function(i) union(extent(st[[i-1]]),extent(st[[i]])))[[length(st)-1]]
|
30
|
str=union(extent(h11v08),str)
|
31
|
|
32
|
b1=brick(lapply(st,function(stt) {
|
33
|
x=crop(alignExtent(stt,str),h11v08)
|
34
|
return(x)
|
35
|
}))
|
36
|
|
37
|
|
38
|
|
39
|
c=brick(f[1:10])
|