diff --git a/plotting/matrix.R b/plotting/matrix.R index 8dba15437b155ab7184266b60d220e6de33be7bd..0bdf77343edfc8ea321e7a43e6d01bf9436a8df0 100644 --- a/plotting/matrix.R +++ b/plotting/matrix.R @@ -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) diff --git a/processing/extract.R b/processing/extract.R index 522fa81df3e227188ca36133a20ddabd0655838b..e55be5c67483c57512a38c5c926562fadeba125b 100644 --- a/processing/extract.R +++ b/processing/extract.R @@ -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 diff --git a/script.R b/script.R index 5b9e33b18c5829f5db03d72ccbb8d51d0efc85ae..02e9f9e8ff86538a79dd5d4910e60ee0742eed06 100644 --- a/script.R +++ b/script.R @@ -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