Revision 521e4de1
Added by Benoit Parmentier over 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: 05/26/2015
|
|
8 |
#MODIFIED ON: 07/30/2015
|
|
9 | 9 |
#Version: 4 |
10 | 10 |
#PROJECT: Environmental Layers project |
11 | 11 |
#TO DO: |
... | ... | |
72 | 72 |
#in_dir1 <- "/nobackupp6/aguzman4/climateLayers/output1000x3000_km/" |
73 | 73 |
#in_dir1 <- "/nobackupp6/aguzman4/climateLayers/out_15x45" #PARAM1 |
74 | 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 |
|
|
77 |
region_names <- c("reg4") #selected region names, #PARAM2
|
|
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 |
in_dir1 <- "/nobackupp6/aguzman4/climateLayers/output1500x4500_km/elevTest/"
|
|
78 | 78 |
|
79 |
#region_names <- c("reg4") #selected region names, #PARAM2 |
|
80 |
region_names <- c("1kmBuff","2kmBuff","combined") |
|
79 | 81 |
#region_names <- c("reg1","reg2","reg3","reg4","reg5","reg6") #selected region names, #PARAM2 |
80 | 82 |
#region_namesb <- c("reg_1b","reg_1c","reg_2b","reg_3b","reg_6b") #selected region names, #PARAM2 |
81 | 83 |
|
82 | 84 |
y_var_name <- "dailyTmax" #PARAM3 |
83 | 85 |
interpolation_method <- c("gam_CAI") #PARAM4 |
84 |
out_prefix<-"run10_1500x4500_global_analyses_pred_2010_05262015" #PARAM5 |
|
86 |
out_prefix<-"run10_1500x4500_global_analyses_pred_2010_testelev_07302015" #PARAM5 |
|
87 |
|
|
85 | 88 |
#output_run10_1500x4500_global_analyses_pred_2003_04102015/ |
86 | 89 |
|
87 | 90 |
#out_dir<-"/data/project/layers/commons/NEX_data/" #On NCEAS Atlas |
... | ... | |
93 | 96 |
CRS_locs_WGS84 <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84, #PARAM8 |
94 | 97 |
|
95 | 98 |
#day_to_mosaic <- c("20100101","20100901") #PARAM9 |
96 |
day_to_mosaic <- c("20100829","20100830","20100831", |
|
97 |
"20100901","20100902","20100903") |
|
99 |
#day_to_mosaic <- c("20100829","20100830","20100831",
|
|
100 |
# "20100901","20100902","20100903")
|
|
98 | 101 |
|
99 | 102 |
#day_to_mosaic <- NULL #if day to mosaic is null then mosaic all dates? |
100 | 103 |
|
... | ... | |
127 | 130 |
in_dir_list_all <- lapply(in_dir_list,function(x){list.dirs(path=x,recursive=F)}) |
128 | 131 |
in_dir_list <- unlist(in_dir_list_all) |
129 | 132 |
#in_dir_list <- in_dir_list[grep("bak",basename(basename(in_dir_list)),invert=TRUE)] #the first one is the in_dir1 |
130 |
in_dir_subset <- in_dir_list[grep("subset",basename(in_dir_list),invert=FALSE)] #select directory with shapefiles... |
|
133 |
|
|
134 |
#this was changed |
|
135 |
in_dir_list_tmp <- list.dirs(path=in_dir1,recursive=FALSE) #get the list regions processed for this run |
|
136 |
in_dir_subset <- in_dir_list_tmp[grep("subset",basename(in_dir_list_tmp),invert=FALSE)] #select directory with shapefiles... |
|
131 | 137 |
in_dir_shp <- file.path(in_dir_subset,"shapefiles") |
132 | 138 |
|
133 | 139 |
#select only directories used for predictions |
... | ... | |
135 | 141 |
#in_dir_reg <- in_dir_list[grep("july_tiffs",basename(in_dir_reg),invert=TRUE)] #select directory with shapefiles... |
136 | 142 |
in_dir_list <- in_dir_reg |
137 | 143 |
|
144 |
|
|
138 | 145 |
in_dir_list <- in_dir_list[grep("bak",basename(basename(in_dir_list)),invert=TRUE)] #the first one is the in_dir1 |
139 | 146 |
#list of shapefiles used to define tiles |
140 | 147 |
in_dir_shp_list <- list.files(in_dir_shp,".shp",full.names=T) |
... | ... | |
182 | 189 |
|
183 | 190 |
##raster_prediction object : contains testing and training stations with RMSE and model object |
184 | 191 |
|
192 |
|
|
185 | 193 |
list_raster_obj_files <- lapply(in_dir_list,FUN=function(x){list.files(path=x,pattern="^raster_prediction_obj.*.RData",full.names=T)}) |
186 | 194 |
basename(dirname(list_raster_obj_files[[1]])) |
187 | 195 |
list_names_tile_coord <- lapply(list_raster_obj_files,FUN=function(x){basename(dirname(x))}) |
Also available in: Unified diff
assessment part1 with differnt mask and buffer