Revision 0488d027
Added by Benoit Parmentier over 9 years ago
climate/research/oregon/interpolation/global_run_scalingup_assessment_part2.R | ||
---|---|---|
5 | 5 |
#Analyses, figures, tables and data are also produced in the script. |
6 | 6 |
#AUTHOR: Benoit Parmentier |
7 | 7 |
#CREATED ON: 03/23/2014 |
8 |
#MODIFIED ON: 05/26/2015
|
|
8 |
#MODIFIED ON: 07/30/2015
|
|
9 | 9 |
#Version: 4 |
10 | 10 |
#PROJECT: Environmental Layers project |
11 | 11 |
#COMMENTS: analyses for run 10 global analyses,all regions 1500x4500km with additional tiles to increase overlap |
... | ... | |
381 | 381 |
interpolation_method <- c("gam_CAI") #PARAM2 |
382 | 382 |
#out_suffix<-"run10_global_analyses_01282015" |
383 | 383 |
#out_suffix <- "output_run10_1000x3000_global_analyses_02102015" |
384 |
out_suffix <- "run10_1500x4500_global_analyses_pred_2010_05262015" #PARAM3
|
|
385 |
out_dir <- "/data/project/layers/commons/NEX_data/output_run10_1500x4500_global_analyses_pred_2010_05262015" #PARAM4
|
|
384 |
out_suffix <- "run10_1500x4500_global_analyses_pred_2010_testelev_07302015" #PARAM3
|
|
385 |
out_dir <- "/data/project/layers/commons/NEX_data/output_run10_1500x4500_global_analyses_pred_2010_testelev_07302015" #PARAM4
|
|
386 | 386 |
create_out_dir_param <- FALSE #PARAM 5 |
387 | 387 |
|
388 | 388 |
mosaic_plot <- FALSE #PARAM6 |
... | ... | |
401 | 401 |
NA_flag_val <- NA_value |
402 | 402 |
|
403 | 403 |
tile_size <- "1500x4500" #PARAM 11 |
404 |
mulitple_region <- TRUE #PARAM 12
|
|
404 |
multiple_region <- TRUE #PARAM 12
|
|
405 | 405 |
|
406 | 406 |
region_name <- "world" #PARAM 13 |
407 | 407 |
plot_region <- TRUE |
... | ... | |
451 | 451 |
|
452 | 452 |
|
453 | 453 |
#multiple regions? |
454 |
if(mulitple_region==TRUE){
|
|
454 |
if(multiple_region==TRUE){
|
|
455 | 455 |
df_tile_processed$reg <- basename(dirname(as.character(df_tile_processed$path_NEX))) |
456 | 456 |
|
457 | 457 |
tb <- merge(tb,df_tile_processed,by="tile_id") |
... | ... | |
980 | 980 |
|
981 | 981 |
#get the files |
982 | 982 |
l_reg_name <- unique(df_tile_processed$reg) |
983 |
l_reg_name <- c("reg5") |
|
983 |
#l_reg_name <- c("reg5")
|
|
984 | 984 |
#lf_mosaics_reg5 <- mixedsort(list.files(path="/data/project/layers/commons/NEX_data/output_run10_global_analyses_11302014/mosaics/reg5", |
985 | 985 |
# pattern="CAI_TMAX_clim_month_.*_mod1_all.tif", full.names=T)) |
986 | 986 |
lf_mosaics_reg <- vector("list",length=length(l_reg_name)) |
... | ... | |
1066 | 1066 |
|
1067 | 1067 |
lf_world_pred <-list.files(path=file.path(out_dir,"mosaics"), |
1068 | 1068 |
pattern=paste("^reg4.*.",".tif$",sep=""),full.names=T) |
1069 |
l_reg_name <- unique(df_tile_processed$reg) |
|
1070 |
lf_world_pred <-list.files(path=file.path(out_dir,l_reg_name[[i]]), |
|
1071 |
pattern=paste(".tif$",sep=""),full.names=T) |
|
1069 | 1072 |
|
1070 | 1073 |
#mosaic_list_mean <- test_list |
1071 | 1074 |
#out_rastnames <- "world_test_mosaic_20100101" |
... | ... | |
1120 | 1123 |
#lf_world_mask_reg[[i]] <- mclapply(1:length(lf_m),FUN=plot_daily_mosaics,list_param=list_param_plot_daily_mosaics,mc.preschedule=FALSE,mc.cores = 10) |
1121 | 1124 |
} |
1122 | 1125 |
|
1126 |
############# NEW MASK AND DATA |
|
1127 |
## Plot areas and day predicted as first check |
|
1128 |
|
|
1129 |
l_reg_name <- unique(df_tile_processed$reg) |
|
1130 |
#(subset(df_tile_processed$reg == l_reg_name[i],date) |
|
1131 |
|
|
1132 |
for(i in 1:length(l_reg_name)){ |
|
1133 |
lf_world_pred <-list.files(path=file.path(out_dir,l_reg_name[[i]]), |
|
1134 |
pattern=paste(".tif$",sep=""),full.names=T) |
|
1135 |
|
|
1136 |
#mosaic_list_mean <- test_list |
|
1137 |
#out_rastnames <- "world_test_mosaic_20100101" |
|
1138 |
#out_path <- out_dir |
|
1139 |
|
|
1140 |
#lf_world_pred <- list.files(pattern="world.*2010090.*.tif$") |
|
1141 |
#lf_raster_fname <- list.files(pattern="world.*2010*.*02162015.tif$",full.names=T) |
|
1142 |
lf_raster_fname <- lf_world_pred |
|
1143 |
prefix_str <- paste("Figure10_",l_reg_name[i],sep="") |
|
1144 |
|
|
1145 |
l_dates <- basename(lf_raster_fname) |
|
1146 |
tmp_name <- gsub(".tif","",l_dates) |
|
1147 |
tmp_name <- gsub("gam_CAI_dailyTmax_predicted_mod1_0_1_","",tmp_name) |
|
1148 |
#l_dates <- tmp_name |
|
1149 |
l_dates <- paste(l_reg_name[i],"_",tmp_name,sep="") |
|
1150 |
|
|
1151 |
screenRast=TRUE |
|
1152 |
list_param_plot_screen_raster <- list(lf_raster_fname,screenRast,l_dates,out_dir,prefix_str,out_suffix) |
|
1153 |
names(list_param_plot_screen_raster) <- c("lf_raster_fname","screenRast","l_dates","out_dir_str","prefix_str","out_suffix_str") |
|
1154 |
|
|
1155 |
#undebug(plot_screen_raster_val) |
|
1156 |
|
|
1157 |
#world_m_list1<- plot_screen_raster_val(1,list_param_plot_screen_raster) |
|
1158 |
#world_m_list <- mclapply(11:30, list_param=list_param_plot_screen_raster, plot_screen_raster_val,mc.preschedule=FALSE,mc.cores = num_cores) #This is the end bracket from mclapply(...) statement |
|
1159 |
world_m_list <- mclapply(1:length(l_dates), list_param=list_param_plot_screen_raster, plot_screen_raster_val,mc.preschedule=FALSE,mc.cores = num_cores) #This is the end bracket from mclapply(...) statement |
|
1160 |
|
|
1161 |
#s_pred <- stack(lf_raster_fname) |
|
1162 |
|
|
1163 |
#res_pix <- 1500 |
|
1164 |
#col_mfrow <- 3 |
|
1165 |
#row_mfrow <- 2 |
|
1166 |
|
|
1167 |
#png(filename=paste("Figure10_levelplot_combined_",region_name,"_",out_suffix,".png",sep=""), |
|
1168 |
# width=col_mfrow*res_pix,height=row_mfrow*res_pix) |
|
1169 |
|
|
1170 |
#levelplot(s_pred,layers=1:6,col.regions=rev(terrain.colors(255)),cex=4) |
|
1171 |
|
|
1172 |
#dev.off() |
|
1173 |
} |
|
1174 |
|
|
1175 |
|
|
1176 |
|
|
1123 | 1177 |
##################### END OF SCRIPT ###################### |
Also available in: Unified diff
assessment part2 with new mask and buffer being evaluated