Project

General

Profile

« Previous | Next » 

Revision e22c2d71

Added by Benoit Parmentier almost 9 years ago

assessment part2 plotting of figures checking input parameters and clean up

View differences:

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: 01/02/2016            
9
#Version: 4
8
#MODIFIED ON: 01/03/2016            
9
#Version: 5
10 10
#PROJECT: Environmental Layers project     
11 11
#COMMENTS: analyses for run 10 global analyses,all regions 1500x4500km with additional tiles to increase overlap 
12 12
#TODO:
......
16 16

  
17 17
#################################################################################################
18 18

  
19

  
20

  
21 19
#### FUNCTION USED IN SCRIPT
22 20

  
23 21
#function_analyses_paper1 <-"contribution_of_covariates_paper_interpolation_functions_07182014.R" #first interp paper
24 22
#function_analyses_paper2 <-"multi_timescales_paper_interpolation_functions_08132014.R"
25 23
#function_global_run_assessment_part2 <- "global_run_scalingup_assessment_part2_functions_0923015.R"
26 24

  
27

  
28

  
29

  
30 25
############################################
31 26
#### Parameters and constants  
32 27

  
......
45 40
#parent output dir for the current script analyes
46 41
#out_dir <- "/nobackup/bparmen1/" #on NEX
47 42
#in_dir_shp <- "/nobackupp4/aguzman4/climateLayers/output4/subset/shapefiles/"
48
in_dir <- "" #PARAM 0
49
y_var_name <- "dailyTmax" #PARAM1
50
interpolation_method <- c("gam_CAI") #PARAM2
43
#in_dir <- "" #PARAM 0
44
#y_var_name <- "dailyTmax" #PARAM1
45
#interpolation_method <- c("gam_CAI") #PARAM2
51 46
#out_suffix<-"run10_global_analyses_01282015"
52 47
#out_suffix <- "output_run10_1000x3000_global_analyses_02102015"
53
out_suffix <- "run10_1500x4500_global_analyses_pred_1992_10052015" #PARAM3
54
out_dir <- "/data/project/layers/commons/NEX_data/output_run10_1500x4500_global_analyses_pred_1992_10052015" #PARAM4
55
create_out_dir_param <- FALSE #PARAM 5
56
mosaic_plot <- FALSE #PARAM6
48
#out_suffix <- "run10_1500x4500_global_analyses_pred_1992_10052015" #PARAM3
49
#out_dir <- "/data/project/layers/commons/NEX_data/output_run10_1500x4500_global_analyses_pred_1992_10052015" #PARAM4
50
#create_out_dir_param <- FALSE #PARAM 5
51
#mosaic_plot <- FALSE #PARAM6
57 52
#if daily mosaics NULL then mosaicas all days of the year
58 53
#day_to_mosaic <- c("19920101","19920102","19920103") #PARAM7
59 54
#CRS_WGS84 <-    CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84 #CONSTANT1
60
CRS_locs_WGS84<-CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84
61
proj_str<- CRS_WGS84 #PARAM 8 #check this parameter
62
file_format <- ".rst" #PARAM 9
63
NA_value <- -9999 #PARAM10
64
NA_flag_val <- NA_value
65
multiple_region <- TRUE #PARAM 12
55
#CRS_locs_WGS84<-CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84
56
#proj_str<- CRS_WGS84 #PARAM 8 #check this parameter
57
#file_format <- ".rst" #PARAM 9
58
#NA_value <- -9999 #PARAM10
59
#NA_flag_val <- NA_value
60
#multiple_region <- TRUE #PARAM 12
66 61
#region_name <- "world" #PARAM 13
67
countries_shp <-"/data/project/layers/commons/NEX_data/countries.shp" #PARAM 13, copy this on NEX too
68
plot_region <- TRUE
69
num_cores <- 6 #PARAM 14
70
region_name <- c("reg4") #reference region to merge if necessary, if world all the regions are together #PARAM 16
62
#countries_shp <-"/data/project/layers/commons/NEX_data/countries.shp" #PARAM 13, copy this on NEX too
63
#plot_region <- TRUE
64
#num_cores <- 6 #PARAM 14
65
#region_name <- c("reg4") #reference region to merge if necessary, if world all the regions are together #PARAM 16
71 66
#use previous files produced in step 1a and stored in a data.frame
72
df_assessment_files <- "df_assessment_files_reg4_1984_run_global_analyses_pred_12282015.txt" #PARAM 17
73
threshold_missing_day <- c(367,365,300,200) #PARM18
67
#df_assessment_files <- "df_assessment_files_reg4_1984_run_global_analyses_pred_12282015.txt" #PARAM 17
68
#threshold_missing_day <- c(367,365,300,200) #PARM18
74 69

  
75
list_param_run_assessment_plottingin_dir <- list(y_var_name, interpolation_method, out_suffix, 
76
                      out_dir, create_out_dir_param, mosaic_plot, proj_str, file_format, NA_value,
77
                      multiple_region, countries_shp, plot_region, num_cores, 
78
                      region_name, df_assessment_files, threshold_missing_day) 
70
#list_param_run_assessment_plottingin_dir <- list(in_dir,y_var_name, interpolation_method, out_suffix, 
71
#                      out_dir, create_out_dir_param, mosaic_plot, proj_str, file_format, NA_value,
72
#                      multiple_region, countries_shp, plot_region, num_cores, 
73
#                      region_name, df_assessment_files, threshold_missing_day) 
79 74

  
80
names(list_param_run_assessment_plottingin_dir) <- c("y_var_name","interpolation_method","out_suffix", 
81
                      "out_dir","create_out_dir_param","mosaic_plot","proj_str","file_format","NA_value",
82
                      "multiple_region","countries_shp","plot_region","num_cores", 
83
                      "region_name","df_assessment_files","threshold_missing_day") 
75
#names(list_param_run_assessment_plottingin_dir) <- c("in_dir","y_var_name","interpolation_method","out_suffix", 
76
#                      "out_dir","create_out_dir_param","mosaic_plot","proj_str","file_format","NA_value",
77
#                      "multiple_region","countries_shp","plot_region","num_cores", 
78
#                      "region_name","df_assessment_files","threshold_missing_day") 
84 79

  
85
run_assessment_plotting_prediction_fun(list_param_run_assessment_plottingin_dir) 
80
#run_assessment_plotting_prediction_fun(list_param_run_assessment_plottingin_dir) 
86 81

  
87 82
run_assessment_plotting_prediction_fun <-function(list_param_run_assessment_plotting){
88 83
  
......
101 96
  #12) countries_shp  #<- "world" #PARAM 13
102 97
  #13) plot_region  #<- TRUE
103 98
  #14) num_cores <- number of cores used # 6 #PARAM 14
104
  #16) region_name  #<- c("reg4"), world if full assessment #reference region to merge if necessary #PARAM 16
105
  #18) df_assessment_files  #PARAM 16
106
  #19) threshold_missing_day  #PARM18
99
  #15) region_name  #<- c("reg4"), world if full assessment #reference region to merge if necessary #PARAM 16
100
  #16) df_assessment_files  #PARAM 16
101
  #17) threshold_missing_day  #PARM18
107 102
  #
108 103
  
109 104
  ### Loading R library and packages        
......
160 155

  
161 156
  ####### PARSE INPUT ARGUMENTS/PARAMETERS #####
162 157
  
163
  in_dir <- list_param_run_assessment_plotting$in_dir #PARAM 0
164
  y_var_name <- list_param_run_assessment_plotting$y_var_name #PARAM1
165
  interpolation_method <- list_param_run_assessment_plotting$interpolation_method #c("gam_CAI") #PARAM2
166
  out_suffix <- list_param_run_assessment_plotting$out_suffix #PARAM3
167
  out_dir <- list_param_run_assessment_plotting$out_dir #
168
  create_out_dir_param <- list_param_run_assessment_plotting$create_out_dir_param # FALSE #PARAM 5
169
  mosaic_plot <- list_param_run_assessment_plotting$mosaic_plot #FALSE #PARAM6
158
  in_dir <- list_param_run_assessment_plotting$in_dir #PARAM 1
159
  y_var_name <- list_param_run_assessment_plotting$y_var_name #PARAM2
160
  interpolation_method <- list_param_run_assessment_plotting$interpolation_method #c("gam_CAI") #PARAM3
161
  out_suffix <- list_param_run_assessment_plotting$out_suffix #PARAM4
162
  out_dir <- list_param_run_assessment_plotting$out_dir # PARAM5
163
  create_out_dir_param <- list_param_run_assessment_plotting$create_out_dir_param # FALSE #PARAM 6
164
  mosaic_plot <- list_param_run_assessment_plotting$mosaic_plot #FALSE #PARAM7
170 165
  proj_str<- list_param_run_assessment_plotting$proj_str #CRS_WGS84 #PARAM 8 #check this parameter
171 166
  file_format <- list_param_run_assessment_plotting$file_format #".rst" #PARAM 9
172 167
  NA_value <- list_param_run_assessment_plotting$NA_value #-9999 #PARAM10
173
  multiple_region <- list_param_run_assessment_plotting$multiple_region # <- TRUE #PARAM 12
174
  countries_shp <- list_param_run_assessment_plotting$countries_shp #<- "world" #PARAM 13
175
  plot_region <- list_param_run_assessment_plotting$plot_region #<- TRUE
168
  multiple_region <- list_param_run_assessment_plotting$multiple_region # <- TRUE #PARAM 11
169
  countries_shp <- list_param_run_assessment_plotting$countries_shp #<- "world" #PARAM 12
170
  plot_region <- list_param_run_assessment_plotting$plot_region # PARAM13 
176 171
  num_cores <- list_param_run_assessment_plotting$num_cores # 6 #PARAM 14
177
  region_name <- list_param_run_assessment_plotting$region_name #<- "world" #PARAM 13
178
  df_assessment_files <- list_param_run_assessment_plotting$df_assessment_files #PARAM 16
179
  threshold_missing_day <- list_param_run_assessment_plotting$threshold_missing_day #PARM18
172
  region_name <- list_param_run_assessment_plotting$region_name #<- "world" #PARAM 15
173
  df_assessment_files_name <- list_param_run_assessment_plotting$df_assessment_files_name #PARAM 16
174
  threshold_missing_day <- list_param_run_assessment_plotting$threshold_missing_day #PARM17
180 175
 
181 176
  NA_flag_val <- NA_value
182 177

  
......
193 188

  
194 189
  setwd(out_dir)
195 190
  
191
  list_outfiles <- vector("list", length=20) #collect names of output files
192
  list_outfiles_names <- vector("list", length=20) #collect names of output files
193
  counter_fig <- 0 #index of figure to collect outputs
194
  
196 195
  #i <- year_predicted
197 196
  ###Table 1: Average accuracy metrics
198 197
  ###Table 2: daily accuracy metrics for all tiles
199 198

  
199
  df_assessment_files <- read.table(df_assessment_files_name,stringsAsFactors=F,sep=",")
200 200
  #df_assessment_files, note that in_dir indicate the path of the textfiles
201
  summary_metrics_v <- file.path(in_dir,basename(df_assessment_files$files[1]))
202
  tb <- file.path(in_dir, basename(df_assessment_files$files[2]))
203
  tb_s <-file.path(in_dir, basename(df_assessment_files$files[4]))
201
  summary_metrics_v <- read.table(file.path(in_dir,basename(df_assessment_files$files[1])),sep=",")
202
  tb <- read.table(file.path(in_dir, basename(df_assessment_files$files[2])),sep=",")
203
  tb_s <- read.table(file.path(in_dir, basename(df_assessment_files$files[4])),sep=",")
204 204
  
205
  tb_month_s <- file.path(in_dir,basename(df_assessment_files$files[3]))
206
  pred_data_month_info <- file.path(in_dir, basename(df_assessment_files$files[10]))
207
  pred_data_day_info <- file.path(in_dir, basename(df_assessment_files$files[11]))
208
  df_tile_processed <- file.path(in_dir, basename(df_assessment_files$files[12]))
205
  tb_month_s <- read.table(file.path(in_dir,basename(df_assessment_files$files[3])),sep=",")
206
  pred_data_month_info <- read.table(file.path(in_dir, basename(df_assessment_files$files[10])),sep=",")
207
  pred_data_day_info <- read.table(file.path(in_dir, basename(df_assessment_files$files[11])),sep=",")
208
  df_tile_processed <- read.table(file.path(in_dir, basename(df_assessment_files$files[12])),sep=",")
209 209
  
210 210
  #add column for tile size later on!!!
211 211
  
......
219 219
  tb_s$pred_mod <- as.character(tb_s$pred_mod)
220 220
  tb_s$tile_id <- as.character(tb_s$tile_id)
221 221
  
222
  #multiple regions?
222
  #multiple regions? #this needs to be included in the previous script!!!
223 223
  if(multiple_region==TRUE){
224 224
    df_tile_processed$reg <- basename(dirname(as.character(df_tile_processed$path_NEX)))
225 225
    tb <- merge(tb,df_tile_processed,by="tile_id")
......
331 331
  #unique(summaty_metrics$tile_id)
332 332
  #text(lat-shp,)
333 333
  #union(list_shp_reg_files[[1]],list_shp_reg_files[[2]])
334
  list_outfiles[[counter_fig+1]] <- paste("Figure1_tile_processed_region_",region_name,"_",out_suffix,".png",sep="")
334 335
  
335 336
  ###############
336 337
  ### Figure 2: boxplot of average accuracy by model and by tiles
337 338
  
338
  
339 339
  tb$tile_id <- factor(tb$tile_id, levels=unique(tb$tile_id))
340 340
  model_name <- as.character(unique(tb$pred_mod))
341 341
  
......
345 345
    res_pix <- 480
346 346
    col_mfrow <- 1
347 347
    row_mfrow <- 1
348
    
348
    fig_name <- paste("Figure2a_boxplot_with_oultiers_by_tiles_",model_name[i],"_",out_suffix,".png",sep="")
349 349
    png(filename=paste("Figure2a_boxplot_with_oultiers_by_tiles_",model_name[i],"_",out_suffix,".png",sep=""),
350 350
        width=col_mfrow*res_pix,height=row_mfrow*res_pix)
351 351
    
......
353 353
    title(paste("RMSE per ",model_name[i]))
354 354
    
355 355
    dev.off()
356
    list_outfiles[[counter_fig+i]] <- fig_filename
356 357
  }
357 358
  
358 359
  ## Figure 2b
359 360
  #with ylim and removing trailing...
360
  for(i in  1:length(model_name)){
361
  for(i in  1:length(model_name)){ #there are two models!!
361 362
    
362 363
    res_pix <- 480
363 364
    col_mfrow <- 1
364 365
    row_mfrow <- 1
366
    fig_filename <- paste("Figure2b_boxplot_scaling_by_tiles","_",model_name[i],"_",out_suffix,".png",sep="")
365 367
    png(filename=paste("Figure2b_boxplot_scaling_by_tiles","_",model_name[i],"_",out_suffix,".png",sep=""),
366 368
        width=col_mfrow*res_pix,height=row_mfrow*res_pix)
367 369
    
......
370 372
            ,ylim=c(0,4),outline=FALSE)
371 373
    title(paste("RMSE per ",model_name[i]))
372 374
    dev.off()
375
    #we already stored one figure
376
    list_outfiles[[counter_fig+i]] <- fig_filename
373 377
  }
378
  counter_fig <- counter_fig + length(model_name)
374 379
  #bwplot(rmse~tile_id, data=subset(tb,tb$pred_mod=="mod1"))
375
  
380
 
376 381
  ###############
377 382
  ### Figure 3: boxplot of average RMSE by model acrosss all tiles
378 383
  
......
386 391
  
387 392
  boxplot(rmse~pred_mod,data=tb)#,names=tb$pred_mod)
388 393
  title("RMSE per model over all tiles")
389
  
390 394
  dev.off()
391
  
395
  list_outfiles[[counter_fig+1]] <- paste("Figure3a_boxplot_overall_region_with_oultiers_",model_name[i],"_",out_suffix,".png",sep="")
396

  
392 397
  ## Figure 3b
393 398
  png(filename=paste("Figure3b_boxplot_overall_region_scaling_",model_name[i],"_",out_suffix,".png",sep=""),
394 399
      width=col_mfrow*res_pix,height=row_mfrow*res_pix)
......
397 402
  title("RMSE per model over all tiles")
398 403
  
399 404
  dev.off()
405
  list_outfiles[[counter_fig+2]] <- paste("Figure3b_boxplot_overall_region_scaling_",model_name[i],"_",out_suffix,".png",sep="")
406
  counter_fig <- counter_fig + 2
400 407
  
401 408
  ################ 
402 409
  ### Figure 4: plot predicted tiff for specific date per model
......
451 458
    res_pix <- 480
452 459
    col_mfrow <- 1
453 460
    row_mfrow <- 1
454
    
461
    fig_filename <- paste("Figure5_ac_metrics_ranked_",model_name[i],"_",out_suffix,".png",sep="")
462

  
455 463
    png(filename=paste("Figure5_ac_metrics_ranked_",model_name[i],"_",out_suffix,".png",sep=""),
456 464
        width=col_mfrow*res_pix,height=row_mfrow*res_pix)
457 465
    x<- as.character(df_ac_mod$tile_id)
......
461 469
    title(paste("RMSE ranked by tile for ",model_name[i],sep=""))
462 470
    
463 471
    dev.off()
464
    
472
    list_outfiles[[counter_fig+i]] <- fig_filename
465 473
  }
