Revision 12e420f4
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/05/2015
|
|
8 |
#MODIFIED ON: 02/09/2015
|
|
9 | 9 |
#Version: 4 |
10 | 10 |
#PROJECT: Environmental Layers project |
11 | 11 |
#TO DO: |
12 | 12 |
# - generate delta and clim mosaic |
13 | 13 |
# - clean up |
14 | 14 |
|
15 |
#First source file:
|
|
15 |
#First source these files:
|
|
16 | 16 |
#source /nobackupp4/aguzman4/climateLayers/sharedModules/etc/environ.sh |
17 | 17 |
#MODULEPATH=$MODULEPATH:/nex/modules/files |
18 | 18 |
#module load /nex/modules/files/pythonkits/gdal_1.10.0_python_2.7.3_nex |
... | ... | |
55 | 55 |
|
56 | 56 |
#### FUNCTION USED IN SCRIPT |
57 | 57 |
|
58 |
#function_analyses_paper1 <-"contribution_of_covariates_paper_interpolation_functions_07182014.R" #first interp paper |
|
59 |
#function_analyses_paper2 <-"multi_timescales_paper_interpolation_functions_08132014.R" |
|
60 |
function_analyses_paper1 <-"multi_timescales_paper_interpolation_functions_08132014.R" |
|
61 |
|
|
62 |
load_obj <- function(f) |
|
63 |
{ |
|
64 |
env <- new.env() |
|
65 |
nm <- load(f, env)[1] |
|
66 |
env[[nm]] |
|
67 |
} |
|
68 |
|
|
69 |
create_dir_fun <- function(out_dir,out_suffix){ |
|
70 |
if(!is.null(out_suffix)){ |
|
71 |
out_name <- paste("output_",out_suffix,sep="") |
|
72 |
out_dir <- file.path(out_dir,out_name) |
|
73 |
} |
|
74 |
#create if does not exists: create the output dir as defined |
|
75 |
if(!file.exists(out_dir)){ |
|
76 |
dir.create(out_dir) |
|
77 |
} |
|
78 |
return(out_dir) |
|
79 |
} |
|
80 |
|
|
58 |
function_analyses_paper1 <- "global_run_scalingup_assessment_part1_functions_02052015.R" |
|
59 |
script_path <- "/nobackupp8/bparmen1/env_layers_scripts" #path to script |
|
60 |
source(file.path(script_path,function_analyses_paper1)) #source all functions used in this script |
|
81 | 61 |
|
82 | 62 |
|
83 | 63 |
############################## |
... | ... | |
85 | 65 |
|
86 | 66 |
#reg1 (North Am), reg2(Europe),reg3(Asia), reg4 (South Am), reg5 (Africa), reg6 (Australia-Asia) |
87 | 67 |
#master directory containing the definition of tile size and tiles predicted |
88 |
in_dir1 <- "/nobackupp6/aguzman4/climateLayers/output1000x3000_km/" |
|
68 |
#in_dir1 <- "/nobackupp6/aguzman4/climateLayers/output1000x3000_km/" |
|
69 |
in_dir1 <- "/nobackupp6/aguzman4/climateLayers/output1500x4500_km" |
|
89 | 70 |
|
90 |
region_names <- c("reg1") #selected region names |
|
71 |
region_names <- c("reg1","reg2","reg3","reg4","reg5","reg6") #selected region names
|
|
91 | 72 |
|
92 | 73 |
in_dir_list <- list.dirs(path=in_dir1,recursive=FALSE) #get the list regions processed for this run |
93 | 74 |
#basename(in_dir_list) |
... | ... | |
116 | 97 |
|
117 | 98 |
y_var_name <- "dailyTmax" |
118 | 99 |
interpolation_method <- c("gam_CAI") |
119 |
out_prefix<-"run10_global_analyses_01282015"
|
|
100 |
out_prefix<-"run10_1500x4500_global_analyses_02092015"
|
|
120 | 101 |
|
121 | 102 |
#out_dir<-"/data/project/layers/commons/NEX_data/" #On NCEAS Atlas |
122 |
out_dir <- "/nobackup/bparmen1/" #on NEX |
|
123 |
#out_dir <- "/nobackupp8/bparmen1/" #
|
|
103 |
#out_dir <- "/nobackup/bparmen1/" #on NEX
|
|
104 |
out_dir <- "/nobackupp8/bparmen1/" # |
|
124 | 105 |
#out_dir <-paste(out_dir,"_",out_prefix,sep="") |
125 | 106 |
create_out_dir_param <- TRUE |
126 | 107 |
|
... | ... | |
345 | 326 |
write.table(df_tile_processed, |
346 | 327 |
file=file.path(out_dir,paste("df_tile_processed_",out_prefix,".txt",sep="")),sep=",") |
347 | 328 |
|
329 |
df_tiles_all <- as.data.frame(as.character(unlist(list_shp_world))) |
|
330 |
names(df_tiles_all) <- "list_shp_world" |
|
331 |
write.table(df_tiles_all, |
|
332 |
file=file.path(out_dir,paste("df_tiles_all_",out_prefix,".txt",sep="")),sep=",") |
|
333 |
|
|
334 |
#Copy to local home directory on NAS-NEX |
|
335 |
# |
|
336 |
dir.create(file.path(out_dir,"shapefiles")) |
|
337 |
file.copy(list_shp_world,file.path(out_dir,"shapefiles")) |
|
338 |
|
|
339 |
#save a list of all files... |
|
340 |
write.table(df_tiles_all, |
|
341 |
file=file.path(out_dir,"shapefiles",paste("df_tiles_all_",out_prefix,".txt",sep="")),sep=",") |
|
342 |
|
|
348 | 343 |
###################################################### |
349 | 344 |
####### PART 2 CREATE MOSAIC OF PREDICTIONS PER DAY, Delta surfaces and clim ### |
350 | 345 |
|
Also available in: Unified diff
examining available output for 1500x4500km