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 55d16e13 authored by Samuël Weber's avatar Samuël Weber
Browse files

factorization

parent 354b125b
# -*- coding: utf-8 -*-
import os
import urllib
from datetime import datetime, timedelta
import sqlite3
import pandas as pd
import numpy as np
......@@ -28,6 +25,7 @@ STATIONS_SHORT2LONG = {
}
STATIONS_LONG2SHORT = {v: k for k, v in STATIONS_SHORT2LONG.items()}
# =============================================================================
conn = sqlite3.connect(settings.BDDPM) # BDDPM must be defined in local_settings.py
df = pd.read_sql(
......@@ -300,7 +298,8 @@ def update_datatable(stations, species, sources, options, years_range):
else:
sp = pd.DataFrame(columns=BASE_VAR_SP)
if len(sources) != 0:
pmf = utilities.get_PMF_contrib(sources, where="Station", isin=stations_tmp,
pmf = utilities.get_PMF_contrib(sources, where="Station",
isin=stations_tmp,
base_var=BASE_VAR_SRC)
else:
pmf = pd.DataFrame(columns=["Date", "Station", "Program_PMF"])
......
......@@ -5,7 +5,6 @@ import numpy as np
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
import dash_table as dt
import dash_bootstrap_components as dbc
import plotly.graph_objs as go
import plotly.express as px
......@@ -40,11 +39,8 @@ STATIONS_SHORT2LONG = {
"ROU": "Rouen",
"NGT": "Nogent"
}
STATIONS_LONG2SHORT = {v: k for k, v in STATIONS_SHORT2LONG.items()}
# df["Labels"].replace({"nan": np.nan, "None": np.nan}, inplace=True)
# df["Date"] = pd.to_datetime(df["Date"])
# replace_QL(df)
STATIONS_LONG2SHORT = {v: k for k, v in STATIONS_SHORT2LONG.items()}
# ==== STATION LIST ===========================================================
conn = sqlite3.connect(settings.BDDPM) # BDDPM must be defined in local_settings.py
......@@ -73,10 +69,10 @@ SELECTEDSTATION = set()
tooManyPlot = 30
minSample = 40
external_css = [
"/static/css/apps.css",
]
app = DjangoDash("app_PMall",
external_stylesheets=external_css,
)
......@@ -155,7 +151,7 @@ def set_specie_option(stations):
""".format(
stations='", "'.join(stations)
)
df = pd.read_sql(sql_query, con=conn).dropna(axis=1, how="all")
df = pd.read_sql(sql_query, con=conn).replace("nan", np.nan).dropna(axis=1, how="all")
conn.close()
for station in stations:
......
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