Commit 2db8c9de authored by Heraut Louis's avatar Heraut Louis
Browse files

logo

parent d96d8b8e
No related merge requests found
Showing with 63 additions and 39 deletions
+63 -39
......@@ -46,6 +46,7 @@ print(paste('resources_path :', resources_path))
# Logo filename
logo_dir = 'logo'
PRlogo_file = 'logo_Prefet_bassin.png'
AEAGlogo_file = 'agence-de-leau-adour-garonne_logo.png'
INRAElogo_file = 'Logo-INRAE_Transparent.png'
FRlogo_file = 'Republique_Francaise_RVB.png'
......@@ -65,7 +66,8 @@ sbs_shpname = 'SousBassinHydrographique.shp'
# Path to the shapefile for station basins shape from 'computer_data_path'
cbs_shpdir = file.path(shp_dir, 'bassin_station')
cbs_shpname = 'BV_4207_stations.shp'
cbs_shpname = c('BV_4207_stations.shp', '3BVs_FRANCE_L2E_2018.shp')
cbs_coord = c("L93", "L2")
# Path to the shapefile for river shape from 'computer_data_path'
rv_shpdir = file.path('map', 'river')
......@@ -112,11 +114,11 @@ TXTlistname =
## 3. ANALYSIS PARAMETERS ____________________________________________
### 3.1. Station analysis ____________________________________________
to_analyse = c(
'QA'
# 'QMNA',
# 'VCN10',
# 'tDEB',
# 'tCEN'
'QA',
'QMNA',
'VCN10',
'tDEB',
'tCEN'
)
### 3.2. Climate analysis ____________________________________________
......@@ -172,7 +174,7 @@ fast_format = FALSE
alpha = 0.1
allMonth = FALSE
## 4. PLOTTING OPTIONS _______________________________________________
# If the hydrological network needs to be plot
......@@ -190,14 +192,14 @@ axis_xlim =
# 'map' : map about trend analyses
to_plot_station =
c(
# 'datasheet'
# 'table'
'map'
'datasheet'
# 'table',
# 'map'
)
map_to_plot =
c(
'regime'
# 'trend'
# 'mean'
'regime',
'trend',
'mean'
)
......@@ -49,8 +49,7 @@ library(shadowtext)
library(png)
library(ggrepel)
,
# Sourcing R file
source(file.path('Rcode', 'plotting', 'datasheet.R'), encoding='UTF-8')
source(file.path('Rcode', 'plotting', 'map.R'), encoding='UTF-8')
......
......@@ -93,9 +93,9 @@ map_panel = function (list_df2plot, df_meta, df_shapefile, idPer_trend=1,
}
if (mapType == 'regime') {
regimeColorSample = c('#293648',
'#7b9093',
'#a5c5d9')
regimeColorSample = c('#005249',
'#3e8baa',
'#a9c0cb')
names(regimeColorSample) = c('Pluvial',
'Transition',
'Nival Glaciaire')
......@@ -209,7 +209,8 @@ map_panel = function (list_df2plot, df_meta, df_shapefile, idPer_trend=1,
color="grey40", fill=NA, size=sizefr)
if (mapType == 'regime') {
color = regimeColor[match(df_codeBasin$code, Code)]
# color = regimeColor[match(df_codeBasin$code, Code)]
color = 'grey20'
map = map +
# Plot the hydrological code basins
geom_polygon(data=df_codeBasin,
......@@ -451,10 +452,10 @@ map_panel = function (list_df2plot, df_meta, df_shapefile, idPer_trend=1,
# Extracts the localisation of the current station
lontmp =
df_meta[df_meta$code == code,]$L93X_m_BH
df_meta$L93X_m_BH[df_meta$code == code]
lattmp =
df_meta[df_meta$code == code,]$L93Y_m_BH
df_meta$L93Y_m_BH[df_meta$code == code]
# Stores all the parameters
lon = c(lon, lontmp)
lat = c(lat, lattmp)
......@@ -881,17 +882,17 @@ map_panel = function (list_df2plot, df_meta, df_shapefile, idPer_trend=1,
# For all stations not to highlight
geom_point(data=plot_map,
aes(x=lon, y=lat),
shape=21, size=2, stroke=0.5,
shape=21, size=3, stroke=0.5,
color='grey97', fill=regimeColor) +
geom_text_repel(data=plot_map,
aes(x=lon, y=lat, label=code),
segment.colour="grey40",
segment.colour="grey35",
segment.size=0.25,
min.segment.length=0.25,
force=0.4,
force_pull=1,
size=2,
size=2.5,
color=regimeColor,
bg.color="grey97",
bg.r=.15)
......
......@@ -43,7 +43,7 @@ df_shapefile = ini_shapefile(resources_path, df_meta,
fr_shpdir, fr_shpname,
bs_shpdir, bs_shpname,
sbs_shpdir, sbs_shpname,
cbs_shpdir, cbs_shpname,
cbs_shpdir, cbs_shpname, cbs_coord,
rv_shpdir, rv_shpname,
show_river=show_river)
......@@ -74,7 +74,7 @@ if ('station_serie_plot' %in% to_do) {
}
### 1.2. Analyses layout _____________________________________________
if ('station_trend_plot' %in% to_do) {
if ('station_trend_plot' %in% to_do) {
layout_panel(to_plot=to_plot_station,
map_to_plot=map_to_plot,
df_meta=df_meta,
......
......@@ -40,6 +40,8 @@
library(tools)
library(dplyr)
library(officer)
library(sp) # crs
library(sf) # crs
### 1. GENERAL METADATA ON STATION ___________________________________
......@@ -692,7 +694,7 @@ ini_shapefile = function (resources_path, df_meta,
fr_shpdir, fr_shpname,
bs_shpdir, bs_shpname,
sbs_shpdir, sbs_shpname,
cbs_shpdir, cbs_shpname,
cbs_shpdir, cbs_shpname, cbs_coord,
rv_shpdir, rv_shpname, show_river=TRUE) {
Code = levels(factor(df_meta$code))
......@@ -719,15 +721,35 @@ ini_shapefile = function (resources_path, df_meta,
subBasin = readOGR(dsn=sbs_shppath, verbose=FALSE)
df_subBasin = tibble(fortify(subBasin))
df_codeBasin = tibble()
CodeOk = c()
nShp = length(cbs_shppath)
# Hydrological stations basins
codeBasin = readOGR(dsn=cbs_shppath, verbose=FALSE)
shpCode = as.character(codeBasin@data$Code)
df_codeBasin = tibble(fortify(codeBasin))
groupSample = rle(as.character(df_codeBasin$group))$values
df_codeBasin$code = shpCode[match(df_codeBasin$group, groupSample)]
df_codeBasin = df_codeBasin[df_codeBasin$code %in% Code,]
for (i in 1:nShp) {
codeBasin = readOGR(dsn=cbs_shppath[i], verbose=FALSE)
shpCode = as.character(codeBasin@data$Code)
df_tmp = tibble(fortify(codeBasin))
groupSample = rle(as.character(df_tmp$group))$values
df_tmp$code = shpCode[match(df_tmp$group, groupSample)]
df_tmp = df_tmp[df_tmp$code %in% Code &
!(df_tmp$code %in% CodeOk),]
CodeOk = c(CodeOk, shpCode[!(shpCode %in% CodeOk)])
if (cbs_coord[i] == "L2") {
crs_rgf93 = st_crs(2154)
crs_l2 = st_crs(27572)
sf_loca = st_as_sf(df_tmp[c("long", "lat")],
coords=c("long", "lat"))
st_crs(sf_loca) = crs_l2
sf_loca = st_transform(sf_loca, crs_rgf93)
sf_loca = st_coordinates(sf_loca$geometry)
df_tmp$long = sf_loca[, 1]
df_tmp$lat = sf_loca[, 2]
}
df_codeBasin = bind_rows(df_codeBasin, df_tmp)
}
df_codeBasin = df_codeBasin[order(df_codeBasin$code),]
# If the river shapefile needs to be load
if (show_river) {
# Hydrographic network
......
......@@ -13,7 +13,7 @@
## Territoire : Métropole continentale
## --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Définition position stations : 2018
## Coordonnées station L93 : 405841 ; 6215829 ; 406153 ; 6225881 ; (BANQUE HYDRO ; INRAE Lambert 93 [m])
## Coordonnées station L93 : 406132 ; 6225883 ; 406153 ; 6225881 ; (BANQUE HYDRO ; INRAE Lambert 93 [m])
## Coordonnées station L2E : 359684 ; 1779884 ; 359913 ; 1789949 ; (BANQUE HYDRO ; INRAE Lambert 2 étendu [m])
## Coordonnées station WGS84 : -0.60437 ; 42.98139 ; -0.60618 ; 43.07182 ; (BANQUE HYDRO ; INRAE WGS84 [degrés décimaux])
## Superficie bassin : 425.00 ; 432.72 ; (BANQUE HYDRO ; INRAE [km2])
......@@ -100,9 +100,9 @@ filename =
# 'climate_trend_plot' : Plotting of trend analyses of climate data
to_do =
c(
# 'station_extraction'
# 'station_trend_analyse'
'station_trend_plot'
'station_extraction',
'station_trend_analyse'
# 'station_trend_plot'
)
## 4. ANALYSIS PARAMETERS ____________________________________________
......
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