Commit fe31f356 authored by Heraut Louis's avatar Heraut Louis
Browse files

pvalue and trend rect

parent 983abfe9
No related merge requests found
Showing with 12 additions and 29 deletions
+12 -29
...@@ -482,3 +482,9 @@ gpct = function (pct, L, min_lim=NULL, shift=FALSE) { ...@@ -482,3 +482,9 @@ gpct = function (pct, L, min_lim=NULL, shift=FALSE) {
} }
return (xL) 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)
}
...@@ -292,24 +292,15 @@ get_VCN10trend = function (df_data, df_meta, period, p_thresold, sampleSpan) { ...@@ -292,24 +292,15 @@ get_VCN10trend = function (df_data, df_meta, period, p_thresold, sampleSpan) {
} }
### 1.4. tINI date ### 1.4. tINI date
which_underfirst = function (L, UpLim) { which_underfirst = function (L, UpLim) {
ID = which(L <= UpLim)
ID = which(L <= UpLim)
dID = diff(ID) dID = diff(ID)
dID = c(10, dID) dID = c(10, dID)
IDjump = which(dID != 1) IDjump = which(dID != 1)
Njump = length(IDjump) Njump = length(IDjump)
# print('ID')
# print(ID)
# print('dID')
# print(dID)
# print('IDjump')
# print(IDjump)
# print('')
Periods = vector(mode='list', length=Njump) Periods = vector(mode='list', length=Njump)
Nperiod = c() Nperiod = c()
...@@ -323,28 +314,14 @@ which_underfirst = function (L, UpLim) { ...@@ -323,28 +314,14 @@ which_underfirst = function (L, UpLim) {
idEnd = length(ID) idEnd = length(ID)
} }
# print(paste('Start', idStart))
# print(paste('End', idEnd))
period = ID[idStart:idEnd] period = ID[idStart:idEnd]
# print(period)
# print('')
Periods[[i]] = period Periods[[i]] = period
Nperiod = c(Nperiod, length(period)) Nperiod = c(Nperiod, length(period))
} }
period_max = Periods[[which.max(Nperiod)]] period_max = Periods[[which.max(Nperiod)]]
id = period_max[1] id = period_max[1]
# print(Nperiod)
# print(id)
# print('')
# print('NEXT')
# print('')
return (id) return (id)
} }
......
...@@ -58,15 +58,15 @@ filename = ...@@ -58,15 +58,15 @@ filename =
# "" # ""
c( c(
# "S2235610_HYDRO_QJM.txt" # "S2235610_HYDRO_QJM.txt",
# "P1712910_HYDRO_QJM.txt", # "P1712910_HYDRO_QJM.txt",
# "P0885010_HYDRO_QJM.txt", # "P0885010_HYDRO_QJM.txt",
# "O5055010_HYDRO_QJM.txt", # "O5055010_HYDRO_QJM.txt",
# "O0384010_HYDRO_QJM.txt" # "O0384010_HYDRO_QJM.txt",
# "S4214010_HYDRO_QJM.txt", # "S4214010_HYDRO_QJM.txt",
# "Q7002910_HYDRO_QJM.txt" # "Q7002910_HYDRO_QJM.txt",
# "O3035210_HYDRO_QJM.txt", "O3035210_HYDRO_QJM.txt",
# "O0554010_HYDRO_QJM.txt", "O0554010_HYDRO_QJM.txt",
"O1584610_HYDRO_QJM.txt" "O1584610_HYDRO_QJM.txt"
) )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment