Commit 969921fe authored by Laura LINDEPERG's avatar Laura LINDEPERG
Browse files

Keep on managing plots

parent bf951972
......@@ -10,7 +10,7 @@ import geopandas as gpd
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
# **************************** Data *****************************
......@@ -36,15 +36,22 @@ shp_foldername = 'C:/Users/laura.lindeperg/Documents/DonneesLaura/Watersheds/GEO
shp_watersheds = gpd.read_file(shp_watersheds_path)
# Geol
df_geol_path = '613_stations_geol_df.csv'
df_geol_path = 'C:/Users/laura.lindeperg/Documents/INRAE_2021/CODE/fhysa/613_stations_geol_df.csv'
df_geol = pd.read_csv(df_geol_path)
# Geomorpho
df_geomorpho_path = 'C:/Users/laura.lindeperg/Documents/INRAE_2021/CODE/fhysa/DeltaV.csv'
df_geomorpho = pd.read_csv(df_geomorpho_path)
delta_v = df_geomorpho.loc[:, ['Code', 'DeltaV']].rename(columns = {'Code':'code'})
# Transform in long-form data structure
df_hydro_sig = df_hydro_sig.drop(columns = ['name'])
df_hydro_sig_long = df_hydro_sig.melt(id_vars = ['code'], var_name = 'hydro_sig')
my_df = pd.merge(df_hydro_sig_long, df_geol, on = 'code', how = 'outer')
# my_df = pd.merge(my_df, delta_v, on = 'code', how = 'outer')
# Merge hydrological signatures with geometry file
shp_watersheds = shp_watersheds.rename(columns = {'Code':'code'})
......@@ -61,14 +68,34 @@ my_geol = df_geol.loc[df_geol.loc[:, 'maingeol_proportion'] > 0.70]
my_df = my_df.loc[my_df.loc[:, 'code'].isin(my_geol.loc[:,'code'])==True]
# Exclude catchments which disturb scales
my_df = my_df.loc[my_df.loc[:,'code'].isin(['K6492510', 'V2814020', 'P7041510', 'A9001050', 'H8043310', 'H4033010']) == False]
# # Exclude catchments which disturb scales
# my_df = my_df.loc[my_df.loc[:,'code'].isin(['K6492510', 'V2814020', 'P7041510', 'A9001050', 'H8043310', 'H4033010']) == False]
# **************************** Plots *****************************
# my_df.value=np.log(my_df.value)
sns.relplot(x='DeltaV', y='DeltaV', hue = 'maingeol_description', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'q_mean'])
sns.boxplot(x='maingeol_description', y='DeltaV', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'q_mean']).tick_params(axis='x', labelrotation=45)
df_geol = df_geol.loc[:, ['code', 'maingeol_description']]
my_data = pd.merge(df_hydro_sig, df_geol)
viz = sns.PairGrid(data=my_data, hue='maingeol_description')
viz.map(sns.scatterplot)
viz.add_legend()
# viz.map_diag(sns.histplot)
# viz.map_offdiag(sns.scatterplot)
# viz.add_legend()
## Boxplot of the hydrological signatures
figure, axes = plt.subplots(4, 4, figsize = (17, 17))
......@@ -110,8 +137,8 @@ axes[3, 3].axis("off")
## Boxplot of the hydrological signatures from their main hydrogeologic type perspective
figure, axes = plt.subplots(4, 4, figsize = (17, 17))
figure.suptitle('Hydrological signatures')
figure, axes = plt.subplots(4, 4, figsize = (17, 17), sharex=True)
# figure.suptitle('Hydrological signatures')
axes[0, 0].set_title('Qmean')
axes[0, 1].set_title('Aridity ratio')
axes[0, 2].set_title('Runoff ratio')
......@@ -127,20 +154,20 @@ axes[2, 3].set_title('tau 2')
axes[3, 0].set_title('tau Roques')
axes[3, 1].set_title('BFI 90')
sns.boxplot(ax=axes[0, 0], x='hydro_sig', y='value', hue = 'maingeol_description', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'q_mean'])
sns.boxplot(ax=axes[0, 1], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'aridity_ratio'])
sns.boxplot(ax=axes[0, 2], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'runoff_ratio'])
sns.boxplot(ax=axes[0, 3], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'bfi_5'])
sns.boxplot(ax=axes[1, 0], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'bf_magni'])
sns.boxplot(ax=axes[1, 1], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'a_q'])
sns.boxplot(ax=axes[1, 2], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'b_q'])
sns.boxplot(ax=axes[1, 3], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'fdc_quantile10'])
sns.boxplot(ax=axes[2, 0], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'fdc_quantile90'])
sns.boxplot(ax=axes[2, 1], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'fdc_slope'])
sns.boxplot(ax=axes[2, 2], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'tau_1'])
sns.boxplot(ax=axes[2, 3], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'tau_2'])
sns.boxplot(ax=axes[3, 0], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'tau_roques'])
sns.boxplot(ax=axes[3, 1], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'bfi_90'])
ax00 = sns.boxplot(ax=axes[0, 0], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'q_mean']).legend('off')
ax01 = sns.boxplot(ax=axes[0, 1], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'aridity_ratio'])
ax02 = sns.boxplot(ax=axes[0, 2], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'runoff_ratio'])
ax03 = sns.boxplot(ax=axes[0, 3], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'bfi_5'])
ax10 = sns.boxplot(ax=axes[1, 0], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'bf_magni'])
ax11 = sns.boxplot(ax=axes[1, 1], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'a_q'])
ax12 = sns.boxplot(ax=axes[1, 2], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'b_q'])
ax13 = sns.boxplot(ax=axes[1, 3], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'fdc_quantile10'])
ax20 = sns.boxplot(ax=axes[2, 0], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'fdc_quantile90'])
ax21 = sns.boxplot(ax=axes[2, 1], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'fdc_slope'])
ax22 = sns.boxplot(ax=axes[2, 2], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'tau_1'])
ax23 = sns.boxplot(ax=axes[2, 3], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'tau_2'])
ax30 = sns.boxplot(ax=axes[3, 0], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'tau_roques'])
ax31 = sns.boxplot(ax=axes[3, 1], x='maingeol_description', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'bfi_90'])
axes[3, 2].axis("off")
axes[3, 3].axis("off")
......@@ -202,7 +229,7 @@ axes[3, 3].axis("off")
# En vrac - ne fonctionne pas toujours
sns.relplot(x='value', y='value', data=my_df.loc[my_df.loc[:, 'hydro_sig'] == 'a_q'])
......@@ -237,7 +264,6 @@ sns.relplot(x="XL93", y="YL93", hue="value",
col="hydro_sig", col_wrap=2,
kind="scatter", data= my_df);
# ## Few plots for test
# # bf indices
......
Markdown is supported
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