466 474
  
475
  counter_fig <- counter_fig+length(model_name)
476

  
467 477
  ######################
468 478
  ### Figure 6: plot map of average RMSE per tile at centroids
469 479
  
......
482 492
    
483 493
    col_mfrow <- 1
484 494
    row_mfrow <- 1
485
    
495
    fig_filename <- paste("Figure6_ac_metrics_map_centroids_tile_",model_name[i],"_",out_suffix,".png",sep="")
486 496
    png(filename=paste("Figure6_ac_metrics_map_centroids_tile_",model_name[i],"_",out_suffix,".png",sep=""),
487 497
        width=col_mfrow*res_pix,height=row_mfrow*res_pix)
488 498
    
......
490 500
    coordinates(ac_mod) <- ac_mod[,c("lon.x","lat.x")] #solve this later
491 501
    p_shp <- layer(sp.polygons(reg_layer, lwd=1, col='black'))
492 502
    #title("(a) Mean for 1 January")
493
    p <- bubble(ac_mod,"rmse",main=paste("Averrage RMSE per tile and by ",model_name[i]))
503
    p <- bubble(ac_mod,"rmse",main=paste("Average RMSE per tile and by ",model_name[i]))
494 504
    p1 <- p+p_shp
495 505
    print(p1)
496 506
    #plot(ac_mod1,cex=(ac_mod1$rmse1)*2,pch=1,add=T)
