###### A MODIFIER ###### # Path to the data computer_data_path = "/home/louis/Documents/bouleau/INRAE/CDD_stationnarite/data" # "C:\\Users\\louis.heraut\\Documents\\CDD_stationnarite\\data" # Work path computer_work_path = "/home/louis/Documents/bouleau/INRAE/CDD_stationnarite/ASH" # "C:\\Users\\louis.heraut\\Documents\\CDD_stationnarite\\ASH" ### BANQUE HYDRO ### # Path to the directory where BH data is stored BHfiledir = # "" "BanqueHydro_Export2021" ## Manual selection ## # Name of the file that will be analysed from the BH directory BHfilename = # "" c("H5920011_HYDRO_QJM.txt", "K4470010_HYDRO_QJM.txt") # "all" ## Or list selection ## # Path to the list file of BH data that will be analysed BHlistdir = "" BHlistname = "" # "Liste-station_RRSE.docx" ### NIVALE ### # Path to the directory where NV data is stored NVfiledir = "" # "France207" # Name of the file that will be analysed from the NV directory NVfilename = "" # "all" # Path to the list file of metadata about station that will be analysed NVlistdir = "" NVlistname = "" # "liste_bv_principaux_global.txt" ### TREND ANALYSIS ### # Time period to analyse period = c("1960-01-01","2019-12-31") # period = c("1960-01-01","2020-01-01") ######################## # FILE STRUCTURE # # Set working directory setwd(computer_work_path) # Sourcing R file source('processing/extractBH.R') source('processing/extractNV.R') source('processing/format.R') source('processing/analyse.R') source('plotting/panel.R') # source('plotting/layout.R') # Usefull library # Result directory resdir = file.path(computer_work_path, 'results') if (!(file.exists(resdir))) { dir.create(resdir) } print(paste('resdir :', resdir)) # Figure directory figdir = file.path(computer_work_path, 'figures') if (!(file.exists(figdir))) { dir.create(figdir) } print(paste('figdir :', figdir)) # BANQUE HYDRO # # Get only the selected station from a list station file if (BHlistname != ""){ df_selec = get_selection(computer_data_path, BHlistdir, BHlistname, cnames=c('code', 'station', 'BV_km2', 'axe_principal_concerne', 'longueur_serie', 'commentaires', 'choix'), c_num=c('BV_km2', 'longueur_serie')) BHfilename = df_selec[df_selec$ok,]$filename } # Extract metadata about selected stations df_meta_BH = extractBH_meta(computer_data_path, BHfiledir, BHfilename) # Extract data about selected stations df_data_BH = extractBH_data(computer_data_path, BHfiledir, BHfilename) # NIVALE # # Extract metadata about selected stations df_meta_NV = extractNVlist_meta(computer_data_path, NVfiledir, NVlistdir, NVlistname) ### /!\ missing station info ### # Extract data about selected stations df_data_NV = extractNV_data(computer_data_path, NVfiledir, NVfilename) # JOIN # df_join = join(df_data_BH, df_data_NV, df_meta_BH, df_meta_NV) df_data = df_join$data df_meta = df_join$meta # ANALYSE # # Compute gap parameters for stations # df_lac = get_lacune(df_data, df_meta) # QA TREND # res_QAtrend = get_QAtrend(df_data, period) # QMNA TREND # res_QMNAtrend = get_QMNAtrend(df_data, period) # VCN10 TREND # res_VCN10trend = get_VCN10trend(df_data, df_meta, period) # TIME PANEL # # Plot time panel of debit by stations panel(list(df_data, res_QAtrend$data, res_QMNAtrend$data, res_VCN10trend$data), df_meta=df_meta, figdir=figdir, df_trend=list(NULL, res_QAtrend$trend, res_QMNAtrend$trend, res_VCN10trend$trend), type=list('time', '', '', ''), missRect=list(TRUE, TRUE, TRUE, TRUE), ) # panel(df_data, df_meta=df_meta, figdir=figdir, missRect=TRUE, type='sqrt') ### /!\ Removed 185 row(s) containing missing values (geom_path) -> remove NA ###