Revision ed15fe32
Added by Benoit Parmentier almost 10 years ago
climate/research/oregon/interpolation/global_run_scalingup_assessment_part1.R | ||
---|---|---|
5 | 5 |
#Part 1 create summary tables and inputs for figure in part 2 and part 3. |
6 | 6 |
#AUTHOR: Benoit Parmentier |
7 | 7 |
#CREATED ON: 03/23/2014 |
8 |
#MODIFIED ON: 02/10/2015
|
|
8 |
#MODIFIED ON: 02/16/2015
|
|
9 | 9 |
#Version: 4 |
10 | 10 |
#PROJECT: Environmental Layers project |
11 | 11 |
#TO DO: |
... | ... | |
55 | 55 |
|
56 | 56 |
#### FUNCTION USED IN SCRIPT |
57 | 57 |
|
58 |
function_analyses_paper1 <- "global_run_scalingup_assessment_part1_functions_02052015.R"
|
|
58 |
function_analyses_paper1 <- "global_run_scalingup_assessment_part1_functions_02112015.R"
|
|
59 | 59 |
script_path <- "/nobackupp8/bparmen1/env_layers_scripts" #path to script |
60 | 60 |
source(file.path(script_path,function_analyses_paper1)) #source all functions used in this script |
61 | 61 |
|
... | ... | |
69 | 69 |
in_dir1 <- "/nobackupp6/aguzman4/climateLayers/output1000x3000_km" |
70 | 70 |
|
71 | 71 |
region_names <- c("reg1","reg2","reg3","reg4","reg5","reg6") #selected region names |
72 |
region_names <- c("reg1","reg2","reg3b","reg4","reg5","reg6") #selected region names |
|
72 |
#region_names <- c("reg1","reg2","reg3b","reg4","reg5","reg6") #selected region names
|
|
73 | 73 |
|
74 | 74 |
in_dir_list <- list.dirs(path=in_dir1,recursive=FALSE) #get the list regions processed for this run |
75 | 75 |
#basename(in_dir_list) |
... | ... | |
98 | 98 |
|
99 | 99 |
y_var_name <- "dailyTmax" |
100 | 100 |
interpolation_method <- c("gam_CAI") |
101 |
out_prefix<-"run10_1000x3000_global_analyses_02102015"
|
|
101 |
out_prefix<-"run10_1000x3000_global_analyses_02162015"
|
|
102 | 102 |
|
103 | 103 |
#out_dir<-"/data/project/layers/commons/NEX_data/" #On NCEAS Atlas |
104 | 104 |
#out_dir <- "/nobackup/bparmen1/" #on NEX |
... | ... | |
403 | 403 |
### Now find out how many files were predicted |
404 | 404 |
# will be useful later on |
405 | 405 |
|
406 |
#sh /nobackupp6/aguzman4/climateLayers/sharedCode/shMergeFromFile.sh list_mosaics_20100901.txt world_mosaics_1000x3000_20100901.tif |
|
407 |
|
|
408 |
for (i in 1:length(day_to_mosaic)){ |
|
409 |
pattern_str <- paste("*.",day_to_mosaic[i],".*.tif",sep="") |
|
410 |
lf_day_to_mosaic <- list.files(path=out_dir,pattern=pattern_str,full.names=T) |
|
411 |
#write.table(lf_day_to_mosaic,file=file.path(out_dir,paste("list_to_mosaics_",day_to_mosaic[i],".txt",sep=""))) |
|
412 |
writeLines(lf_day_to_mosaic,con=file.path(out_dir,paste("list_to_mosaics_",day_to_mosaic[i],".txt",sep=""))) |
|
413 |
in_file_to_mosaics <- file.path(out_dir,paste("list_to_mosaics_",day_to_mosaic[i],".txt",sep="")) |
|
414 |
#in_dir_mosaics <- file.path(in_dir1,region_names[i]) |
|
415 |
#out_dir_mosaics <- "/nobackupp6/aguzman4/climateLayers/output1000x3000_km/reg5/mosaicsMean" |
|
416 |
#Can be changed to have mosaics in different dir.. |
|
417 |
#out_dir_mosaics <- out_dir |
|
418 |
#prefix_str <- "reg4_1500x4500" |
|
419 |
#tile_size <- basename(dirname(in_dir[[i]])) |
|
420 |
tile_size <- basename(in_dir1) |
|
421 |
|
|
422 |
#prefix_str <- paste(region_names[i],"_",tile_size,sep="") |
|
423 |
mod_str <- "mod1" #use mod2 which corresponds to model with LST and elev |
|
424 |
out_mosaic_name <- paste("world_mosaics_",mod_str,"_",tile_size,"_",day_to_mosaic[i],"_",out_prefix,".tif",sep="") |
|
425 |
module_path <- "/nobackupp6/aguzman4/climateLayers/sharedCode" |
|
426 |
cmd_str <- paste("sh", file.path(module_path,"shMergeFromFile.sh"), |
|
427 |
in_file_to_mosaics, |
|
428 |
out_mosaic_name, |
|
429 |
sep=" ") |
|
430 |
system(cmd_str) |
|
431 |
|
|
432 |
} |
|
433 |
|
|
406 | 434 |
###################################################### |
407 | 435 |
####### PART 3: EXAMINE STATIONS AND MODEL FITTING ### |
408 | 436 |
|
Also available in: Unified diff
NEX part1 accuracy assessment mosaicing for 1000x3000km with python code