diff --git a/plotting/layout.R b/plotting/layout.R index d90002c041d8471e48fa2b6dca7d78db8a1f7dcf..0b057de716d8ade293d713b5c26acd4eb4e727bc 100644 --- a/plotting/layout.R +++ b/plotting/layout.R @@ -14,7 +14,7 @@ library(RColorBrewer) source('plotting/panel.R', encoding='latin1') -panels_layout = function (df_data, df_meta, layout_matrix, isplot=c('datasheet', 'matrix', 'map'), figdir='', filedir_opt='', filename_opt='', variable='', df_trend=NULL, p_threshold=0.1, unit2day=365.25, type='', trend_period=NULL, mean_period=NULL, axis_xlim=NULL, missRect=FALSE, time_header=NULL, info_header=TRUE, info_ratio=1, time_ratio=2, var_ratio=3, fr_shpdir=NULL, fr_shpname=NULL, bs_shpdir=NULL, bs_shpname=NULL, rv_shpdir=NULL, rv_shpname=NULL, computer_data_path=NULL) { +panels_layout = function (df_data, df_meta, layout_matrix, isplot=c('datasheet', 'matrix', 'map'), figdir='', filedir_opt='', filename_opt='', variable='', df_trend=NULL, p_threshold=0.1, unit2day=365.25, type='', trend_period=NULL, mean_period=NULL, axis_xlim=NULL, missRect=FALSE, time_header=NULL, info_header=TRUE, info_ratio=1, time_ratio=2, var_ratio=3, df_shapefile=NULL) { outfile = "Panels" if (filename_opt != '') { @@ -195,7 +195,11 @@ panels_layout = function (df_data, df_meta, layout_matrix, isplot=c('datasheet', dataMean = mean(df_data_code_per$Qm3s, na.rm=TRUE) trendMean = df_trend_code_per$trend / dataMean - TrendMean_code[j, i, k] = trendMean + if (df_trend_code_per$p <= p_threshold){ + TrendMean_code[j, i, k] = trendMean + } else { + TrendMean_code[j, i, k] = NA + } } } } @@ -218,16 +222,11 @@ panels_layout = function (df_data, df_meta, layout_matrix, isplot=c('datasheet', Hinfo = info_panel(list_df2plot, df_meta, - computer_data_path=computer_data_path, - fr_shpdir=fr_shpdir, - fr_shpname=fr_shpname, - bs_shpdir=bs_shpdir, - bs_shpname=bs_shpname, - rv_shpdir=rv_shpdir, - rv_shpname=rv_shpname, + df_shapefile=df_shapefile, codeLight=code, df_data_code=time_header_code) P[[1]] = Hinfo + # P[[1]] = void } if (!is.null(time_header)) { @@ -401,13 +400,7 @@ panels_layout = function (df_data, df_meta, layout_matrix, isplot=c('datasheet', map_panel(list_df2plot, df_meta, idPer=length(trend_period), - computer_data_path=computer_data_path, - fr_shpdir=fr_shpdir, - fr_shpname=fr_shpname, - bs_shpdir=bs_shpdir, - bs_shpname=bs_shpname, - rv_shpdir=rv_shpdir, - rv_shpname=rv_shpname, + df_shapefile=df_shapefile, outdirTmp=outdirTmp, margin=margin(t=5, r=0, b=5, l=5, unit="mm")) } diff --git a/plotting/panel.R b/plotting/panel.R index dfea80c1ecc5a3efe7f4352393469cd1c68a07b1..2183d16665c32787889cd95f190d71529bcc7979 100644 --- a/plotting/panel.R +++ b/plotting/panel.R @@ -9,8 +9,7 @@ library(grid) library(ggh4x) library(RColorBrewer) library(rgdal) - - +library(shadowtext) display_type = function (type, bold=FALSE) { @@ -802,7 +801,11 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic dataMean = mean(df_data_code_per$Qm3s, na.rm=TRUE) trendMean = df_trend_code_per$trend / dataMean - TrendMean_code[j, i, k] = trendMean + if (df_trend_code_per$p <= p_threshold){ + TrendMean_code[j, i, k] = trendMean + } else { + TrendMean_code[j, i, k] = NA + } } } } @@ -1012,24 +1015,22 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic print(paste('matrix for region :', fL)) + # Get only station code with the same first letter subCodefL = Code[substr(Code, 1, 1) == fL] nsubCodefL = length(subCodefL) nMat = as.integer(nsubCodefL/slice) + 1 - + + # print(nsubCodefL) # print(nMat) for (imat in 1:nMat) { subCode = subCodefL[(slice*(imat-1)+1):(slice*imat)] subCode = subCode[!is.na(subCode)] - - # print('aaa') - # print(subCode) - nsubCode = length(subCode) - CodefL_trend = substr(Code_trend, 1, 1) == fL + CodefL_trend = Code_trend %in% subCode subPeriods_trend = Periods_trend[CodefL_trend] subNPeriod_trend = NPeriod_trend[CodefL_trend] @@ -1040,10 +1041,8 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic subDataMean_trend = DataMean_trend[CodefL_trend] subFill_trend = Fill_trend[CodefL_trend] subColor_trend = Color_trend[CodefL_trend] - - # print(subNPeriod_trend) - CodefL_mean = substr(Code_mean, 1, 1) == fL + CodefL_mean = Code_mean %in% subCode subPeriods_mean = Periods_mean[CodefL_mean] subNPeriod_mean = NPeriod_mean[CodefL_mean] @@ -1056,10 +1055,9 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic title = df_meta[df_meta$code == subCode[1],]$region_hydro - # print('bbb') ### Plot ### - height = length(subCode) + height = nsubCode width = nbp * 2 * nPeriod_trend + nPeriod_trend + nPeriod_mean * nbp + nPeriod_mean + nbp options(repr.plot.width=width, repr.plot.height=height) @@ -1087,7 +1085,6 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic size=6, color="#00A3A8") - # print('ccc') ### Trend ### for (j in 1:nPeriod_trend) { @@ -1130,7 +1127,6 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic Start = trend_period[[j]][1] End = trend_period[[j]][2] periodName = bquote(bold('Période')~bold(.(as.character(j)))) - # bquote(bold(.(Start))~'/'~bold(.(End))) mat = mat + annotate("text", x=x, y=yt, @@ -1193,18 +1189,18 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic annotate('text', x=X[i], y=max(Y) + 0.7, label=bquote(.(type)), hjust=0.5, vjust=0.5, - size=3.5, color='grey20') + + size=3.25, color='grey20') + annotate('text', x=Xm[i], y=max(Y) + 0.7, label=bquote('µ'*.(type)), hjust=0.5, vjust=0.5, - size=3.5, color='grey20') + size=3.25, color='grey20') } for (k in 1:nsubCode) { code = subCode[k] - label = Periods_trend[NPeriod_trend == j + label = Periods_trend[subNPeriod_trend == j & subCode_trend == code][1] periodStart = substr(label, 1, 4) periodEnd = substr(label, 14, 17) @@ -1222,9 +1218,6 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic } } - # print('ddd') - - ### Mean ### for (j in 1:nPeriod_mean) { @@ -1240,8 +1233,6 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic subFill_mean[subNPeriod_mean == j] Color_mean_per = subColor_mean[subNPeriod_mean == j] - - # print('ddd1') Xtmp_mean = as.integer(factor(as.character(Type_mean_per))) @@ -1273,8 +1264,6 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic label=periodName, hjust=0, vjust=0.5, size=3, color='grey40') - - # print('ddd2') if (j > 1) { x = Xr_mean[1] - 0.4 @@ -1286,7 +1275,7 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic y=y, yend=yend, color="grey40", size=0.35) - breakName = bquote(bold('Rupture')~bold(.(as.character(j-1+nPeriod_trend)))*bold('-')*bold(.(as.character(j+nPeriod_trend)))) + breakName = bquote(bold('Écart')~bold(.(as.character(j-1+nPeriod_trend)))*bold('-')*bold(.(as.character(j+nPeriod_trend)))) mat = mat + annotate("text", x=x, y=yt, @@ -1294,8 +1283,6 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic hjust=0, vjust=0.5, size=3, color='grey40') } - - # print('ddd3') for (i in 1:length(Xm_mean)) { mat = mat + @@ -1314,12 +1301,8 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic } } - # print('ddd4') - for (i in 1:length(DataMean_mean_per)) { dataMean = signif(DataMean_mean_per[i], 2) - - # print(i) mat = mat + annotate('text', x=Xm_mean[i], y=Y[i], @@ -1330,8 +1313,6 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic if (j > 1) { BreakMean = BreakMean_mean_per[i] BreakC = signif(BreakMean*100, 2) - - # print(BreakMean) mat = mat + annotate('text', x=Xr_mean[i], y=Y[i], @@ -1340,8 +1321,6 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic size=3, color='white') } } - - # print('ddd5') mat = mat + annotate('text', x=Xc_mean, y=max(Y) + 0.85, @@ -1353,9 +1332,6 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic label=bquote(bold('Fin')), hjust=0.5, vjust=0.5, size=3, color='grey20') - - - # print('ddd6') for (i in 1:nbp) { type = list_df2plot[[i]]$type @@ -1363,22 +1339,20 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic annotate('text', x=Xm_mean[i], y=max(Y) + 0.7, label=bquote('µ'*.(type)), hjust=0.5, vjust=0.5, - size=3.5, color='grey20') + size=3.25, color='grey20') if (j > 1) { mat = mat + annotate('text', x=Xr_mean[i], y=max(Y) + 0.7, label=bquote('d'*.(type)), hjust=0.5, vjust=0.5, - size=3.5, color='grey20') + size=3.25, color='grey20') } } - # print('ddd7') - for (k in 1:nsubCode) { code = subCode[k] - label = Periods_mean[NPeriod_mean == j + label = Periods_mean[subNPeriod_mean == j & subCode_mean == code][1] periodStart = substr(label, 1, 4) periodEnd = substr(label, 14, 17) @@ -1395,8 +1369,6 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic size=3, color='grey40') } } - - # print('eee') ### Code ### for (k in 1:nsubCode) { @@ -1463,29 +1435,14 @@ matrice_panel = function (list_df2plot, df_meta, trend_period, mean_period, slic } +map_panel = function (list_df2plot, df_meta, df_shapefile, idPer=1, outdirTmp='', codeLight=NULL, margin=NULL, showSea=TRUE) { -map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_shpname, bs_shpdir, bs_shpname, rv_shpdir, rv_shpname, idPer=1, outdirTmp='', codeLight=NULL, margin=NULL, showSea=TRUE) { - fr_shppath = file.path(computer_data_path, fr_shpdir, fr_shpname) - rv_shppath = file.path(computer_data_path, rv_shpdir, rv_shpname) - bs_shppath = file.path(computer_data_path, bs_shpdir, bs_shpname) - - # France - fr_spdf = readOGR(dsn=fr_shppath, verbose=FALSE) - proj4string(fr_spdf) = CRS("+proj=longlat +ellps=WGS84") - # Trasnformation en Lambert93 - france = spTransform(fr_spdf, CRS("+init=epsg:2154")) - df_france = tibble(fortify(france)) - - # Bassin hydrographique - bassin = readOGR(dsn=bs_shppath, verbose=FALSE) - df_bassin = tibble(fortify(bassin)) - - # Réseau hydrographique - river = readOGR(dsn=rv_shppath, verbose=FALSE) ### trop long ### - river = river[which(river$Classe == 1),] - df_river = tibble(fortify(river)) + df_france = df_shapefile$france + df_bassin = df_shapefile$bassin + df_river = df_shapefile$river + # Number of type/variable nbp = length(list_df2plot) # Get all different stations code @@ -1585,7 +1542,11 @@ map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s dataMean = mean(df_data_code_per$Qm3s, na.rm=TRUE) trendMean = df_trend_code_per$trend / dataMean - TrendMean_code[j, i, k] = trendMean + if (df_trend_code_per$p <= p_threshold){ + TrendMean_code[j, i, k] = trendMean + } else { + TrendMean_code[j, i, k] = NA + } } } } @@ -1606,6 +1567,16 @@ map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s print(paste('map :', outname)) type = list_df2plot[[i]]$type + + if (is.null(codeLight)) { + sizefr = 0.45 + sizebs = 0.4 + sizerv = 0.3 + } else { + sizefr = 0.35 + sizebs = 0.3 + sizerv = 0.2 + } map = ggplot() + theme_void() + @@ -1616,19 +1587,23 @@ map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s geom_polygon(data=df_france, aes(x=long, y=lat, group=group), - color=NA, fill="grey97") + - - geom_path(data=df_river, - aes(x=long, y=lat, group=group), - color="grey85", size=0.3) + - + color=NA, fill="grey97") + + if (!is.null(df_river)) { + map = map + + geom_path(data=df_river, + aes(x=long, y=lat, group=group), + color="grey85", size=sizerv) + } + + map = map + geom_polygon(data=df_bassin, aes(x=long, y=lat, group=group), - color="grey70", fill=NA, size=0.1) + + color="grey70", fill=NA, size=sizebs) + geom_polygon(data=df_france, aes(x=long, y=lat, group=group), - color="grey40", fill=NA, size=0.2) + color="grey40", fill=NA, size=sizefr) if (showSea) { xlim = c(280000, 790000) @@ -1643,27 +1618,36 @@ map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s xint = c(0, 10*1E3, 50*1E3, 100*1E3) ymin = gpct(5, ylim, shift=TRUE) ymax = ymin + gpct(1, ylim) + size = 3 + sizekm = 3 + } else { + xmin = gpct(5, xlim, shift=TRUE) + xint = c(0, 100*1E3) + ymin = gpct(1, ylim, shift=TRUE) + ymax = ymin + gpct(3, ylim) + size = 2 + sizekm = 1.5 + } + + map = map + + geom_line(aes(x=c(xmin, max(xint)+xmin), + y=c(ymin, ymin)), + color="grey40", size=0.2) + + annotate("text", + x=max(xint)+xmin+gpct(1, xlim), y=ymin, + vjust=0, hjust=0, label="km", + color="grey40", size=sizekm) + + for (x in xint) { map = map + - - geom_line(aes(x=c(xmin, max(xint)+xmin), - y=c(ymin, ymin)), - color="grey40", size=0.2) + + annotate("segment", + x=x+xmin, xend=x+xmin, y=ymin, yend=ymax, + color="grey40", size=0.2) + annotate("text", - x=max(xint)+xmin+gpct(1, xlim), y=ymin, - vjust=0, hjust=0, label="km", - color="grey40", size=3) - - for (x in xint) { - map = map + - annotate("segment", - x=x+xmin, xend=x+xmin, y=ymin, yend=ymax, - color="grey40", size=0.2) + - annotate("text", - x=x+xmin, y=ymax+gpct(0.5, ylim), - vjust=0, hjust=0.5, label=x/1E3, - color="grey40", size=3) - } + x=x+xmin, y=ymax+gpct(0.5, ylim), + vjust=0, hjust=0.5, label=x/1E3, + color="grey40", size=size) } map = map + @@ -1736,7 +1720,7 @@ map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s } } else { - filltmp = color_res + filltmp = 'grey97' shapetmp = 21 } @@ -1797,15 +1781,17 @@ map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s title = ggplot() + theme_void() + - annotate('text', - x=-0.3, y=0.15, - label=bquote(bold(.(type))), - hjust=0, vjust=0, - size=10, color="#00A3A8") + - geom_line(aes(x=c(-0.3, 3.3), y=c(0.05, 0.05)), size=0.6, color="#00A3A8") + + geom_shadowtext(data=tibble(x=-0.3, y=0.2, + label=type), + aes(x=x, y=y, label=label), + fontface="bold", + color="#00A3A8", + bg.colour="white", + hjust=0, vjust=0, size=10) + + scale_x_continuous(limits=c(-1, 1 + 3), expand=c(0, 0)) + @@ -1906,7 +1892,7 @@ map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s annotate('text', x=2.8, y=valNorm*0.5, - label= "Plus sec", + label= "Plus sévère", angle=90, hjust=0.5, vjust=1, size=3, color='grey50') @@ -1953,18 +1939,23 @@ hydrogramme = function (df_data_code, margin=NULL) { } monthNum = 1:12 - monthName = c("jan", "fév", "mar", "avr", "mai", "jun", - "jul", "aoû", "sep", "oct", "nov", "déc") - monthName = factor(monthName, levels=monthName) + monthName = c("J", "F", "M", "A", "M", "J", + "J", "A", "S", "O", "N", "D") + # monthName = factor(monthName, levels=monthName) hyd = ggplot() + theme_ash + + theme( # plot.background=element_rect(fill=NA, color="#EC4899"), panel.border=element_blank(), axis.text.x=element_text(margin=unit(c(0, 0, 0, 0), "mm"), - angle=90, vjust=0.5, hjust=1), + vjust=1, hjust=0.5), axis.ticks.x=element_blank(), - axis.line.y=element_line(color='grey85', size=0.3)) + axis.line.y=element_line(color='grey85', size=0.3), + plot.title=element_text(size=8, vjust=-1.5, + hjust=-1E-3, color='grey40')) + + + ggtitle(bquote(bold('Q')~~'['*m^{3}*'.'*s^{-1}*']')) if (is.null(margin)) { hyd = hyd + @@ -1993,7 +1984,7 @@ hydrogramme = function (df_data_code, margin=NULL) { } -info_panel = function(list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_shpname, bs_shpdir, bs_shpname, rv_shpdir, rv_shpname, codeLight, df_data_code=NULL) { +info_panel = function(list_df2plot, df_meta, df_shapefile, codeLight, df_data_code=NULL) { if (!is.null(df_data_code)) { hyd = hydrogramme(df_data_code, @@ -2006,20 +1997,14 @@ info_panel = function(list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s # yearLast = format(databin$Date[nrow(databin)], "%Y") # yearFirst = format(databin$Date[1], "%Y") # Nyear = as.numeric(yearLast) - as.numeric(yearFirst) + 1 - + map = map_panel(list_df2plot, df_meta, - computer_data_path=computer_data_path, - fr_shpdir=fr_shpdir, - fr_shpname=fr_shpname, - bs_shpdir=bs_shpdir, - bs_shpname=bs_shpname, - rv_shpdir=rv_shpdir, - rv_shpname=rv_shpname, + df_shapefile=df_shapefile, codeLight=codeLight, margin=margin(t=5, r=2, b=0, l=0, unit="mm"), showSea=FALSE) - + df_meta_code = df_meta[df_meta$code == codeLight,] nom = df_meta_code$nom @@ -2091,17 +2076,17 @@ info_panel = function(list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s # P = list(void, void, void, void, void, void, void) LM = matrix(c(1, 1, 1, 6, - 7, 7, 7, 6, + # 7, 7, 7, 6, 2, 2, 5, 6, # 2, 2, 5, 6, 3, 4, 5, 6, 3, 4, 5, 6), - nrow=5, + nrow=4, byrow=TRUE) heights = rep(1, times=nrow(LM)) - heights[2] = 0.1 - heights[3] = 0.8 + # heights[2] = 0.1 + heights[2] = 0.8 plot = grid.arrange(grobs=P, layout_matrix=LM, diff --git a/processing/extract.R b/processing/extract.R index b66e8752318937076b4f2a419cf5421a46ec90d2..3a004d7a76da5d21ebc6ec409a8d70b2c83bd616 100644 --- a/processing/extract.R +++ b/processing/extract.R @@ -161,18 +161,18 @@ get_selection_AG = function (computer_data_path, listdir, listname, } # Example -df_selec_AG = get_selection_AG( - "/home/louis/Documents/bouleau/INRAE/CDD_stationnarite/data", - "", - "Liste-station_RRSE.docx", - cnames=c('code','station', - 'BV_km2', - 'axe_principal_concerne', - 'longueur_serie', - 'commentaires', - 'choix'), - c_num=c('BV_km2', - 'longueur_serie')) +# df_selec_AG = get_selection_AG( + # "/home/louis/Documents/bouleau/INRAE/CDD_stationnarite/data", + # "", + # "Liste-station_RRSE.docx", + # cnames=c('code','station', + # 'BV_km2', + # 'axe_principal_concerne', + # 'longueur_serie', + # 'commentaires', + # 'choix'), + # c_num=c('BV_km2', + # 'longueur_serie')) get_selection_NV = function (computer_data_path, listdir, listname) { @@ -410,3 +410,34 @@ extract_data = function (computer_data_path, filedir, filename, verbose=TRUE) { # "/home/louis/Documents/bouleau/INRAE/CDD_stationnarite/data", # '', # c('H5920011_HYDRO_QJM.txt', 'K4470010_HYDRO_QJM.txt')) + + +ini_shapefile = function (computer_data_path, fr_shpdir, fr_shpname, bs_shpdir, bs_shpname, rv_shpdir, rv_shpname, riv=TRUE) { + + # Path for shapefile + fr_shppath = file.path(computer_data_path, fr_shpdir, fr_shpname) + bs_shppath = file.path(computer_data_path, bs_shpdir, bs_shpname) + rv_shppath = file.path(computer_data_path, rv_shpdir, rv_shpname) + + # France + fr_spdf = readOGR(dsn=fr_shppath, verbose=FALSE) + proj4string(fr_spdf) = CRS("+proj=longlat +ellps=WGS84") + # Transformation in Lambert93 + france = spTransform(fr_spdf, CRS("+init=epsg:2154")) + df_france = tibble(fortify(france)) + + # Bassin hydrographique + bassin = readOGR(dsn=bs_shppath, verbose=FALSE) + df_bassin = tibble(fortify(bassin)) + + if (riv) { + # Réseau hydrographique + river = readOGR(dsn=rv_shppath, verbose=FALSE) ### trop long ### + river = river[which(river$Classe == 1),] + df_river = tibble(fortify(river)) + } else { + df_river = NULL + } + + return (list(france=df_france, bassin=df_bassin, river=df_river)) +} diff --git a/script.R b/script.R index fb06055c392cbec52faaafec7cefa6439f66bc8d..4e0a9ae72729009c2420ab202694731bcea352fd 100644 --- a/script.R +++ b/script.R @@ -22,7 +22,7 @@ filedir = ### MANUAL SELECTION ### # Name of the file that will be analysed from the AG directory filename = - "" + # "" # c( # "S2235610_HYDRO_QJM.txt", @@ -32,9 +32,9 @@ filename = # "Q7002910_HYDRO_QJM.txt" # ) - # c("S4214010_HYDRO_QJM.txt", - # "O0384010_HYDRO_QJM.txt", - # "Q7002910_HYDRO_QJM.txt") + c("S4214010_HYDRO_QJM.txt", + "O0384010_HYDRO_QJM.txt", + "Q7002910_HYDRO_QJM.txt") @@ -44,8 +44,8 @@ AGlistdir = "" AGlistname = - # "" - "Liste-station_RRSE.docx" + "" + # "Liste-station_RRSE.docx" ### NIVALE SELECTION ### @@ -142,7 +142,7 @@ if (AGlistname != ""){ filename = df_selec_AG[df_selec_AG$ok,]$filename ##### - filename = filename[(1):(20)] + # filename = filename[(1):(25)] ##### # Extract metadata about selected stations @@ -234,14 +234,22 @@ res_VCN10trend = get_VCN10trend(df_data, df_meta, # figdir=figdir, # filename_opt='time') -panels_layout(isplot=c('datasheet', 'matrix', 'map'), + +# df_shapefile = ini_shapefile(computer_data_path, fr_shpdir, fr_shpname, bs_shpdir, bs_shpname, rv_shpdir, rv_shpname, riv=FALSE) + + +panels_layout(isplot=c( + 'datasheet' + # 'matrix' + # 'map' + ), df_data=list(res_QAtrend$data, res_QMNAtrend$data, res_VCN10trend$data), layout_matrix=c(1, 2, 3), - df_meta=df_meta, + df_meta=df_meta, df_trend=list(res_QAtrend$trend, res_QMNAtrend$trend, res_VCN10trend$trend), - type=list(bquote(Q[A]), bquote(Q[MNA]), bquote(V[CN10])), + type=list('QA', 'QMNA', 'VCN10'), missRect=list(TRUE, TRUE, TRUE), trend_period=trend_period, mean_period=mean_period, @@ -250,26 +258,7 @@ panels_layout(isplot=c('datasheet', 'matrix', 'map'), info_ratio=2, time_ratio=2, var_ratio=3, - computer_data_path=computer_data_path, - fr_shpdir=fr_shpdir, - fr_shpname=fr_shpname, - bs_shpdir=bs_shpdir, - bs_shpname=bs_shpname, - rv_shpdir=rv_shpdir, - rv_shpname=rv_shpname, + df_shapefile=df_shapefile, figdir=figdir, filename_opt='') - - -# map_panel(computer_data_path, - # fr_shpdir, fr_shpname, - # bs_shpdir, bs_shpname, - # rv_shpdir, rv_s hpname) - - -### /!\ Removed 185 row(s) containing missing values (geom_path) -> remove NA ### - - - - diff --git a/script_install.R b/script_install.R index c319b2328baf3cde8bc5bc29b11983fba4553439..3597700cf0a48c3aef8bd86f8575d0f05e642e9b 100644 --- a/script_install.R +++ b/script_install.R @@ -14,6 +14,8 @@ install.packages('ggh4x') install.packages('extrafont') install.packages("RColorBrewer") install.packages('trend') +install.packages("shadowtext") + # linux # sudo apt-get install gdal-bin proj-bin libgdal-dev libproj-dev @@ -28,7 +30,7 @@ install_github("https://github.com/benRenard/BFunk") #type '1' # install_git("git@gitlab-ssh.irstea.fr:valentin.mansanarez/statistical-analysis-of-trends.git") # SSH install_git("https://gitlab.irstea.fr/valentin.mansanarez/statistical-analysis-of-trends.git") - +# + shapefile