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

Cleaned and commented

parent 401bddf1
No related merge requests found
Showing with 24 additions and 11 deletions
+24 -11
......@@ -34,7 +34,7 @@ matrix_panel = function (list_df2plot, df_meta, trend_period, mean_period, slice
nbp = length(list_df2plot)
# Get all different stations code
Code = levels(factor(df_meta$code))
Code = levels(factor(df_meta$code))
nCode = length(Code)
# Gets a trend example
......@@ -409,7 +409,7 @@ matrix_panel = function (list_df2plot, df_meta, trend_period, mean_period, slice
fL = firstLetter[ifL]
# Print the matrix name
print(paste('Matrix for region : ', fL,
" (", round(ifL/nCode*100, 1), " %)",
" (", round(ifL/nfL*100, 1), " %)",
sep=''))
# Get only station code with the same first letter
......@@ -424,6 +424,8 @@ matrix_panel = function (list_df2plot, df_meta, trend_period, mean_period, slice
subCode = subCodefL[(slice*(imat-1)+1):(slice*imat)]
# Removes NA stations
subCode = subCode[!is.na(subCode)]
# Reverses verticale order of stations
subCode = rev(subCode)
# Gets the number of station for the page
nsubCode = length(subCode)
......@@ -494,6 +496,10 @@ matrix_panel = function (list_df2plot, df_meta, trend_period, mean_period, slice
for (j in 1:nPeriod_trend) {
# Extracts the info to plot associated to the
# right period
Periods_trend_per =
subPeriods_trend[subNPeriod_trend == j]
NPeriods_trend_per =
subNPeriod_trend[subNPeriod_trend == j]
Type_trend_per =
subType_trend[subNPeriod_trend == j]
Code_trend_per =
......@@ -522,6 +528,8 @@ matrix_panel = function (list_df2plot, df_meta, trend_period, mean_period, slice
# Computes Y positions of each line for each station
Y = as.integer(factor(Code_trend_per))
# Reverses vertical order of stations
Y = rev(Y)
# Position of a line to delimite periods
x = Xc - 0.4
......@@ -641,8 +649,7 @@ matrix_panel = function (list_df2plot, df_meta, trend_period, mean_period, slice
# Gets the code
code = subCode[k]
# Extracts label for the period dates
label = Periods_trend[subNPeriod_trend == j
& subCode_trend == code][1]
label = Periods_trend_per[Code_trend_per == code][1]
# Gets the start and end of the period
# for the station
periodStart = substr(label, 1, 4)
......@@ -667,6 +674,10 @@ matrix_panel = function (list_df2plot, df_meta, trend_period, mean_period, slice
for (j in 1:nPeriod_mean) {
# Extracts the info to plot associated to the
# right period
Periods_mean_per =
subPeriods_mean[subNPeriod_mean == j]
NPeriods_mean_per =
subNPeriod_mean[subNPeriod_mean == j]
Type_mean_per =
subType_mean[subNPeriod_mean == j]
Code_mean_per =
......@@ -694,7 +705,9 @@ matrix_panel = function (list_df2plot, df_meta, trend_period, mean_period, slice
# Computes Y positions of each line for each station
Y_mean = as.integer(factor(Code_mean_per))
# Reverses vertical order of stations
Y_mean = rev(Y_mean)
# Position of a line to delimite periods
x = Xc_mean - 0.4
xend = Xm_mean[length(Xm_mean)] + 0.25
......@@ -841,8 +854,7 @@ matrix_panel = function (list_df2plot, df_meta, trend_period, mean_period, slice
# Gets the code
code = subCode[k]
# Extracts label for the period dates
label = Periods_mean[subNPeriod_mean == j
& subCode_mean == code][1]
label = Periods_mean_per[Code_mean_per == code][1]
# Gets the start and end of the period
# for the station
periodStart = substr(label, 1, 4)
......
......@@ -163,7 +163,7 @@ create_selection = function (computer_data_path, filedir, outname) {
# create_selection(
# "/home/louis/Documents/bouleau/INRAE/CDD_stationnarite/data",
# "France207",
# "nival_selection.txt")
# "INRAE_selection.txt")
### 2.2. Agence de l'eau Adour-Garonne selection
# Gets the selection of station from the 'Liste-station_RRSE.docx' file
......@@ -247,7 +247,7 @@ get_selection_IN = function (computer_data_path, listdir, listname) {
# df_selec_IN = get_selection_IN(
# "/home/louis/Documents/bouleau/INRAE/CDD_stationnarite/data",
# "",
# "nival_selection.txt")
# "INRAE_selection.txt")
## 3. EXTRACTION
......
......@@ -67,7 +67,8 @@ filename =
# c("S4214010_HYDRO_QJM.txt",
# "O0384010_HYDRO_QJM.txt",
# "Q7002910_HYDRO_QJM.txt")
# "Q7002910_HYDRO_QJM.txt",
# "O0485110_HYDRO_QJM.txt")
......@@ -89,7 +90,7 @@ INlistdir =
INlistname =
""
# "nival_selection.txt"
# "INRAE_selection.txt"
## TREND ANALYSIS
......
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