......
501 511
    ### Ranking by tile...
502 512
    #df_ac_mod <- 
503 513
    list_df_ac_mod[[i]] <- arrange(as.data.frame(ac_mod),desc(rmse))[,c("rmse","mae","tile_id")]
514
    list_outfiles[[counter_fig+i]] <- fig_filename
504 515
  }
516
  counter_fig <- counter_fig+length(model_name)
505 517
  
518
  
519
  ######################
520
  ### Figure 7: Number of predictions: daily and monthly
521
  
522
  ## Figure 7a
523
 
506 524
  ## Number of tiles with information:
507 525
  sum(df_tile_processed$metrics_v) #26,number of tiles with raster object
508 526
  length(df_tile_processed$metrics_v) #26,number of tiles in the region
......
535 553
    
536 554
    col_mfrow <- 1
537 555
    row_mfrow <- 1
538
    
556
    fig_filename <- paste("Figure7a_ac_metrics_map_centroids_tile_",model_name[j],"_","missing_day_",threshold_missing_day[i],
557
                       "_",out_suffix,".png",sep="")
539 558
    png(filename=paste("Figure7a_ac_metrics_map_centroids_tile_",model_name[j],"_","missing_day_",threshold_missing_day[i],
540 559
                       "_",out_suffix,".png",sep=""),
541 560
        width=col_mfrow*res_pix,height=row_mfrow*res_pix)
