Revision b46ff3f7
Added by Benoit Parmentier almost 9 years ago
climate/research/oregon/interpolation/global_run_scalingup_assessment_part1.R | ||
---|---|---|
5 | 5 |
#Part 1 create summary tables and inputs files for figure in part 2 and part 3. |
6 | 6 |
#AUTHOR: Benoit Parmentier |
7 | 7 |
#CREATED ON: 03/23/2014 |
8 |
#MODIFIED ON: 10/05/2015
|
|
8 |
#MODIFIED ON: 12/07/2015
|
|
9 | 9 |
#Version: 4 |
10 | 10 |
#PROJECT: Environmental Layers project |
11 | 11 |
#TO DO: |
... | ... | |
15 | 15 |
# |
16 | 16 |
#First source these files: |
17 | 17 |
#Resolved call issues from R. |
18 |
#source /nobackupp6/aguzman4/climateLayers/sharedModules/etc/environ.sh
|
|
18 |
#source /nobackupp6/aguzman4/climateLayers/sharedModules2/etc/environ.sh
|
|
19 | 19 |
#MODULEPATH=$MODULEPATH:/nex/modules/files |
20 | 20 |
#module load pythonkits/gdal_1.10.0_python_2.7.3_nex |
21 | 21 |
|
... | ... | |
69 | 69 |
#Make this a function |
70 | 70 |
#reg1 (North Am), reg2(Europe),reg3(Asia), reg4 (South Am), reg5 (Africa), reg6 (Australia-Asia) |
71 | 71 |
#master directory containing the definition of tile size and tiles predicted |
72 |
#in_dir1 <- "/nobackupp6/aguzman4/climateLayers/output1000x3000_km/" |
|
73 |
#in_dir1 <- "/nobackupp6/aguzman4/climateLayers/out_15x45" #PARAM1 |
|
74 |
#in_dir1b <- "/nobackupp6/aguzman4/climateLayers/output1500x4500_km/singles" #PARAM1, add for now in_dir1 can be a list... |
|
75 |
#in_dir1 <- "/nobackupp6/aguzman4/climateLayers/output1500x4500_km/" #PARAM1, add for now in_dir1 can be a list... |
|
76 |
#in_dir1 <- "/nobackupp6/aguzman4/climateLayers/output1500x4500_km/elevTest/1kmBuff/" |
|
77 | 72 |
in_dir1 <- "/nobackupp6/aguzman4/climateLayers/out_15x45/" |
78 | 73 |
#/nobackupp6/aguzman4/climateLayers/out_15x45/1982 |
79 | 74 |
|
80 |
region_names <- c("reg4") #selected region names, #PARAM2
|
|
75 |
region_names <- c("reg23","reg4") #selected region names, #PARAM2
|
|
81 | 76 |
#region_names <- c("1992") #no specific region here so use date |
82 | 77 |
#region_names <- c("reg1","reg2","reg3","reg4","reg5","reg6") #selected region names, #PARAM2 |
83 | 78 |
#region_namesb <- c("reg_1b","reg_1c","reg_2b","reg_3b","reg_6b") #selected region names, #PARAM2 |
84 | 79 |
|
85 | 80 |
y_var_name <- "dailyTmax" #PARAM3 |
86 | 81 |
interpolation_method <- c("gam_CAI") #PARAM4 |
87 |
out_prefix<-"run10_1500x4500_global_analyses_pred_1992_10052015" #PARAM5
|
|
82 |
out_prefix<-"run10_1500x4500_global_analyses_pred_1992_12072015" #PARAM5
|
|
88 | 83 |
|
89 | 84 |
#output_run10_1500x4500_global_analyses_pred_2003_04102015/ |
90 | 85 |
|
... | ... | |
96 | 91 |
|
97 | 92 |
CRS_locs_WGS84 <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84, #PARAM8 |
98 | 93 |
|
99 |
#day_to_mosaic <- c("20100101","20100901") #PARAM9 |
|
100 |
#day_to_mosaic <- c("20100829","20100830","20100831", |
|
101 |
# "20100901","20100902","20100903") |
|
102 |
day_to_mosaic <- c("19920101","19920102","19920103") |
|
103 |
#,"19820104","19820105", |
|
104 |
# "19820106","19820107","19820108","19820109","19820110", |
|
105 |
# "19820111") |
|
94 |
day_to_mosaic <- c("19920101","19920102","19920103,19920104,19920105") |
|
95 |
|
|
106 | 96 |
|
107 | 97 |
#day_to_mosaic <- NULL #if day to mosaic is null then mosaic all dates? |
108 | 98 |
|
... | ... | |
156 | 146 |
in_dir_shp_list <- list.files(in_dir_shp,".shp",full.names=T) |
157 | 147 |
|
158 | 148 |
## load problematic tiles or additional runs |
159 |
|
|
160 |
#in_dir_listb <- list.dirs(path=in_dir1b,recursive=FALSE) #get the list regions processed for this run |
|
161 |
#basename(in_dir_list) |
|
162 |
#in_dir_listb<- lapply(region_namesb,FUN=function(x,y){y[grep(x,basename(y),invert=FALSE)]},y=in_dir_listb) |
|
163 |
|
|
164 |
#in_dir_list_allb <- lapply(in_dir_listb,function(x){list.dirs(path=x,recursive=F)}) |
|
165 |
#in_dir_listb <- unlist(in_dir_list_allb) |
|
166 |
#in_dir_list <- in_dir_list[grep("bak",basename(basename(in_dir_list)),invert=TRUE)] #the first one is the in_dir1 |
|
167 |
#in_dir_subsetb <- in_dir_listb[grep("subset",basename(in_dir_listb),invert=FALSE)] #select directory with shapefiles... |
|
168 |
#in_dir_shpb <- file.path(in_dir_subsetb,"shapefiles") |
|
169 |
|
|
170 |
#select only directories used for predictions |
|
171 |
#in_dir_regb <- in_dir_listb[grep(".*._.*.",basename(in_dir_listb),invert=FALSE)] #select directory with shapefiles... |
|
172 |
#in_dir_reg <- in_dir_list[grep("july_tiffs",basename(in_dir_reg),invert=TRUE)] #select directory with shapefiles... |
|
173 |
#in_dir_listb <- in_dir_regb |
|
174 |
|
|
175 |
#in_dir_listb <- in_dir_listb[grep("bak",basename(basename(in_dir_listb)),invert=TRUE)] #the first one is the in_dir1 |
|
176 |
#list of shapefiles used to define tiles |
|
177 |
#in_dir_shp_listb <- list.files(in_dir_shpb,".shp",full.names=T) |
|
178 |
|
|
179 |
|
|
180 |
#### Combine now... |
|
181 |
|
|
182 |
#in_dir_list <- c(in_dir_list,in_dir_listb) |
|
183 |
#in_dir_reg <- c(in_dir_reg,in_dir_regb) |
|
184 |
#in_dir_shp <- c(in_dir_shp,in_dir_shpb) |
|
185 |
#in_dir_shp_list <- c(in_dir_shp_list,in_dir_shp_listb) |
|
186 |
#in_dir_list <- c(in_dir_list,in_dir_listb) |
|
149 |
#modify later... |
|
187 | 150 |
|
188 | 151 |
#system("ls /nobackup/bparmen1") |
189 | 152 |
|
... | ... | |
535 | 498 |
###################################################### |
536 | 499 |
####### PART 2 CREATE MOSAIC OF PREDICTIONS PER DAY, Delta surfaces and clim ### |
537 | 500 |
|
501 |
#if mosaicing_tiles==TRUE then do it? |
|
538 | 502 |
#dates_l <- unique(robj1$tb_diagnostic_s$date) #list of dates to query tif |
539 | 503 |
#create date!!! |
540 | 504 |
if(is.null(day_to_mosaic)){ |
Also available in: Unified diff
assessment part 1 prediction 1992 for reg23