Project

General

Profile

« Previous | Next » 

Revision f27b378d

Added by Adam Wilson almost 12 years ago

Updates to MOD06 Climatology Script and MDO06 processing to isolate the effects of the MOD35 -landcover bias

View differences:

climate/procedures/MOD06_Climatology.r
13 13

  
14 14
### directory containing daily files
15 15
outdir=paste("daily/",tile,"/",sep="")  #directory for separate daily files
16
if(!file.exists(outdir)) dir.create(outdir)
17 16

  
18 17
### directory to hold climatology
19 18
outdir2="summary" #directory for combined daily files and summarized files
......
31 30
## Get list of all daily files
32 31
if(verbose) print("Checking daily output in preparation for generating climatology")
33 32

  
34
fdly=data.frame(
35
  path=list.files(outdir,pattern="nc$",full=T),
36
  file=list.files(outdir,pattern="nc$"))
33
 fdly=data.frame(path=list.files(outdir,pattern="nc$",full=T),stringsAsFactors=F)
34
  fdly$file=basename(fdly$path)
37 35
  fdly$dateid=substr(fdly$file,14,21)
38 36
  fdly$date=as.Date(substr(fdly$file,14,21),"%Y%m%d")
39 37
  fdly$month=format(fdly$date,"%m")
......
41 39
nrow(fdly)
42 40

  
43 41
## check validity (via npar and ntime) of nc files
44
for(i in 1:nrow(fdly)){
45
  fdly$ntime[i]<-as.numeric(system(paste("cdo -s ntime ",fdly$path[i]),intern=T))
46
  fdly$npar[i]<-as.numeric(system(paste("cdo -s npar ",fdly$path[i]),intern=T))
47
  fdly$fyear[i]<-as.numeric(system(paste("cdo -s showyear ",fdly$path[i]),intern=T))
48
  fdly$fmonth[i]<-as.numeric(system(paste("cdo -s showmon ",fdly$path[i]),intern=T))
49
  fdly$fvar[i]<-system(paste("cdo -s showvar ",fdly$path[i]),intern=T)
50
  print(paste(i," out of ",nrow(fdly)," for year ",  fdly$fyear[i]))
51
}
42
#for(i in 1:nrow(fdly)){
43
#  fdly$ntime[i]<-as.numeric(system(paste("cdo -s ntime ",fdly$path[i]),intern=T))
44
#  fdly$npar[i]<-as.numeric(system(paste("cdo -s npar ",fdly$path[i]),intern=T))
45
#  fdly$fyear[i]<-as.numeric(system(paste("cdo -s showyear ",fdly$path[i]),intern=T))
46
#  fdly$fmonth[i]<-as.numeric(system(paste("cdo -s showmon ",fdly$path[i]),intern=T))
47
#  fdly$fvar[i]<-system(paste("cdo -s showvar ",fdly$path[i]),intern=T)
48
#  print(paste(i," out of ",nrow(fdly)," for year ",  fdly$fyear[i]))
49
#}
52 50

  
53 51
## print some summaries
54 52
if(verbose) print("Summary of available daily files")
55
print(table(fdly$fyear))
56
print(table(fdly$fmonth))
57
print(table(fdly$fvar))
53
print(table(fdly$year))
54
print(table(fdly$month))
55
#print(table(fdly$fvar))
58 56

  
59 57
## Identify which files failed test
60
fdly$drop=is.na(fdly$npar)|fdly$fvar!=finalvars
58
#fdly$drop=is.na(fdly$npar)|fdly$fvar!=finalvars
61 59

  
62 60
## delete files that fail check?
63
delete=T  
61
delete=F
64 62
if(delete) {
65 63
  print(paste(sum(fdly$drop),"files will be deleted"))
66 64
  file.remove(as.character(fdly$path[fdly$drop]))
67 65
}
68 66
## remove dropped files from list
69
fdly=fdly[!fdly$drop,]
67
#fdly=fdly[!fdly$drop,]
70 68

  
71 69
#################################################################################
72 70
## Combine the year-by-year files into a single daily file in the summary directory (for archiving)
......
98 96
myear=as.integer(max(fdly$year))  #this year will be used in all dates of monthly climatologies (and day will = 15)
99 97

  
100 98
## Monthly means
99
if(verbose) print("Calculating the monthly means")
101 100
system(paste("cdo -O sorttimestamp -setyear,",myear," -setday,15 -ymonmean ",outdir2,"/MOD06_",tile,"_daily.nc ",tsdir,"/MOD06_",tile,"_ymonmean.nc",sep=""),wait=T)
102 101

  
103 102
## Monthly standard deviation
103
if(verbose) print("Calculating the monthly SD")
104 104
system(paste("cdo -O sorttimestamp -setyear,",myear," -setday,15 -ymonstd ",outdir2,"/MOD06_",tile,"_daily.nc ",tsdir,"/MOD06_",tile,"_ymonstd.nc",sep=""))
105 105
system(paste(ncopath,"ncrename -v CER,CER_sd -v CLD,CLD_sd -v COT,COT_sd ",tsdir,"/MOD06_",tile,"_ymonstd.nc",sep=""))
106 106
system(paste(ncopath,"ncatted ",
......
110 110
tsdir,"/MOD06_",tile,"_ymonstd.nc",sep=""))
111 111

  
112 112
## cer > 20
113
if(verbose) print("Calculating the proportion of days with CER > 20")
113 114
system(paste("cdo -O  sorttimestamp -setyear,",myear," -setday,15 -ymonmean -gtc,20 -selvar,CER ",outdir2,"/MOD06_",tile,"_daily.nc ",tsdir,"/MOD06_",tile,"_ymoncer20.nc",sep=""))
114 115
system(paste(ncopath,"ncrename -v CER,CER20 ",tsdir,"/MOD06_",tile,"_ymoncer20.nc",sep=""))
115 116
system(paste(ncopath,"ncatted ",
......
117 118
" -a units,CER20,o,c,\"Proportion\" ",
118 119
tsdir,"/MOD06_",tile,"_ymoncer20.nc",sep=""))
119 120

  
121
## cld == 0
122
if(verbose) print("Calculating the proportion of cloudy days")
123
system(paste("cdo -O  sorttimestamp -setyear,",myear," -setday,15 -nint -mulc,100 -ymonmean -eqc,0 -setctomiss,1 -selvar,CLD2 ",outdir2,"/MOD06_",tile,"_daily.nc ",tsdir,"/MOD06_",tile,"_ymoncld0.nc",sep=""))
124
system(paste(ncopath,"ncrename -v CLD2,CLD0 ",tsdir,"/MOD06_",tile,"_ymoncld0.nc",sep=""))
125
system(paste(ncopath,"ncatted ",
126
" -a long_name,CLD0,o,c,\"Proportion of Days with Cloud Mask == 0\" ",
127
" -a units,CLD0,o,c,\"Proportion\" ",
128
tsdir,"/MOD06_",tile,"_ymoncld0.nc",sep=""))
129

  
130
## cld == 0|1
131
if(verbose) print("Calculating the proportion of cloudy days")
132
system(paste("cdo -O  sorttimestamp -setyear,",myear," -setday,15 -nint -mulc,100 -ymonmean -lec,1 -selvar,CLD2 ",outdir2,"/MOD06_",tile,"_daily.nc ",tsdir,"/MOD06_",tile,"_ymoncld01.nc",sep=""))
133
system(paste(ncopath,"ncrename -v CLD2,CLD01 ",tsdir,"/MOD06_",tile,"_ymoncld01.nc",sep=""))
134
system(paste(ncopath,"ncatted ",
135
" -a long_name,CLD01,o,c,\"Proportion of Days with Cloud Mask == 0|1\" ",
136
" -a units,CLD01,o,c,\"Proportion\" ",
137
tsdir,"/MOD06_",tile,"_ymoncld01.nc",sep=""))
138

  
139
## cld == 1
140
if(verbose) print("Calculating the proportion of uncertain days")
141
system(paste("cdo -O  sorttimestamp -setyear,",myear," -setday,15 -nint -mulc,100 -ymonmean -eqc,1 -selvar,CLD2 ",outdir2,"/MOD06_",tile,"_daily.nc ",tsdir,"/MOD06_",tile,"_ymoncld1.nc",sep=""))
142
system(paste(ncopath,"ncrename -v CLD2,CLD1 ",tsdir,"/MOD06_",tile,"_ymoncld1.nc",sep=""))
143
system(paste(ncopath,"ncatted ",
144
" -a long_name,CLD1,o,c,\"Proportion of Days with Cloud Mask == 1 (uncertain)\" ",
145
" -a units,CLD1,o,c,\"Proportion\" ",
146
tsdir,"/MOD06_",tile,"_ymoncld1.nc",sep=""))
147

  
148

  
149
## cld >= 2 (setting cld==01 to missing because 'uncertain')
150
if(verbose) print("Calculating the proportion of clear days")
151
system(paste("cdo -O  sorttimestamp -setyear,",myear," -setday,15 -nint -mulc,100 -ymonmean -gtc,1 -setctomiss,1 -selvar,CLD2 ",outdir2,"/MOD06_",tile,"_daily.nc ",tsdir,"/MOD06_",tile,"_ymoncld2.nc",sep=""))
152
system(paste(ncopath,"ncrename -v CLD2,CLD23 ",tsdir,"/MOD06_",tile,"_ymoncld2.nc",sep=""))
153
system(paste(ncopath,"ncatted ",
154
" -a long_name,CLD23,o,c,\"Proportion of Days with Cloud Mask >= 2 (Probably Clear or Certainly Clear)\" ",
155
" -a units,CLD23,o,c,\"Proportion\" ",
156
tsdir,"/MOD06_",tile,"_ymoncld2.nc",sep=""))
157

  
158
## cld >= 1
159
if(verbose) print("Calculating the proportion of clear days")
160
system(paste("cdo -O  sorttimestamp -setyear,",myear," -setday,15 -nint -mulc,100 -ymonmean -gec,1 -selvar,CLD2 ",outdir2,"/MOD06_",tile,"_daily.nc ",tsdir,"/MOD06_",tile,"_ymoncld13.nc",sep=""))
161
system(paste(ncopath,"ncrename -v CLD2,CLD13 ",tsdir,"/MOD06_",tile,"_ymoncld13.nc",sep=""))
162
system(paste(ncopath,"ncatted ",
163
" -a long_name,CLD13,o,c,\"Proportion of Days with Cloud Mask >= 1\" ",
164
" -a units,CLD13,o,c,\"Proportion\" ",
165
tsdir,"/MOD06_",tile,"_ymoncld13.nc",sep=""))
166

  
120 167
## number of observations
168
if(verbose) print("Calculating the number of missing variables")
121 169
system(paste("cdo -O sorttimestamp  -setyear,",myear," -setday,15 -nint -mulc,100 -ymonmean -eqc,9999 -setmisstoc,9999   -selvar,CER,CLD ",outdir2,"/MOD06_",tile,"_daily.nc ",tsdir,"/MOD06_",tile,"_ymonmiss.nc",sep=""))
122 170
system(paste(ncopath,"ncrename -v CER,CER_pmiss -v CLD,CLD_pmiss ",tsdir,"/MOD06_",tile,"_ymonmiss.nc",sep=""))
123 171
system(paste(ncopath,"ncatted ",
......
134 182
system(paste(ncopath,"ncks -O ",tsdir,"/MOD06_",tile,"_ymonmean.nc  ",tsdir,"/MOD06_",tile,"_ymon.nc",sep=""))
135 183
system(paste(ncopath,"ncks -A ",tsdir,"/MOD06_",tile,"_ymonstd.nc  ",tsdir,"/MOD06_",tile,"_ymon.nc",sep=""))
136 184
system(paste(ncopath,"ncks -A ",tsdir,"/MOD06_",tile,"_ymoncer20.nc  ",tsdir,"/MOD06_",tile,"_ymon.nc",sep=""))
185
system(paste(ncopath,"ncks -A ",tsdir,"/MOD06_",tile,"_ymoncld0.nc  ",tsdir,"/MOD06_",tile,"_ymon.nc",sep=""))
186
system(paste(ncopath,"ncks -A ",tsdir,"/MOD06_",tile,"_ymoncld1.nc  ",tsdir,"/MOD06_",tile,"_ymon.nc",sep=""))
187
system(paste(ncopath,"ncks -A ",tsdir,"/MOD06_",tile,"_ymoncld2.nc  ",tsdir,"/MOD06_",tile,"_ymon.nc",sep=""))
137 188
system(paste(ncopath,"ncks -A ",tsdir,"/MOD06_",tile,"_ymonmiss.nc  ",tsdir,"/MOD06_",tile,"_ymon.nc",sep=""))
138 189

  
139 190
## append sinusoidal grid from one of input files as CDO doesn't transfer all attributes
climate/procedures/MOD06_L2_process.r
34 34
     }
35 35

  
36 36

  
37
## default date and tile to play with
37
## default date and tile to play with  (will be overwritten below when running in batch)
38 38
date="20030102"
39 39
tile="h11v08"
40 40
platform="pleiades" 
......
47 47
outdir=paste("daily/",tile,"/",sep="")  #directory for separate daily files
48 48

  
49 49

  
50
if(platform="pleiades"){
50
## get year and doy from date
51
year=format(as.Date(date,"%Y%m%d"),"%Y")
52
doy=format(as.Date(date,"%Y%m%d"),"%j")
53

  
54
if(platform=="pleiades"){
51 55
  ## location of MOD06 files
52
  datadir="/nobackupp4/datapool/modis/MOD06_L2.005/"
56
  datadir=paste("/nobackupp4/datapool/modis/MOD06_L2.005/",year,"/",doy,"/",sep="")
53 57
  ## path to some executables
54 58
  ncopath="/nasa/sles11/nco/4.0.8/gcc/mpt/bin/"
55 59
  swtifpath="/nobackupp1/awilso10/software/heg/bin/swtif"
......
64 68
  projection(td)="+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs +datum=WGS84 +ellps=WGS84 "
65 69
}
66 70

  
67
if(platform="litoria"){  #if running on local server, use different paths
71
if(platform=="litoria"){  #if running on local server, use different paths
68 72
  ## specify working directory
69 73
  setwd("~/acrobates/projects/interp")
70 74
  gisBase="/usr/lib/grass64"
......
97 101
  "Cloud_Effective_Radius_Uncertainty",  "CERU",
98 102
  "Cloud_Optical_Thickness",             "COT",
99 103
  "Cloud_Optical_Thickness_Uncertainty", "COTU",
100
  "Cloud_Water_Path",                    "CWP",
101
  "Cloud_Water_Path_Uncertainty",        "CWPU",
102
  "Cloud_Phase_Optical_Properties",      "CPOP",
103
  "Cloud_Multi_Layer_Flag",              "CMLF",
104
#  "Cloud_Water_Path",                    "CWP",
105
#  "Cloud_Water_Path_Uncertainty",        "CWPU",
106
#  "Cloud_Phase_Optical_Properties",      "CPOP",
107
#  "Cloud_Multi_Layer_Flag",              "CMLF",
104 108
  "Cloud_Mask_1km",                      "CM1",
105 109
  "Quality_Assurance_1km",               "QA"),
106
  byrow=T,ncol=2,dimnames=list(1:10,c("variable","varid"))),stringsAsFactors=F)
110
  byrow=T,ncol=2,dimnames=list(1:6,c("variable","varid"))),stringsAsFactors=F)