......
548 567
                                                                threshold_missing_day[i]))
549 568
    p1 <- p+p_shp
550 569
    try(print(p1)) #error raised if number of missing values below a threshold does not exist
551

  
552 570
    dev.off()
571
    
572
    list_outfiles[[counter_fig+i]] <- fig_filename
553 573
  }
574
  counter_fig <- counter_fig+length(threshold_missing_day)
554 575
  
555
  ######################
556
  ### Figure 7: Number of predictions: daily and monthly
557
  
558
  ## Figure 7a
559
  png(filename=paste("Figure7a_number_daily_predictions_per_models","_",out_suffix,".png",sep=""),
576
 png(filename=paste("Figure7b_number_daily_predictions_per_models","_",out_suffix,".png",sep=""),
560 577
      width=col_mfrow*res_pix,height=row_mfrow*res_pix)
561 578
  
562 579
  xyplot(n~pred_mod | tile_id,data=subset(as.data.frame(summary_metrics_v),
563 580
                                          pred_mod!="mod_kr"),type="h")
564 581
  dev.off()
565 582
  
583
  list_outfiles[[counter_fig+1]] <- paste("Figure7b_number_daily_predictions_per_models","_",out_suffix,".png",sep="")
584
  counter_fig <- counter_fig + 1
585
  
566 586
  table(tb$pred_mod)
567 587
  table(tb$index_d)
568 588
  table(subset(tb,pred_mod!="mod_kr"))
......
581 601
  table((subset(test, test$pred_mod=="mod1")$predicted))
582 602
  
583 603
  #LST_avgm_min <- aggregate(LST~month,data=data_month_all,min)
604
  png(filename=paste("Figure7c_histogram_number_daily_predictions_per_models","_",out_suffix,".png",sep=""),
605
      width=col_mfrow*res_pix,height=row_mfrow*res_pix)
606

  
584 607
  histogram(test$predicted~test$tile_id)
608
  dev.off()
609
  
610
  list_outfiles[[counter_fig+1]] <- paste("Figure7c_histogram_number_daily_predictions_per_models","_",out_suffix,".png",sep="")
611
  counter_fig <- counter_fig + 1
612

  
585 613
  #table(tb)
586 614
  ## Figure 7b
587 615
  #png(filename=paste("Figure7b_number_daily_predictions_per_models","_",out_suffix,".png",sep=""),
......
614 642
  print(p)
615 643
  dev.off()
616 644
  
645
  list_outfiles[[counter_fig+1]] <- paste("Figure8a_boxplot_overall_separated_by_region_with_oultiers_",model_name[i],"_",out_suffix,".png",sep="")
646
  counter_fig <- counter_fig + 1
647
  
617 648
  ## Figure 8b
618 649
  png(filename=paste("Figure8b_boxplot_overall_separated_by_region_scaling_",model_name[i],"_",out_suffix,".png",sep=""),
619 650
      width=col_mfrow*res_pix,height=row_mfrow*res_pix)
......
625 656
  print(p)
626 657
  dev.off()
627 658
  
659
  list_outfiles[[counter_fig+1]] <- paste("Figure8b_boxplot_overall_separated_by_region_scaling_",model_name[i],"_",out_suffix,".png",sep="")
660
  counter_fig <- counter_fig + 1
661

  
628 662
  #####################################################
629 663
  #### Figure 9: plotting boxplot by year and regions ###########
630 664
  
631
  ## Figure 8a
665
  ## Figure 9a
632 666
  res_pix <- 480
633 667
  col_mfrow <- 1
634 668
  row_mfrow <- 1
......
636 670
  png(filename=paste("Figure9a_boxplot_overall_separated_by_region_year_with_oultiers_",model_name[i],"_",out_suffix,".png",sep=""),
637 671
      width=col_mfrow*res_pix,height=row_mfrow*res_pix)
638 672
  
639
  p<- bwplot(rmse~pred_mod | reg, data=tb,
673
  p<- bwplot(rmse~pred_mod | reg + year, data=tb,
640 674
             main="RMSE per model and region over all tiles")
641 675
  print(p)
642 676
  dev.off()
643 677
  
644
  ## Figure 8b
678
  ## Figure 9b
645 679
  png(filename=paste("Figure8b_boxplot_overall_separated_by_region_year_scaling_",model_name[i],"_",out_suffix,".png",sep=""),
646 680
      width=col_mfrow*res_pix,height=row_mfrow*res_pix)
647 681
  
......
652 686
  print(p)
653 687
  dev.off()
654 688

  
655
}
689
  list_outfiles[[counter_fig+1]] <- paste("Figure9a_boxplot_overall_separated_by_region_year_with_oultiers_",model_name[i],"_",out_suffix,".png",sep="")
690
  counter_fig <- counter_fig + 1
691

  
692
  ##############################################################
693
  ############## Prepare object to return
694
  ############## Collect information from assessment ##########
695
  
696
  outfiles_names <- c("summary_metrics_v_names","tb_v_accuracy_name","tb_month_s_name","tb_s_accuracy_name", 
697
  "data_month_s_name","data_day_v_name","data_day_s_name","data_month_v_name", "tb_month_v_name",
698
  "pred_data_month_info_name","pred_data_day_info_name","df_tile_processed_name","df_tiles_all_name", 
699
  "df_tiles_all_name") 
700
  names(list_outfiles) <- outfiles_names
701
  
702
  #This data.frame contains all the files from the assessment
703
  df_assessment_figures_files <- data.frame(filename=outfiles_names,files=unlist(list_outfiles),
704
                                    reg=region_name,year=year_predicted)
705
  ###Prepare files for copying back?
706
  df_assessment_figures_files_names <- file.path(out_dir,paste("df_assessment_files_",region_name,"_",year_predicted,"_",out_prefix,".txt",sep=""))
707
  write.table(df_assessment_files,
708
              file=df_assessment_files_name,sep=",")
656 709

  
710
  #df_assessment_figures_files_names
711
  
712
  ######################################################
713
  ##### Prepare objet to return ####
657 714

  
715
  #assessment_obj <- list(df_assessment_files, df_assessment_figures_files)
716
  #names(assessment_obj) <- c("df_assessment_files", "df_assessment_figures_files")
717
  ## Prepare list of files to return...
718
  return(df_assessment_figures_files_names)
719
 
720
}
658 721
  
