diff --git a/plotting/layout.R b/plotting/layout.R index b118aecb8bb2cc2fa0fabf16cd680b436e3792f7..66b49f69cf310f9741337ea6799c1ebffca0c49d 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 dad623eefb6a06572921e44797560f641093761b..248fd7a14b2eff748ecd6c34c712e68d07798d15 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 2d206b77579770fd89bc1a2f96567ffb685ae585..472e7881145a9ea951375ceeebf443be64fa6180 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" )