-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.R
2126 lines (1865 loc) · 68.5 KB
/
main.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright 2021-2023 Louis Héraut ([email protected])*1,
# Éric Sauquet ([email protected])*1
#
# *1 INRAE, France
#
# This file is part of Explore2 R toolbox.
#
# Explore2 R toolbox is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# Explore2 R toolbox is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Explore2 R toolbox.
# If not, see <https://www.gnu.org/licenses/>.
# ___ __ _ _
# |_ _| _ _ / _| ___ _ _ _ __ __ _ | |_ (_) ___ _ _ ___
# | | | ' \ | _|/ _ \| '_|| ' \ / _` || _|| |/ _ \| ' \ (_-<
# |___||_||_||_| \___/|_| |_|_|_|\__,_| \__||_|\___/|_||_|/__/ _____
# If you want to contact the author of the code you need to contact
# first Louis Héraut who is the main developer. If it is not possible,
# Éric Sauquet is the main referent at INRAE to contact.
#
# Louis Héraut : <https://github.com/super-lou>
#
# Éric Sauquet : <[email protected]>
#
# See the 'README.md' file for more information about the utilisation
# of this toolbox.
# ___
# | _ \ _ _ ___ __ ___ ___ ___
# | _/| '_|/ _ \/ _|/ -_)(_-<(_-<
# |_| |_| \___/\__|\___|/__//__/ ___________________________________
## 1. REQUIREMENTS ___________________________________________________
# Explore2_toolbox path
lib_path =
"./" #botan / sacados
# '/home/lheraut/library/Explore2_toolbox' #ESPRI
# '/home/herautl/library/Explore2_toolbox' #MUSE
## 2. GENERAL PROCESSES ______________________________________________
# This to_do vector regroups all the different step you want to do.
# For example if you write 'create_data', a tibble of hydrological
# data will be created according to the info you provide in the ## 1.
# CREATE_DATA section of the STEPS part below. If you also add
# 'extract_data' in the vector, the extract will also be perfom
# following the creation of data. But if you only write, for example,
# 'plot_sheet', without having previously execute the code to have
# loading data to plot, it will results in a failure.
#
# Options are listed below with associated results after '>' :
#
# - 'delete_tmp' :
# Delete temporary data in the tmpdir/.
# > Permanently erase temporary data.
#
# - 'clean_nc' :
# Clean NetCDF files from data producer to manage code association
# error thanks to data contained in HM_rm.csv and HM_mv.csv
# files in computer_data_path/code_correction/.
# > Cleaned NetCDF in computer_data_path/projection_clean/.
#
# - 'merge_nc' :
# Merge historical part of NetCDF file to its corresponding
# scenario path NetCDF.
# > Merged NetCDF in computer_data_path/projection_merge/.
#
# - 'reshape_piezo_data' :
# Reshape input piezo data from BRGM for aggregated value for
# diagnostic. It replaces 'create_data' and a part of
# 'extract_data' for hydrologie type.
# > dataEX, metaEX, meta and data in tmpdir/.
#
# - 'create_data' :
# Creation of tibble of data that will be saved in tmpdir/. The
# data will be saved in fst format which is a fast reading and
# writting format. Each data tibble go with its meta tibble that
# regroup info about the data. Those files are named with a '_'
# followed by a capital letter that correspond to the first letter
# of the hydrological station codes that are stored in it. A file
# contain nCode4RAM stations, so each nCode4RAM stations a
# different file is created with a digit in its name to specify
# it. The selection of station code is done in the
# codes_to_use variable of the ## 1. CREATE_DATA section of the
# STEPS part below and the hm used are selected in the
# variable HM_to_diag of that same previous section.
# > tmpdir/data_K1.fst :
# A fst file that contain the tibble of created data.
# > tmpdir/meta_K1.fst :
# An other fst file that contain info about the data file.
#
# - 'extract_data' :
# Perfom the requested analysis on the created data contained in
# the tmpdir/. Details about the analysis are given with the
# extract_data variable in the ## 2. EXTRACT_DATA section of the
# STEPS part below. This variable needs to be a path to a CARD
# directory. See CARD toolbox for more info
# https://github.com/super-lou/CARD.
# > tmpdir/dataEXind_K1.fst :
# If the CARD directory contains 'indicator' this fst file
# will be created.
# > tmpdir/metaEXind_K1.fst :
# Info about variables stored in dataEXind_K1.fst.
# > tmpdir/dataEXserie_K1/ :
# If the CARD directory contains 'serie' this directory that
# contains a fst file for each serie variable extracted
# will be created.
# > tmpdir/metaEXserie_K1.fst :
# Info about variables stored in dataEXserie_K1.
#
# - 'save_extract' :
# Saves all the data contained in the tmpdir/ to the resdir/. The
# format used is specified in the saving_format variable of the
# ## 3. SAVE_EXTRACT section of the STEPS part.
# > Moves all temporary data in tmpdir/ to the resdir/.
#
# - 'read_tmp' :
# Loads in RAM all the data stored in fst files in the tmpdir/.
# > For example, if there is a tmpdir/metaEXind_K1.fst file, a
# data called metaEXind_K1 will be created in the current R
# process that contained the data stored in the previous files.
#
# - 'read_saving' :
# Loads in RAM all the data stored in the resdir/ which names are
# based on var2search.
# > Same as 'read_tmp' results but again from resdir/.
#
# - 'reshape_extracted_data_by_code' :
# Change structure of aggregated data stored in
# resdir/projection/. It pass from projection chain base
# structure to code base strucutre in order to be easily read for
# plotting.
# > Aggregated data in resdir/projection_by_code/ but stored base
# on code.
#
# - 'create_database' :
# Start the process to create database. Needs to go in script next
# because it needs to not be overwrited.
# > Postgresql database.
#
# - 'write_warnings' :
# Writes in tmpdir/ the Warnings.fst file which is a tibble of
# warnings based on the dataEXind tibble.
# > Warnings tibble in RAM and writes it in tmpdir/.
#
# - 'add_regime_hydro' :
# Add hydrological regime to meta base on variables in
# Explore2_serie_diagnostic_plot analyse.
# > meta modified with new column for hydrological regime.
#
# - 'analyse_data' :
# Perfom basic analyses specified in analyse_data variable.
# > depends
#
# - 'plot_sheet' :
# Plots a set of datasheets specify by the plot_sheet variable
# below. Different plotting options are mentioned in the ## 6.
# PLOT_SHEET section of the STEPS part.
# > Creates a pdf file in the figdir/ directory.
#
# - 'plot_doc' :
# Plots a pre-define set of datasheets in document format specify
# by the plot_doc variable below and the corresponding variables
# define in ## 7. PLOT_DOC.
# > Creates set of pdf files and a pdf document that regroup all
# those individual file in a specific directory of the figdir/
# directory.
mode =
"diagnostic"
# "diagnostic_ungauged"
# "projection"
type =
"hydrologie"
# "piezometrie"
# "climat"
to_do = c(
## diagnostic
# 'delete_tmp',
# 'reshape_piezo_data',
# 'create_data',
# 'extract_data',
# 'save_extract'
# 'write_warnings',
# 'add_regime_hydro'
# 'read_tmp'
# 'read_saving'
## projection
# 'delete_tmp',
# 'clean_nc'
# 'merge_nc'
# 'delete_tmp',
# 'create_data',
# 'extract_data',
# 'save_extract'
# 'find_chain_out'
# 'add_more_info_to_metadata'
# 'reshape_extracted_data_for_figure'
# 'create_database'
# 'read_tmp'
# 'read_saving'
## all
# 'plot_sheet'
'plot_doc'
)
extract_data = c(
# 'WIP'
'Explore2_criteria_diagnostic_performance',
'Explore2_criteria_diagnostic_sensibility',
'Explore2_criteria_diagnostic_sensibility_RAT',
'Explore2_criteria_diagnostic_HF',
'Explore2_criteria_diagnostic_MF',
'Explore2_criteria_diagnostic_LF',
'Explore2_criteria_diagnostic_BF'
# 'Explore2_serie_diagnostic_plot'
# 'Explore2_criteria_diagnostic_SAFRAN',
# 'Explore2_criteria_more_diagnostic_SAFRAN'
# 'Explore2_serie_projection_HF',
# 'Explore2_serie_projection_MF',
# 'Explore2_serie_projection_LF',
# 'Explore2_serie_projection_LF_summer',
# 'Explore2_serie_projection_LF_winter',
# 'Explore2_serie_projection_BFI',
# 'Explore2_serie_projection_FDC',
# 'Explore2_serie_projection_medQJ',
# 'Explore2_serie_projection_QM',
# 'Explore2_serie_projection_BF'
# 'Explore2_criteria_projection_HF',
# 'Explore2_criteria_projection_MF',
# 'Explore2_criteria_projection_LF',
# 'Explore2_criteria_projection_LF_summer'
# 'Explore2_criteria_projection_LF_winter'
# 'Explore2_criteria_projection_BF'
)
# dataEX_criteria_normal = dataEX_criteria
# dataEX_criteria_ungauged = dataEX_criteria
# dataEX_criteria = dplyr::filter(dataEX_criteria_normal, !(HM %in% c("GRSD", "SMASH")))
# dataEX_criteria = dplyr::bind_rows(dataEX_criteria, dataEX_criteria_ungauged)
# dataEX_criteria = dplyr::filter(dataEX_criteria, HM != "MORDOR-SD")
# library(ggplot2)
# code_light = "K298191001"
# plot = ggplot() + theme_minimal() +
# geom_line(data=dplyr::filter(dataEX_WIP$tVCN10,
# code==code_light),
# aes(x=date, y=tVCN10), color="red") +
# geom_line(data=dplyr::filter(dataEX_WIP$startLF,
# code==code_light),
# aes(x=date, y=startLF), color="darkcyan") +
# geom_line(data=dplyr::filter(dataEX_WIP$centerLF,
# code==code_light),
# aes(x=date, y=centerLF), color="black") +
# geom_line(data=dplyr::filter(dataEX_WIP$endLF,
# code==code_light),
# aes(x=date, y=endLF), color="blue")
# ggsave("LF.pdf", plot, height=21, width=29.7, units="cm")
# '*bold('VCN10'['estival'])*' OK
# '*bold('VCN10'[estival])*'
## 3. PLOTTING PROCESSES _____________________________________________
### 3.1. Sheet _______________________________________________________
# The use of this plot_sheet vector is quite similar to the to_do
# vector. It regroups all the different datasheet you want to plot
# individually. For example if you write 'diagnostic_station', the
# data previously extractd saved and read will be use to plot the
# diagnostic datasheet for specific stations.
#
# Options are listed below with associated results after '>' :
#
# - 'sommaire' :
# Plots the sommaire page of a selection of pages.
# > figdir/sommaire.pdf
#
# - 'diagnostic_matrix' :
# Plots diagnostic correlation matrix of every criteria for each
# hm.
# > figdir/matrice_correlation_J2000.pdf
#
# - 'diagnostic_station' :
# Plots diagnostic station pages for each station selected.
# > figdir/K2981910_diagnostic_datasheet.pdf
#
# - 'diagnostic_region' :
# Plots diagnostic region pages for each hydrological region of
# available stations.
# > figdir/Loire_K_diagnostic_datasheet.pdf
#
# - 'diagnostic_regime' :
# Plots diagnostic regime pages for each hydrological regime of
# available stations.
# > figdir/Pluvial_modérément_contrasté_diagnostic_datasheet.pdf
plot_sheet = c(
# 'sommaire'
# 'correlation_matrix'
# 'fiche_diagnostic_station'
# 'fiche_diagnostic_region'
# 'fiche_diagnostic_regime'
# 'fiche_diagnostic_piezometre'
# 'carte_regime'
# 'carte_critere'
# 'stripes'
'fiche_projection_station'
)
### 3.2. Document ____________________________________________________
plot_doc = c(
# "correlation_matrix"
# "correlation_matrix_ungauged"
# 'fiche_diagnostic_region'
# 'fiche_diagnostic_regime'
# 'fiche_diagnostic_piezometre'
## normal
# "carte_critere_hm"
# "carte_critere_hm_secteur"
# "carte_critere_critere"
# "carte_critere_critere_secteur"
## ungauged
# "carte_critere_hm_ungauged"
# "carte_critere_hm_ungauged_secteur"
# "carte_critere_critere_ungauged"
# "carte_critere_critere_ungauged_secteur"
## avertissement
"carte_critere_hm_avertissement_secteur"
## piezo
# "carte_piezo_critere_hm"
# "carte_piezo_critere_critere"
)
## 4. OTHER __________________________________________________________
# Display information along process
verbose =
# FALSE
TRUE
subverbose =
FALSE
# TRUE
# Which type of MPI is used
MPI =
""
# "file"
# "code"
# ___ _
# / __|| |_ ___ _ __ ___
# \__ \| _|/ -_)| '_ \(_-<
# |___/ \__|\___|| .__//__/ __________________________________________
## 1. CREATE_DATA|_| _________________________________________________
period_extract_diag = c('1976-01-01', '2019-12-31')
period_extract_projection = c('1975-09-01', '2100-08-31')
period_reference = c("1976-01-01", "2005-12-31")
historical = c("1976-01-01", "2005-08-31")
Futurs = list(H1=c("2021-01-01", "2050-12-31"),
H2=c("2041-01-01", "2070-12-31"),
H3=c("2070-01-01", "2099-12-31"))
propagate_NA = TRUE
# Number of code to load in RAM
## diagnostic ##
# nCode4RAM | 32 |
# nSubsets | 31 |
# nodes | 1 |
# tasks | 31 |
## projections per hm ##
# nProj | 82 | 41
# nCode4RAM | 25 | 25
# nodes | 3 | 2
# tasks | 28 | 28
nCode4RAM = 25
# Directory where to search for projections structures:
# - 'raw' is for computer_data_path/projection/
# - 'cleaned' is for computer_data_path/projection_clean/
# - 'merged' is for computer_data_path/projection_merge/
# - 'extracted' is for resdir/projection/
projs_type =
# "raw"
"cleaned"
# "merged"
# "extracted"
projections_to_use =
c(
'all'
# "(rcp26)|(rcp45)|(rcp85")
# "ADAMONT"
## figure ##
# "rcp85",
# "SAFRAN"
# "SAFRAN-France-20"
## story lines ##
# "HadGEM2.*historical.*CCLM4.*ADAMONT"
# "EARTH.*historical.*HadREM3.*ADAMONT",
# "CNRM.*historical.*ALADIN63.*ADAMONT",
# "HadGEM2.*historical.*ALADIN63.*ADAMONT",
# "HadGEM2.*rcp85.*CCLM4.*ADAMONT"
# "EARTH.*rcp85.*HadREM3.*ADAMONT"
# "CNRM.*rcp85.*ALADIN63.*ADAMONT",
# "HadGEM2.*rcp85.*ALADIN63.*ADAMONT"
)
except_SAFRAN =
# TRUE
FALSE
projections_to_remove =
c("CNRM[-]CERFACS[-]CNRM[-]CM5.*KNMI[-]RACMO22E",
"IPSL[-]IPSL[-]CM5A[-]MR.*IPSL[-]WRF381P")
storylines =
c("HadGEM2-ES|historical-rcp85|ALADIN63|ADAMONT"="Réchauffement marqué et augmentation des précipitations", #vert
"CNRM-CM5|historical-rcp85|ALADIN63|ADAMONT"="Changements futurs relativement peu marqués", #jaune
"EC-EARTH|historical-rcp85|HadREM3-GA7|ADAMONT"="Fort réchauffement et fort assèchement en été (et en annuel)", #orange
"HadGEM2-ES|historical-rcp85|CCLM4-8-17|ADAMONT"="Fort réchauffement et forts contrastes saisonniers en précipitations" #violet
)
HM_to_use =
c(
"CTRIP",
"EROS",
"GRSD",
"J2000",
"MORDOR-SD",
"MORDOR-TS",
"ORCHIDEE",
"SIM2",
"SMASH"
# "AquiFR",
# "EROS Bretagne",
# "MONA"
)
complete_by = c("SMASH", "GRSD")
codes_to_use =
c(
"all"
# "K298191001" #ref
# "O200001001" #ref
# "W101401002"
# "A105003001"
# "K294401001"
# "K297031001"
# "O036251010"
# "A105003001"
# "^H"
# "^R"
# "^K29"
# "^K"
# "A882000101"
# LETTERS[11:26]
## Agnès
# "H552201001"
# "K268081001"
# "Y046403002"
## Flora
# "V506401001",
# "V500403001",
# "V501401001",
# "V502050000"
## Eric
# "Seine"="H700011001",
# "Rhone"="V720001002",
# "Garonne"="O972001000",
# "Loire"="M842001000",
# "Moselle"="A886006000"
)
codes_to_use_only_ref = TRUE
diag_station_to_remove =
c("ORCHIDEE"="K649*",
"CTRIP"="O038401001",
"CTRIP"="D020601001")
MORDOR_code_warning =
c("K002000101", "K222302001", "K225401001",
"O023402001", "O036251001", "O038401001",
"O074404001", "O312102002", "O319401001",
"O701151001", "P027251002", "P171291001",
"Q010002500", "V612501001", "W022000201",
"W030000201", "W103000301", "W273050001",
"W211401000", "W271000101", "W273050003",
"W043050000", "Y662000301", "Y700000201",
"Y902000101")
variables_to_use =
c(
# ".*"
# "^QA$",
## Diagnostic (old name) ##
"KGEracine", "Biais$",
"epsilon.*JJA$", "epsilon.*DJF$",
"RAT_T$", "RAT_R$",
"Q10$", "med{tQJXA}$", "^alphaQA$", "^aCDC$", "Q90$", "med{tVCN10}$",
"^meanTA$", "^meanTA_DJF$", "^meanTA_MAM$", "^meanTA_JJA$", "^meanTA_SON$",
"^meanRA$", "^meanRA_DJF$", "^meanRA_MAM$", "^meanRA_JJA$", "^meanRA_SON$",
"^CR$", "^CR_DJF$", "^CR_MAM$", "^CR_JJA$", "^CR_SON$"
## Diagnostic (new name) ##
# "KGEsqrt", "Bias$",
# "epsilon.*JJA$", "epsilon.*DJF$",
# "RAT_T$", "RAT_R$",
# "Q10$", "med[{]tQJXA[}]$", "^alphaQA$", "^aFDC$", "Q90$", "med[{]tVCN10[}]$",
# "^meanTA$", "^meanTA_DJF$", "^meanTA_MAM$", "^meanTA_JJA$", "^meanTA_SON$",
# "^meanRA$", "^meanRA_DJF$", "^meanRA_MAM$", "^meanRA_JJA$", "^meanRA_SON$",
# "^CR$", "^CR_DJF$", "^CR_MAM$", "^CR_JJA$", "^CR_SON$"
## to find out chain ##
# "^QA$", "^deltaQA_H3$"
## fiche resultats ##
# "^QJXA$", "^QA$", "^VCN10_summer", "medQJ", "nQJXA-10_H", "deltaQJXA-10_H",
# "deltaQ05A", "deltaQ10A", "deltaQJXA", "delta{tQJXA}", "deltaVCX3", "delta{tVCX3}", "deltaVCX10", "delta{tVCX10}", "delta{dtFlood}",
# "deltaQ50A", "deltaQA", "deltaQMA_jan", "deltaQMA_aug", "deltaQMA_sep", "deltaQSA_DJF", "deltaQSA_MAM", "deltaQSA_JJA", "deltaQSA_SON",
# "deltaQ95A", "deltaQ90A", "deltaQMNA_H[[:digit:]]$", "deltaVCN3_summer", "deltaVCN10_summer", "deltaVCN30_summer", "delta{startLF}_summer", "delta{centerLF}_summer", "delta{dtLF}_summer", "nVCN10-5_H", "deltaVCN10-5_H"
## MEANDRE ##
# "medQJ",
# "^QJXA$", "deltaQJXA_H",
# # "^fQ10A$",
# "^QA$", "deltaQA_H",
# # "^QSA_DJF$", "^QSA_MAM$", "^QSA_JJA$", "^QSA_SON$",
# "^VCN10_summer$", "deltaVCN10_summer_H",
# "^startLF_summer$",
# "delta{startLF}_summer_H",
# "^dtLF_summer$",
# "delta{dtLF}_summer_H"
## Flora ##
# "^QA$",
# "^QMA_*", "^QSA_*",
# "^Q90A$", "^QMNA$", "^VCN30$",
# "^startLF$", "^dtLF$"
)
## 2. EXTRACT_DATA ___________________________________________________
# Name of the subdirectory in 'CARD_dir' that includes variables to
# extract. If no subdirectory is selected, all variable files will be
# used in 'CARD_dir' (which is may be too much).
# This subdirectory can follows some rules :
# - Variable files can be rename to began with a number followed by an
# underscore '_' to create an order in variables. For example,
# '2_QA.R' will be extractd and plotted after '1_QMNA.R'.
# - Directory of variable files can also be created in order to make a
# group of variable of similar topic. Names should be chosen between
# 'Crue'/'Crue Nivale'/'Moyennes Eaux' and 'Étiage'. A directory can
# also be named 'Resume' in order to not include variables in an
# topic group.
WIP =
list(name='WIP',
type="serie",
# variables=c("QA", "QA_season"),
variables=c(
"allLF_summer",
"delta{allLF}_summer_H"
),
# variables=c("T_chronique",
# "R_chronique"),
# variables=c("dtRA50mm"),
# suffix=c("obs", "sim"))
suffix=c("sim"))
# suffix=NULL)
# diag
Explore2_criteria_diagnostic_performance =
list(name='Explore2_criteria_diagnostic_performance',
type="criteria",
variables=c("KGE", "KGEsqrt",
"NSE", "NSEsqrt", "NSElog", "NSEinv",
"Bias", "Bias_season",
"STD"),
suffix=NULL)
Explore2_criteria_diagnostic_sensibility =
list(name='Explore2_criteria_diagnostic_sensibility',
type="criteria",
variables=c("epsilon_R", "epsilon_R_season",
"epsilon_T", "epsilon_T_season"),
suffix=c("obs", "sim"))
Explore2_criteria_diagnostic_sensibility_RAT =
list(name='Explore2_criteria_diagnostic_sensibility_RAT',
type="criteria",
variables=c("RAT_T", "RAT_R", "RAT_ET0"),
suffix=NULL)
Explore2_criteria_diagnostic_HF =
list(name='Explore2_criteria_diagnostic_HF',
type="criteria",
variables=c("Q10",
"QJXA-10", "alphaQJXA",
"med{tQJXA}", "med{dtFlood}"),
suffix=c("obs", "sim"))
Explore2_criteria_diagnostic_MF =
list(name='Explore2_criteria_diagnostic_MF',
type="criteria",
variables=c("Q50", "aFDC", "alphaQA"),
suffix=c("obs", "sim"))
Explore2_criteria_diagnostic_LF =
list(name='Explore2_criteria_diagnostic_LF',
type="criteria",
variables=c("Q90",
"QMNA-5", "VCN30-2", "VCN10-5", "alphaVCN10",
"med{tVCN10}", "med{allBE}"),
suffix=c("obs", "sim"))
Explore2_criteria_diagnostic_BF =
list(name='Explore2_criteria_diagnostic_BF',
type="criteria",
variables=c("BFI", "BFM",
"med{startBF}", "med{centerBF}", "med{endBF}",
"med{dtBF}", "med{vBF}", "med{dtRec}"),
suffix=c("obs", "sim"))
Explore2_criteria_diagnostic_SAFRAN =
list(name='Explore2_criteria_diagnostic_SAFRAN',
type="criteria",
variables=c(
"meanTA",
"meanTA_season",
"meanRA",
"meanRA_season",
"Rl_ratio",
"Rs_ratio"
),
suffix=c("obs", "sim"))
Explore2_criteria_more_diagnostic_SAFRAN =
list(name='Explore2_criteria_more_diagnostic_SAFRAN',
type="criteria",
variables=c(
"CR",
"CR_season"
),
suffix=NULL)
Explore2_serie_diagnostic_plot =
list(name='Explore2_serie_diagnostic_plot',
type="serie",
variables=c("QM", "QA", "RA_all", "RA_ratio",
"medQJC5", "FDC"),
suffix=c("obs", "sim"))
if (type == "piezometrie") {
Explore2_serie_diagnostic_plot$variables = "medQJC5"
}
# projection
Explore2_serie_projection_HF =
list(name='Explore2_serie_projection_HF',
type="serie",
variables=c(
"Q01A", "Q05A", "Q10A",
"QJXA", "tQJXA",
"VCX3", "tVCX3",
"VCX10", "tVCX10",
"fQ01A", "fQ05A", "fQ10A",
"dtFlood"
),
suffix="sim")
Explore2_serie_projection_MF =
list(name='Explore2_serie_projection_MF',
type="serie",
variables=c(
"Q25A", "Q50A", "Q75A",
"QA", "QMA_month", "QSA_season"),
suffix="sim")
Explore2_serie_projection_LF =
list(name='Explore2_serie_projection_LF',
type="serie",
variables=c(
"Q90A", "Q95A", "Q99A",
"QNA", "QMNA",
"VCN10", "tVCN10",
"VCN3", "VCN30",
"allLF"
),
suffix="sim")
Explore2_serie_projection_LF_summer =
list(name='Explore2_serie_projection_LF_summer',
type="serie",
variables=c(
"QNA_summer", "QMNA_summer",
"VCN10_summer", "tVCN10_summer",
"VCN3_summer", "VCN30_summer",
"allLF_summer"),
suffix="sim")
Explore2_serie_projection_LF_winter =
list(name='Explore2_serie_projection_LF_winter',
type="serie",
variables=c(
"QNA_winter", "QMNA_winter",
"VCN10_winter", "tVCN10_winter",
"VCN3_winter", "VCN30_winter",
"allLF_winter"),
suffix="sim")
Explore2_serie_projection_BF =
list(name='Explore2_serie_projection_BF',
type="serie",
variables=c(
"startBF", "centerBF", "endBF",
"dtBF", "vBF"
# "dtRec"
),
suffix="sim")
Explore2_serie_projection_FDC =
list(name='Explore2_serie_projection_FDC',
type="serie",
variables=c("FDC_H0", "FDC_H1",
"FDC_H2", "FDC_H3"),
expand=FALSE,
suffix="sim")
Explore2_serie_projection_medQJ =
list(name='Explore2_serie_projection_medQJ',
type="serie",
variables=c("medQJ_H0", "medQJ_H1",
"medQJ_H2", "medQJ_H3"),
suffix="sim")
# Explore2_serie_projection_BFI =
# list(name='Explore2_serie_projection_BFI',
# type="serie",
# variables=c("BFI_Wal_H0", "BFI_Wal_H1",
# "BFI_Wal_H2", "BFI_Wal_H3",
# "BFI_LH_H0", "BFI_LH_H1",
# "BFI_LH_H2", "BFI_LH_H3"),
# suffix="sim") 51 15 4 12
Explore2_criteria_projection_HF =
list(name='Explore2_criteria_projection_HF',
type="criteria",
variables=c(
"deltaQ01A_H", "deltaQ05A_H", "deltaQ10A_H",
"deltaQJXA_H", "delta{tQJXA}_H",
"deltaVCX3_H", "delta{tVCX3}_H",
"deltaVCX10_H", "delta{tVCX10}_H",
"delta{fQ01A}_H", "delta{fQ05A}_H", "delta{fQ10A}_H",
"delta{dtFlood}_H",
"nQJXA-10_H", "deltaQJXA-10_H"
),
suffix="sim")
Explore2_criteria_projection_MF =
list(name='Explore2_criteria_projection_MF',
type="criteria",
variables=c(
"deltaQ25A_H", "deltaQ50A_H", "deltaQ75A_H",
"deltaQA_H", "deltaQMA_month_H", "deltaQSA_season_H"),
suffix="sim")
Explore2_criteria_projection_LF =
list(name='Explore2_criteria_projection_LF',
type="criteria",
variables=c(
"deltaQ90A_H", "deltaQ95A_H", "deltaQ99A_H",
"deltaQNA_H", "deltaQMNA_H",
"deltaVCN10_H", "delta{tVCN10}_H",
"deltaVCN3_H", "deltaVCN30_H",
"delta{allLF}_H",
"nVCN10-5_H", "deltaVCN10-5_H"
),
suffix="sim")
Explore2_criteria_projection_LF_summer =
list(name='Explore2_criteria_projection_LF_summer',
type="criteria",
variables=c(
"deltaQNA_summer_H", "deltaQMNA_summer_H",
"deltaVCN10_summer_H", "delta{tVCN10}_summer_H",
"deltaVCN3_summer_H", "deltaVCN30_summer_H",
"delta{allLF}_summer_H"),
suffix="sim")
Explore2_criteria_projection_LF_winter =
list(name='Explore2_criteria_projection_LF_winter',
type="criteria",
variables=c(
"deltaQNA_winter_H", "deltaQMNA_winter_H",
"deltaVCN10_winter_H", "delta{tVCN10}_winter_H",
"deltaVCN3_winter_H", "deltaVCN30_winter_H",
"delta{allLF}_winter_H"),
suffix="sim")
Explore2_criteria_projection_BF =
list(name='Explore2_criteria_projection_BF',
type="criteria",
variables=c(
"delta{startBF}_H", "delta{centerBF}_H",
"delta{endBF}_H", "delta{dtBF}_H", "delta{vBF}_H",
"delta{BFI}_LH_H", "delta{BFI}_Wal_H"),
suffix="sim")
Explore2_serie_projection_QM =
list(name='Explore2_serie_projection_QM',
type="serie",
variables=c("QM_H0", "QM_H1", "QM_H2", "QM_H3"),
suffix="sim")
Explore2_serie_projection_BF =
list(name='Explore2_serie_projection_BF',
type="serie",
variables=c("BF_LH"),
expand=FALSE,
suffix="sim")
## 3. SAVE_EXTRACT ___________________________________________________
# If one input file need to give one output file
by_files =
# TRUE
FALSE
variable2save =
c(
'meta',
'data',
'dataEX',
'metaEX'
)
# Saving format to use to save extract data
saving_format =
""
# c('Rdata', 'txt')
## 4. READ_SAVING ____________________________________________________
read_saving =
file.path(mode, type)
# "proj/SMASH/CNRM-CM5_historical_ALADIN63_ADAMONT_SMASH"
variable2search =
c(
# 'data[_]', ### /!\ heavy ###
# 'meta[_]',
'data[.]',
'meta[.]',
'dataEX',
'metaEX',
'Warnings'
)
# merge_read_saving =
# TRUE
# FALSE
## 5. SELECTION ______________________________________________________
selection_before_reading_for_projection =
TRUE
# FALSE
diag_period_selection =
list(
"MORDOR-TS"=c(NA, as.Date("2017-08-31"))
)
diag_station_selection =
c(
"ORCHIDEE"="K649*",
"CTRIP"="O038401001",
"CTRIP"="D020601001"
)
## 6. PLOT_SHEET _____________________________________________________
for_paper =
TRUE
# FALSE
n_projections_by_code = 4
# If the hydrological network needs to be plot
river_selection =
# NULL
c("la Durance", "la Marne", "la Vienne", "le Loir", "la Loire",
"l'Oise", "la Seine", "le Lot", "l'Adour", "le Rhône",
"la Moselle", "l'Aisne", "la Garonne", "le Tarn", "le Doubs",
"la Dordogne", "la Charente", "le Cher", "la Saône", "l'Allier",
"Fleuve la Loire", "la Meuse", "la Sarthe", "la Somme",
"l'Isère", "la Vilaine", "l'Aude", "l'Yonne")
river_selection = paste0("^", river_selection, "$")
river_length =
# NULL
30000
# 300000
# Tolerance of the simplification algorithm for shapefile in sf
toleranceRel =
1000 # normal map
# 9000 # mini map
# Which logo do you want to show in the footnote
logo_info = list(
"EX2"=c(file='LogoExplore2.png', y=0.4, height=0.7, width=0.5)
)
# Probability used to define the min and max quantile needed for
# colorbar extremes. For example, if set to 0.01, quartile 1 and
# quantile 99 will be used as the minimum and maximum values to assign
# to minmimal maximum colors.
prob_of_quantile_for_palette =
0.01
# 0
Colors_of_HM = c(
"CTRIP"="#A88D72", #marron
"EROS"="#CECD8D", #vert clair
"GRSD"="#619C6C", #vert foncé
"J2000"="#74AEB9", #bleu clair
"MORDOR-SD"="#D8714E", #orange
"MORDOR-TS"="#AE473E", #rouge
"ORCHIDEE"="#EFA59D", #rose
"SIM2"="#475E6A", #bleu foncé
"SMASH"="#F6BA62", #mimosa
"AquiFR"="#AF3FA5", #violet
"EROS Bretagne"="#CECD8D", #vert clair
"MONA"="#F5D80E" #jaune
)
Colors_of_storylines =
c("HadGEM2-ES|historical-rcp85|ALADIN63|ADAMONT"="#569A71", #vert
"CNRM-CM5|historical-rcp85|ALADIN63|ADAMONT"="#EECC66", #jaune
"EC-EARTH|historical-rcp85|HadREM3-GA7|ADAMONT"="#E09B2F", #orange
"HadGEM2-ES|historical-rcp85|CCLM4-8-17|ADAMONT"="#791F5D" #violet
)
Colors_light_of_storylines = # 60% lighter
c("HadGEM2-ES|historical-rcp85|ALADIN63|ADAMONT"="#BAD8C6", #vert
"CNRM-CM5|historical-rcp85|ALADIN63|ADAMONT"="#F8EBC2", #jaune
"EC-EARTH|historical-rcp85|HadREM3-GA7|ADAMONT"="#F3D7AC", #orange
"HadGEM2-ES|historical-rcp85|CCLM4-8-17|ADAMONT"="#E9A9D5" #violet
)
add_multi = TRUE
# eecc66
## 7. PLOT_DOC _______________________________________________________
default_doc_title = "Diagnostic Hydrologique"
doc_correlation_matrix =
list(
title="Matrice de corrélation des critères d'évaluation",
subtitle=NULL,