Revision 4683cbb4
Added by Benoit Parmentier about 8 years ago
climate/research/oregon/interpolation/global_product_assessment_part1.R | ||
---|---|---|
4 | 4 |
#Combining tables and figures for individual runs for years and tiles. |
5 | 5 |
#AUTHOR: Benoit Parmentier |
6 | 6 |
#CREATED ON: 05/15/2016 |
7 |
#MODIFIED ON: 07/30/2016
|
|
7 |
#MODIFIED ON: 08/28/2016
|
|
8 | 8 |
#Version: 1 |
9 | 9 |
#PROJECT: Environmental Layers project |
10 | 10 |
#COMMENTS: Initial commit, script based on part NASA biodiversity conferenc |
... | ... | |
118 | 118 |
|
119 | 119 |
#reg1 (North Am), reg2(Europe),reg3(Asia), reg4 (South Am), reg5 (Africa), reg6 (Australia-Asia) |
120 | 120 |
#master directory containing the definition of tile size and tiles predicted |
121 |
in_dir <- "/data/project/layers/commons/NEX_data/climateLayers/out/reg5/assessment" |
|
122 |
in_dir_mosaic <- "/data/project/layers/commons/NEX_data/climateLayers/out/reg5/mosaic/mosaic" |
|
121 |
#in_dir <- "/data/project/layers/commons/NEX_data/climateLayers/out/reg5/assessment" |
|
122 |
#in_dir_mosaic <- "/data/project/layers/commons/NEX_data/climateLayers/out/reg5/mosaic/mosaic" |
|
123 |
in_dir <- "/data/project/layers/commons/NEX_data/climateLayers/out/reg1/assessment" |
|
124 |
in_dir_mosaic <- "/data/project/layers/commons/NEX_data/climateLayers/out/reg1/mosaic/mosaic" |
|
123 | 125 |
|
124 |
region_name <- c("reg5") #param 6, arg 3
|
|
125 |
out_suffix <- "_global_assessment_reg5_07292016"
|
|
126 |
region_name <- c("reg1") #param 6, arg 3
|
|
127 |
out_suffix <- "_global_assessment_reg1_08282016"
|
|
126 | 128 |
|
127 | 129 |
create_out_dir_param <- TRUE #param 9, arg 6 |
128 | 130 |
|
129 | 131 |
|
130 |
out_dir <- "/data/project/layers/commons/NEX_data/climateLayers/out/reg5/assessment"
|
|
132 |
out_dir <- "/data/project/layers/commons/NEX_data/climateLayers/out/reg1/assessment"
|
|
131 | 133 |
|
132 | 134 |
#run_figure_by_year <- TRUE # param 10, arg 7 |
133 | 135 |
|
... | ... | |
144 | 146 |
day_end <- "19981231" #PARAM 13 arg 13 |
145 | 147 |
|
146 | 148 |
#infile_mask <- "/nobackupp8/bparmen1/NEX_data/regions_input_files/r_mask_LST_reg4.tif" |
147 |
infile_mask <- "/data/project/layers/commons/NEX_data/regions_input_files/r_mask_LST_reg5.tif" |
|
149 |
#infile_mask <- "/data/project/layers/commons/NEX_data/regions_input_files/r_mask_LST_reg5.tif" |
|
150 |
infile_mask <- "/data/project/layers/commons/NEX_data/regions_input_files/r_mask_LST_reg1.tif" |
|
148 | 151 |
|
149 | 152 |
#run_figure_by_year <- TRUE # param 10, arg 7 |
150 | 153 |
list_year_predicted <- "1984,2014" |
151 | 154 |
scaling <- 0.01 #was scaled on 100 |
152 | 155 |
#if scaling is null then perform no scaling!! |
153 | 156 |
|
154 |
df_centroids_fname <- "/data/project/layers/commons/NEX_data/climateLayers/out/reg4/mosaic/output_reg5_1999/df_centroids_19990701_reg5_1999.txt" |
|
157 |
#df_centroids_fname <- "/data/project/layers/commons/NEX_data/climateLayers/out/reg4/mosaic/output_reg5_1999/df_centroids_19990701_reg5_1999.txt" |
|
158 |
df_centroids_fname <- "/data/project/layers/commons/NEX_data/climateLayers/out/reg1/mosaic/output_reg1_1984/df_centroids_19840101_reg1_1984.txt" |
|
159 |
#/nobackupp6/aguzman4/climateLayers/out/reg1/assessment//output_reg1_1984/df_assessment_files_reg1_1984_reg1_1984.txt |
|
155 | 160 |
|
156 | 161 |
raster_name_lf <- c("/data/project/layers/commons/NEX_data/climateLayers/out/reg5/mosaic/int_mosaics/comp_r_m_use_edge_weights_weighted_mean_gam_CAI_dailyTmax_19920101_reg4_1992_m_gam_CAI_dailyTmax_19920101_reg4_1992.tif", |
157 | 162 |
"/data/project/layers/commons/NEX_data/climateLayers/out/reg5/mosaic/int_mosaics/comp_r_m_use_edge_weights_weighted_mean_gam_CAI_dailyTmax_19920102_reg4_1992_m_gam_CAI_dailyTmax_19920102_reg4_1992.tif", |
... | ... | |
161 | 166 |
"/data/project/layers/commons/NEX_data/climateLayers/out/reg5/mosaic/int_mosaics/comp_r_m_use_edge_weights_weighted_mean_gam_CAI_dailyTmax_19920703_reg4_1992_m_gam_CAI_dailyTmax_19920703_reg4_1992.tif") |
162 | 167 |
|
163 | 168 |
#l_dates <- c("19990101","19990102","19990103","19990701","19990702","19990703") |
164 |
l_dates <- c("19910110","19910111","19910112","19910113","19910114") #dates to plot and analze
|
|
169 |
l_dates <- c("19840110","19840111","19840112","19840113","19840114") #dates to plot and analze
|
|
165 | 170 |
|
166 |
df_points_extracted_fname <- "/data/project/layers/commons/NEX_data/climateLayers/out/reg5/mosaic/int_mosaics/data_points_extracted.txt" |
|
171 |
#df_points_extracted_fname <- "/data/project/layers/commons/NEX_data/climateLayers/out/reg5/mosaic/int_mosaics/data_points_extracted.txt"
|
|
167 | 172 |
df_points_extracted_fname <- NULL #if null compute on the fly |
168 | 173 |
#r_mosaic_fname <- "r_mosaic.RData" |
169 | 174 |
r_mosaic_fname <- NULL #if null create a stack from input dir |
... | ... | |
263 | 268 |
list_df_points_dates[[i]] <- subset(df_combined,df_combined$date==l_dates[i]) |
264 | 269 |
} |
265 | 270 |
|
266 |
df_combined <- do.call(rbind,list_df_points_dates) |
|
271 |
df_combined_dates <- do.call(rbind,list_df_points_dates)
|
|
267 | 272 |
|
268 | 273 |
#function(x){x$date==} |
269 | 274 |
#df_points <- subset(df_stations,df_stations_tmp$date==l_dates[1]) |
... | ... | |
274 | 279 |
model_name <- "res_mod1" |
275 | 280 |
var_selected <- "res_mod1" |
276 | 281 |
|
282 |
#8 minutes for 18 dates and reg1 ? |
|
283 |
|
|
277 | 284 |
for(i in 1:length(l_dates)){ |
278 | 285 |
#d |
279 | 286 |
date_processed <- l_dates[i] |
... | ... | |
348 | 355 |
|
349 | 356 |
dev.off() |
350 | 357 |
|
358 |
#### histogram of values |
|
359 |
res_pix <- 800 |
|
360 |
col_mfrow <- 1 |
|
361 |
row_mfrow <- 1 |
|
362 |
png_filename <- paste("Figure_ac_metrics_histograms_stations_validation_averaged_",model_name,"_",date_processed, |
|
363 |
"_",out_suffix,".png",sep="") |
|
364 |
png(filename=png_filename, |
|
365 |
width=col_mfrow*res_pix,height=row_mfrow*res_pix) |
|
366 |
|
|
367 |
h<- histogram(data_stations_temp$res_mod1,breaks=seq(-50,50,5)) |
|
368 |
|
|
369 |
print(h) |
|
370 |
dev.off() |
|
371 |
|
|
372 |
#from libary mosaic |
|
373 |
df_basic_stat <- fav_stats(data_stations_temp$res_mod1) |
|
374 |
quantile(data_stations_temp$res_mod1,c(1,5,10,90,95,99)) |
|
375 |
quantile(data_stations_temp$res_mod1,c(0.01,0.05,0.10,0.90,0.95,0.99)) |
|
376 |
#quantile(c(1,5,10,90,95,99),data_stations_temp$res_mod1,) |
|
377 |
|
|
351 | 378 |
} |
352 | 379 |
|
353 | 380 |
|
Also available in: Unified diff
examining stations extracted with histogram, assessment product part 1