107 111

  
108 112
## vector of variables expected to be in final netcdf file.  If these are not present, the file will be deleted at the end.
109 113
finalvars=c("CER","COT","CLD")
......
241 245
                CM_clear_",i," =  ((CM1_",i," / 2^0) % 2) == 1  &&  ((CM1_",i," / 2^1) % 2^2) >  2 
242 246
                CM_path_",i," =   ((CM1_",i," / 2^6) % 2^2) 
243 247
                CM_cloud2_",i," = ((CM1_",i," / 2^1) % 2^2) 
244

  
245 248
EOF",sep=""))
249
     ## Set CM_cloud2 to null if it is "01" (uncertain)
250
#     execGRASS("r.null",map=paste("CM_cloud2_",i,sep=""),setnull="-9999,1")
246 251

  
247 252
    ## QA
248 253
     execGRASS("r.in.gdal",input=paste("HDF4_EOS:EOS_GRID:\"",file,"\":mod06:Quality_Assurance_1km_0",sep=""),
......
309 314
         CER2_denom=",paste("!isnull(CER2_",1:nfs,")",sep="",collapse="+"),"
310 315
         CER2_daily=int(CER2_numer/CER2_denom)
311 316
         CLD_daily=int((max(",paste("if(isnull(CM_cloud_",1:nfs,"),-9999,CM_cloud_",1:nfs,")",sep="",collapse=","),"))) 
317
         CLD2_daily=int((min(",paste("if(isnull(CM_cloud2_",1:nfs,"),-9999,CM_cloud2_",1:nfs,")",sep="",collapse=","),"))) 
312 318
EOF",sep=""))
313
   execGRASS("r.null",map="CLD_daily",setnull="-9999")
319

  
320
execGRASS("r.null",map="CLD_daily",setnull="-9999")
321
execGRASS("r.null",map="CLD2_daily",setnull="-9999")
314 322

  
315 323

  
316 324
  ### Write the files to a netcdf file
317 325
  ## create image group to facilitate export as multiband netcdf
318
    execGRASS("i.group",group="mod06",input=c("CER_daily","CER2_daily","COT_daily","COT2_daily","CLD_daily")) ; print("")
326
    execGRASS("i.group",group="mod06",input=c("CER_daily","CER2_daily","COT_daily","COT2_daily","CLD_daily","CLD2_daily")) ; print("")
319 327
   
320 328
  if(file.exists(ncfile)) file.remove(ncfile)  #if it exists already, delete it
321 329
  execGRASS("r.out.gdal",input="mod06",output=ncfile,type="Int16",nodata=-32768,flags=c("quiet"),
......
339 347
system(paste("ncgen -o ",tempdir(),"/time.nc ",tempdir(),"/time.cdl",sep=""))
340 348
system(paste(ncopath,"ncks -A ",tempdir(),"/time.nc ",ncfile,sep=""))
341 349
## add other attributes
342
  system(paste(ncopath,"ncrename -v Band1,CER -v Band2,CER2 -v Band3,COT -v Band4,COT2 -v Band5,CLD ",ncfile,sep=""))
350
  system(paste(ncopath,"ncrename -v Band1,CER -v Band2,CER2 -v Band3,COT -v Band4,COT2 -v Band5,CLD -v Band6,CLD2 ",ncfile,sep=""))
343 351
  system(paste(ncopath,"ncatted -a scale_factor,CER,o,d,0.01 -a units,CER,o,c,\"micron\" -a missing_value,CER,o,d,-32768 -a long_name,CER,o,c,\"Cloud Particle Effective Radius\" ",ncfile,sep=""))
344 352
  system(paste(ncopath,"ncatted -a scale_factor,CER2,o,d,0.01 -a units,CER2,o,c,\"micron\" -a missing_value,CER2,o,d,-32768 -a long_name,CER2,o,c,\"Cloud Particle Effective Radius with clear sky set to zero\" ",ncfile,sep=""))
345 353

  
346 354
system(paste(ncopath,"ncatted -a scale_factor,COT,o,d,0.01 -a units,COT,o,c,\"none\" -a missing_value,COT,o,d,-32768 -a long_name,COT,o,c,\"Cloud Optical Thickness\" ",ncfile,sep=""))
347 355
system(paste(ncopath,"ncatted -a scale_factor,COT2,o,d,0.01 -a units,COT2,o,c,\"none\" -a missing_value,COT2,o,d,-32768 -a long_name,COT2,o,c,\"Cloud Optical Thickness with clear sky set to zero\" ",ncfile,sep=""))
348
  system(paste(ncopath,"ncatted -a scale_factor,CLD,o,d,0.01 -a units,CLD,o,c,\"none\" -a missing_value,CLD,o,d,-32768 -a long_name,CLD,o,c,\"Cloud Mask\" ",ncfile,sep=""))
349
#  system(paste(ncopath,"ncatted -a sourcecode,global,o,c,",script," ",ncfile,sep=""))
356
  system(paste(ncopath,"ncatted -a scale_factor,CLD,o,d,1 -a units,CLD,o,c,\"none\" -a missing_value,CLD,o,d,-32768 -a long_name,CLD,o,c,\"Cloud Mask\" ",ncfile,sep=""))
357
system(paste(ncopath,"ncatted -a scale_factor,CLD2,o,d,1 -a units,CLD2,o,c,\"none\" -a missing_value,CLD2,o,d,-32768 -a long_name,CLD2,o,c,\"Cloud Mask Flag\" ",ncfile,sep=""))
358

  
359
                                        #  system(paste(ncopath,"ncatted -a sourcecode,global,o,c,",script," ",ncfile,sep=""))
350 360
   
351 361
  
352 362
### delete the temporary files 
climate/procedures/Pleiades.R
1 1
#### Script to facilitate processing of MOD06 data
2
 
2
  
3 3
  setwd("/nobackupp1/awilso10/mod06")
4 4

  
5 5
library(rgdal)
......
10 10
verbose=T
11 11

  
12 12
## get MODLAND tile information
13
txbb=read.table("http://landweb.nascom.nasa.gov/developers/sn_tiles/sn_bound_10deg.txt",skip=6,nrows=648,header=T)
13
tb=read.table("http://landweb.nascom.nasa.gov/developers/sn_tiles/sn_bound_10deg.txt",skip=6,nrows=648,header=T)
14 14
tb$tile=paste("h",sprintf("%02d",tb$ih),"v",sprintf("%02d",tb$iv),sep="")
15 15
save(tb,file="modlandTiles.Rdata")
16 16
load("modlandTiles.Rdata")
......
27 27

  
28 28
### list of tiles to process
29 29
tiles=c("h11v08","h21v09","h08v04","h09v04","h08v05","h09v05","h20v11","h31v11")
30
tiles=tiles[c(5,7,8)]
30
tiles=tiles[1]
31 31
tile_bb=tb[tb$tile%in%tiles,]
32 32

  
33 33
### get list of files to process
......
75 75
## identify which have been completed
76 76
fdone=data.frame(path=list.files(outdir,pattern="nc$",recursive=T))
77 77
fdone$date=substr(basename(as.character(fdone$path)),14,21)
78
fdone$tile=substr(basename(as.character(fdone$path)),14,21)
78
fdone$tile=substr(basename(as.character(fdone$path)),7,12)
79 79

  
80 80
## identify which date-tiles have already been run
81 81
proclist$done=paste(proclist$tile,proclist$date,sep="_")%in%substr(basename(as.character(fdone$path)),7,21)
82 82

  
83 83
### report on what has already been processed
84
print(paste("Overview of completed tile-days (",round(sum(proclist$done)/nrow(proclist),2),"%)"))
84
print(paste(sum(!proclist$done)," out of ",nrow(proclist)," (",round(sum(!proclist$done)/nrow(proclist),2),"%) remain"))
85 85
table(tile=proclist$tile[proclist$done],year=proclist$year[proclist$done])
86 86

  
87

  
88
#updatedone=F #update the "done" list using the 
89
#if(updatedone&exists("fdly")){  #update using table from below
90
#  done[alldates%in%fdly$dateid[fdly$drop]]=F
91
#}
92

  
93
## Identify which dates still need to be processed
94
## This vector will be used to tell mpiexec which days to include
95
#notdone=alldates[!done]  
96

  
97 87
script="/u/awilso10/environmental-layers/climate/procedures/MOD06_L2_process.r"
98
climatescript="/u/awilso10/environmental-layers/climate/procedures/MOD06_Climatology.r"
99 88

  
100 89
## write the table processed by mpiexec
101 90
write.table(paste("--verbose ",script," --date ",proclist$date[!proclist$done]," --verbose T --tile ",proclist$tile[!proclist$done],sep=""),
......
116 105

  
117 106
CORES=400
118 107
HDIR=/u/armichae/pr/
119
  source $HDIR/etc/environ.sh
108
#  source $HDIR/etc/environ.sh
109
  source /u/awilso10/environ.sh
120 110
  source /u/awilso10/.bashrc
121 111
IDIR=/nobackupp1/awilso10/mod06/
122 112
##WORKLIST=$HDIR/var/run/pxrRgrs/work.txt
......
141 131
### Now submit the script to generate the climatologies
142 132

  
143 133
tiles
144
ctiles=tiles[c(1,3)]  #subset to only some tiles (for example if some aren't finished yet)?
134
ctiles=tiles#[c(1,3)]  #subset to only some tiles (for example if some aren't finished yet)?
145 135
climatescript="/u/awilso10/environmental-layers/climate/procedures/MOD06_Climatology.r"
146 136

  
147 137
## write the table processed by mpiexec
148 138
write.table(paste("--verbose ",climatescript," --verbose T --tile ",ctiles,sep=""),
149 139
file=paste("notdone_climate.txt",sep=""),row.names=F,col.names=F,quote=F)
150 140

  
141
## delay start until previous jobs have finished?
142
delay=F
143
## check running jobs to get JobID of job you want to wait for
144
system("qstat -u awilso10")
145
## enter JobID here:
146
job="881394.pbspl1.nas.nasa.gov"
147

  
151 148
### qsub script
152 149
cat(paste("
153 150
#PBS -S /bin/bash
154
#PBS -l select=1:ncpus=8:mpiprocs=8
151
#PBS -l select=50:ncpus=8:mpiprocs=8
155 152
##PBS -l select=2:ncpus=4:mpiprocs=4
156 153
#PBS -l walltime=5:00:00
157 154
#PBS -j n
......
159 156
#PBS -N mod06_climate
160 157
#PBS -q normal
161 158
#PBS -V
159
",if(delay) paste("#PBS -W depend=afterany:",job,sep="")," 
162 160

  
163
CORES=8
161
CORES=400
164 162
HDIR=/u/armichae/pr/
165
  source $HDIR/etc/environ.sh
163
#  source $HDIR/etc/environ.sh
164
  source /u/awilso10/environ.sh
166 165
  source /u/awilso10/.bashrc
167 166
IDIR=/nobackupp1/awilso10/mod06/
168 167
##WORKLIST=$HDIR/var/run/pxrRgrs/work.txt

Also available in: Unified diff