Newer
Older
computer_data_path =
"/home/louis/Documents/bouleau/INRAE/CDD_stationnarite/data"
# "C:\\Users\\louis.heraut\\Documents\\CDD_stationnarite\\data"
computer_work_path =
"/home/louis/Documents/bouleau/INRAE/CDD_stationnarite/ASH"
# "C:\\Users\\louis.heraut\\Documents\\CDD_stationnarite\\ASH"
filedir =
# ""
"BanqueHydro_Export2021"
### MANUAL SELECTION ###
# Name of the file that will be analysed from the AG directory
filename =
# ""
# c(
# "S2235610_HYDRO_QJM.txt",
# "P1712910_HYDRO_QJM.txt",
# "P0885010_HYDRO_QJM.txt",
c("O3035210_HYDRO_QJM.txt",
"O3011010_HYDRO_QJM.txt",
"O1442910_HYDRO_QJM.txt")
### AGENCE ADOUR GARONNE SELECTION ###
# Path to the list file of AG data that will be analysed
AGlistdir =
# Path to the list file of metadata about station that will be analysed
### TREND ANALYSIS ###
# Time period to analyse
period2 = c("1968-01-01", "2019-12-31")
period = list(period_all, period2)
# p value
p_thresold = 0.1 #c(0.01, 0.05, 0.1)
# Set working directory
setwd(computer_work_path)
# Sourcing R file
source('processing/extract.R', encoding='latin1')
source('processing/format.R', encoding='latin1')
source('processing/analyse.R', encoding='latin1')
source('plotting/panel.R', encoding='latin1')
# 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)
}
df_data_AG = NULL
df_data_NV = NULL
df_meta_AG = NULL
df_meta_NV = NULL
# AGENCE ADOUR GARONNE SELECTION #
if (AGlistname != ""){
# Get only the selected station from a list station file
df_selec_AG = get_selection_AG(computer_data_path,
AGlistdir,
AGlistname,
cnames=c('code',
'station',
'BV_km2',
'axe_principal_concerne',
'longueur_serie',
'commentaires',
'choix'),
filename = df_selec_AG[df_selec_AG$ok,]$filename
# Extract metadata about selected stations
df_meta_AG = extract_meta(computer_data_path, filedir, filename)
# Extract data about selected stations
df_data_AG = extract_data(computer_data_path, filedir, filename)
# NIVALE SELECTION #
if (NVlistname != ""){
# Get only the selected station from a list station file
df_selec_NV = get_selection_NV(computer_data_path,
NVlistdir,
NVlistname)
filename = df_selec_NV[df_selec_NV$ok,]$filename
# Extract metadata about selected stations
df_meta_NV = extract_meta(computer_data_path, filedir, filename)
# Extract data about selected stations
df_data_NV = extract_data(computer_data_path, filedir, filename)
}
# MANUAL SELECTION #
if (AGlistname == "" & NVlistname == "") {
# Extract metadata about selected stations
df_meta_AG = extract_meta(computer_data_path, filedir, filename)
# Extract data about selected stations
df_data_AG = extract_data(computer_data_path, filedir, filename)
}
df_join = join(df_data_AG, df_data_NV, df_meta_AG, df_meta_NV)
# Compute gap parameters for stations
res_QAtrend = get_QAtrend(df_data, period=period, p_thresold=p_thresold)
res_QMNAtrend = get_QMNAtrend(df_data, period=period,
p_thresold=p_thresold)
# TIME PANEL #
# Plot time panel of debit by stations
# panels_layout(list(df_data, df_data),
# layout_matrix=c(1, 2),
# df_meta=df_meta,
# missRect=list(TRUE, TRUE),
# type=list('Q', 'sqrt(Q)'),
# info_header=TRUE,
# time_header=NULL,
panels_layout(list(res_QAtrend$data, res_QMNAtrend$data,
res_VCN10trend$data),
layout_matrix=c(1, 2, 3),
type=list(bquote(Q[A]), bquote(Q[MNA]), bquote(V[CN10])),
missRect=list(TRUE, TRUE, TRUE),
info_header=TRUE,
time_header=df_data,
time_ratio=2,
# panels_layout(list(res_QAtrend$data, res_VCN10trend$data),
# layout_matrix=c(1, 2),
# df_meta=df_meta,
# df_trend=list(res_QAtrend$trend,
# res_VCN10trend$trend),
# type=list(bquote(Q[A]), bquote(V[CN10])),
# missRect=list(TRUE, TRUE),
# period=period,
# info_header=TRUE,
# time_header=df_data,
# time_ratio=2,
# var_ratio=5,
# figdir=figdir,
# filename_opt='')
# df_trend=list(res_QMNAtrend$trend),
# type=list(bquote(Q[MNA])),
# info_header=TRUE,
# time_header=df_data,
# time_ratio=2,
# var_ratio=5,
# figdir=figdir,
# filename_opt='')
### /!\ Removed 185 row(s) containing missing values (geom_path) -> remove NA ###