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"
## Manual selection ##
# Name of the file that will be analysed from the BH directory
""
# c("S2235610_HYDRO_QJM.txt",
# "P1712910_HYDRO_QJM.txt",
# "P0885010_HYDRO_QJM.txt",
# "A1000030_HYDRO_QJM.txt",
# "A2250310_HYDRO_QJM.txt"
# )
# Path to the directory where NV data is stored
NVfiledir =
# Name of the file that will be analysed from the NV directory
NVfilename =
# Path to the list file of metadata about station that will be analysed
### TREND ANALYSIS ###
# Time period to analyse
# Set working directory
setwd(computer_work_path)
# Sourcing R file
source('processing/extractBH.R', encoding='latin1')
source('processing/extractNV.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)
}
# Get only the selected station from a list station file
cnames=c('code',
'station',
'BV_km2',
'axe_principal_concerne',
'longueur_serie',
'commentaires',
'choix'),
######
BHfilename = BHfilename[1:10]
######
# 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)
# Extract metadata about selected stations
df_meta_NV = extractNVlist_meta(computer_data_path, NVfiledir, NVlistdir, NVlistname)
# Extract data about selected stations
df_data_NV = extractNV_data(computer_data_path, NVfiledir, NVfilename)
df_join = join(df_data_BH, df_data_NV, df_meta_BH, df_meta_NV)
# Compute gap parameters for stations
res_QAtrend = get_QAtrend(df_data, period)
res_VCN10trend = get_VCN10trend(df_data, df_meta, period)
# 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,
# header_ratio=3,
# figdir=figdir,
# filename_opt='time')
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),
period=period,
info_header=TRUE,
time_header=df_data,
header_ratio=2,
figdir=figdir,
filename_opt='')
# 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,
# header_ratio=2,
# figdir=figdir,
# filename_opt='')
### /!\ Removed 185 row(s) containing missing values (geom_path) -> remove NA ###