From fe31f356261b333291c85f38b5931e434a6f29c9 Mon Sep 17 00:00:00 2001 From: "louis.heraut" <louis.heraut@inrae.fr> Date: Sat, 29 Jan 2022 03:02:05 +0100 Subject: [PATCH] pvalue and trend rect --- plotting/layout.R | 6 ++++++ processing/analyse.R | 25 +------------------------ script.R | 10 +++++----- 3 files changed, 12 insertions(+), 29 deletions(-) diff --git a/plotting/layout.R b/plotting/layout.R index b118aec..66b49f6 100644 --- a/plotting/layout.R +++ b/plotting/layout.R @@ -482,3 +482,9 @@ gpct = function (pct, L, min_lim=NULL, shift=FALSE) { } return (xL) } + +### 5.3. Add months +add_months = function (date, n) { + new_date = seq(date, by = paste (n, "months"), length = 2)[2] + return (new_date) +} diff --git a/processing/analyse.R b/processing/analyse.R index dad623e..248fd7a 100644 --- a/processing/analyse.R +++ b/processing/analyse.R @@ -292,24 +292,15 @@ get_VCN10trend = function (df_data, df_meta, period, p_thresold, sampleSpan) { } ### 1.4. tINI date - which_underfirst = function (L, UpLim) { - ID = which(L <= UpLim) + ID = which(L <= UpLim) dID = diff(ID) dID = c(10, dID) IDjump = which(dID != 1) Njump = length(IDjump) - # print('ID') - # print(ID) - # print('dID') - # print(dID) - # print('IDjump') - # print(IDjump) - # print('') - Periods = vector(mode='list', length=Njump) Nperiod = c() @@ -323,28 +314,14 @@ which_underfirst = function (L, UpLim) { idEnd = length(ID) } - # print(paste('Start', idStart)) - # print(paste('End', idEnd)) - period = ID[idStart:idEnd] - # print(period) - # print('') - Periods[[i]] = period Nperiod = c(Nperiod, length(period)) } - period_max = Periods[[which.max(Nperiod)]] - id = period_max[1] - # print(Nperiod) - # print(id) - - # print('') - # print('NEXT') - # print('') return (id) } diff --git a/script.R b/script.R index 2d206b7..472e788 100644 --- a/script.R +++ b/script.R @@ -58,15 +58,15 @@ filename = # "" c( - # "S2235610_HYDRO_QJM.txt" + # "S2235610_HYDRO_QJM.txt", # "P1712910_HYDRO_QJM.txt", # "P0885010_HYDRO_QJM.txt", # "O5055010_HYDRO_QJM.txt", - # "O0384010_HYDRO_QJM.txt" + # "O0384010_HYDRO_QJM.txt", # "S4214010_HYDRO_QJM.txt", - # "Q7002910_HYDRO_QJM.txt" - # "O3035210_HYDRO_QJM.txt", - # "O0554010_HYDRO_QJM.txt", + # "Q7002910_HYDRO_QJM.txt", + "O3035210_HYDRO_QJM.txt", + "O0554010_HYDRO_QJM.txt", "O1584610_HYDRO_QJM.txt" ) -- GitLab