Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit f268a2d0 authored by Samuel's avatar Samuel
Browse files

add all/annual/hot-cold seasonality

parent d57b4843
......@@ -550,28 +550,42 @@ def update_box_graph(datatable, temporality, plots_options, groupby_var, species
print("BOX: no data to plot, sp:", species)
return returnError
dfdt = utilities.add_month(dfdt, season=True)
dfdt["year"] = dfdt["Date"].apply(lambda x: x.year)
dfdt["all"] = "All date"
dfdt["hot-cold"] = "MJJASO (Hot)"
dfdt.loc[dfdt["month"].isin(["Nov", "Dec", "Jan", "Feb", "Mar", "Apr"]), "hot-cold"] = "NDJFMA (Cold)"
# ==== Plot option ========================================================
plot_type = "box" if "boxplot" in plots_options else "bar"
# X variable
if temporality == 1:
if temporality == "season":
date_var_list = ["DJF", "MAM", "JJA", "SON"]
elif temporality == 2:
elif temporality == "month":
date_var_list = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
"Oct", "Nov", "Dec"]
elif temporality == "year":
date_var_list = [str(x) for x in list(range(dfdt["year"].min(), dfdt['year'].max()))]
elif temporality == "all":
date_var_list = ["All date"]
elif temporality == "hot-cold":
date_var_list = ["NDJFMA (Cold)", "MJJASO (Hot)"]
else:
print("???")
x_var = groupby_var
if x_var == "Date":
x_var_col = "season" if temporality == 1 else "month"
x_var_col = temporality
x_var_list = date_var_list
hue_var_col = "Station"
hue_var_list = stations
elif x_var == "Site":
x_var_col = "Station"
x_var_list = stations
hue_var_col = "season" if temporality == 1 else "month"
hue_var_col = temporality
hue_var_list = date_var_list
xticklabels = x_var_list
dfdt = utilities.add_month(dfdt, season=True)
# ==== Plot part ==========================================================
for hue in hue_var_list:
......
......@@ -420,11 +420,14 @@ on the UGA gitlab for an example on how to use this app.
html.Div(children=[
dcc.Tabs(
value=1,
value="season",
id="tab-boxplot",
children=[
dcc.Tab(label="Seasonal", value=1),
dcc.Tab(label="Monthly", value=2),
dcc.Tab(label="All date", value="all"),
dcc.Tab(label="Annual", value="year"),
dcc.Tab(label="Hot/cold", value="hot-cold"),
dcc.Tab(label="Seasonal", value="season"),
dcc.Tab(label="Monthly", value="month"),
]
),
boxplot_options,
......
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