659 722
##################### END OF SCRIPT ######################
723

  
724
# #comments                                                                     #figure_no    #region   #models       
725
# tile processed for the region                                           figure_1           reg4        NA
726
# boxplot with outlier                                                        figure_2a          reg4        mod1
727
# boxplot with outlier                                                        figure_2a          reg4        mod_kr
728
# boxplot scaling by tiles                                                   figure_2b          reg4        mod1
729
# boxplot scaling by tiles                                                   figure_2b          reg4        mod_kr
730
# boxplot overall region with outliers                              figure_3a          reg4        NA
731
# boxplot overall region with scaling                               figure_3b          reg4        NA
732
# Barplot of metrics ranked by tile                                  Figure_5            
733
# Barplot of metrics ranked by tile                                  Figure_5
734
# Average metrics map centroids                                  Figure_6
735
# Average metrics map centroids                                  Figure_6
736
# Number of missing day threshold1 map centroids                                    Figure_7a
737
# Number of missing day threshold1 map centroids                                    Figure_7a
738
# Number of missing day threshold1 map centroids                                    Figure_7a
739
# Number of missing day threshold1 map centroids                                    Figure_7a
740
# number_daily_predictions_per_model                                                        Figure_7b
741
# histogram number_daily_predictions_per_models                                    Figure_7c
742
# boxplot_overall_separated_by_region_with_oultiers_                              Figure 8a
743
# boxplot_overall_separated_by_region_with_scaling                                 Figure 8b

Also available in: Unified diff