1
|
#### Script to facilitate processing of MOD06 data
|
2
|
|
3
|
setwd("/nobackupp1/awilso10/mod06")
|
4
|
|
5
|
## get MODLAND tile information
|
6
|
tb=read.table("http://landweb.nascom.nasa.gov/developers/sn_tiles/sn_bound_10deg.txt",skip=6,nrows=648,header=T)
|
7
|
tb$tile=paste("h",sprintf("%02d",tb$ih),"v",sprintf("%02d",tb$iv),sep="")
|
8
|
save(tb,file="modlandTiles.Rdata")
|
9
|
|
10
|
### Submission script
|
11
|
|
12
|
cat(paste("
|
13
|
#PBS -S /bin/bash
|
14
|
#PBS -l select=32:ncpus=4:mpiprocs=4:model=wes
|
15
|
####old PBS -l select=64:ncpus=4:mpiprocs=4:model=wes
|
16
|
####### old: select=48:ncpus=8:mpiprocs=8:model=neh
|
17
|
#PBS -l walltime=1:00:00
|
18
|
#PBS -j oe
|
19
|
#PBS -m e
|
20
|
#PBS -V
|
21
|
####PBS -W group_list=s1007
|
22
|
#PBS -q devel
|
23
|
#PBS -o log/log_^array_index^
|
24
|
#PBS -o log/log_DataCompile
|
25
|
#PBS -M adam.wilson@yale.edu
|
26
|
#PBS -N MOD06
|
27
|
|
28
|
source /usr/share/modules/init/bash
|
29
|
|
30
|
## cd to working directory
|
31
|
cd /nobackupp1/awilso10/mod06
|
32
|
|
33
|
## set some memory limits
|
34
|
# ulimit -d 1500000 -m 1500000 -v 1500000 #limit memory usage
|
35
|
source /usr/local/lib/global.profile
|
36
|
source /u/awilso10/.bashrc
|
37
|
## export a few important variables
|
38
|
export PATH=$PATH:/nobackupp1/awilso10/bin:/nobackupp1/awilso10/software/bin
|
39
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/nobackupp1/awilso10/software/lib
|
40
|
export MRTDATADIR=/nobackupp1/awilso10/software/heg/data
|
41
|
export PGSHOME=/nobackupp1/awilso10/software/heg
|
42
|
export MRTBINDIR=/nobackupp1/awilso10/software/TOOLKIT_MTD
|
43
|
export R_LIBS=\"/u/awilso10/R/x86_64-unknown-linux-gnu-library/2.15/\"
|
44
|
export TMPDIR=/nobackupp1/awilso10/mod06/tmp
|
45
|
## load modules
|
46
|
module load gcc mpi-sgi/mpt.2.06r6 hdf4 udunits R nco
|
47
|
## Run the script!
|
48
|
TMPDIR=$TMPDIR Rscript --verbose --vanilla /u/awilso10/environmental-layers/climate/procedures/MOD06_L2_process.r
|
49
|
exit 0
|
50
|
",sep=""),file="MOD06_process")
|
51
|
|
52
|
### Check the file
|
53
|
system("cat MOD06_process")
|
54
|
#system("cat ~/environmental-layers/climate/procedures/MOD06_L2_process.r")
|
55
|
|
56
|
## Submit it (and keep the pid)!
|
57
|
pid=system("qsub MOD06_process",intern=T); pid; pid=strsplit(pid,split="[.]")[[1]][1]
|
58
|
|
59
|
#system("qsub MOD06_process")
|
60
|
|
61
|
## work in interactive mode
|
62
|
#system("qsub -I -l walltime=1:00:00 -lselect=1:ncpus=2:model=wes -q devel")
|
63
|
|
64
|
## check progress
|
65
|
system("qstat -u awilso10")
|
66
|
system(paste("qstat -t -x",pid))
|
67
|
|
68
|
system("qstat devel ")
|
69
|
#system("qstat | grep awilso10")
|
70
|
|
71
|
|
72
|
### copy the files back to Yale
|
73
|
list.files("2_daily")
|
74
|
system("scp 2_daily/* adamw@acrobates.eeb.yale.edu:/data/personal/adamw/projects/interp/data/modis/Venezuela")
|
75
|
|
76
|
system("scp /tmp/Rtmp6I6tFn/MOD06_L2.A2000061.1615.051.2010273184629.hdf adamw@acrobates.eeb.yale.edu:/data/personal/adamw/projects/interp/data/modis/Venezuela")
|
77
|
system("scp 2_daily/MOD06_20000410.nc adamw@acrobates.eeb.yale.edu:/data/personal/adamw/projects/interp/data/modis/Venezuela")
|
78
|
|
79
|
|
80
|
list.files(" /tmp/Rtmp6I6tFn")
|