Skip to content

Commit

Permalink
Faciliter l'intégration des graphiques map station sur vcub_watcher (#49
Browse files Browse the repository at this point in the history
)
  • Loading branch information
armgilles committed Apr 19, 2021
1 parent eb3e0de commit 8776541
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions vcub_keeper/visualisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,14 @@ def plot_map_station_with_plotly(station_control,
station_control.loc[station_control['is_inactive'] == 1, 'etat'] = 'inactive'

# Transform date to string
station_control['anomaly_since_str'] = \
station_control['anomaly_since'].dt.strftime(date_format='%Y-%m-%d %H:%M')
station_control['anomaly_since_str'] = station_control['anomaly_since_str'].fillna('-')
try:
station_control['anomaly_since_str'] = \
station_control['anomaly_since'].dt.strftime(date_format='%Y-%m-%d %H:%M')
except KeyError:
# Pour vcub_watcher intégration
# https://github.com/armgilles/vcub_keeper/issues/49#issuecomment-822504771
station_control['anomaly_since_str'] = \
station_control['En anomalie depuis'].dt.strftime(date_format='%Y-%m-%d %H:%M')

# Color for etat
color_etat = {'anomaly': '#EB4D50',
Expand Down Expand Up @@ -663,9 +668,14 @@ def plot_map_station_with_kepler(station_control, station_id=None):
station_control.loc[station_control['is_inactive'] == 1, 'etat'] = 'inactive'

# Transform date to string
station_control['anomaly_since_str'] = \
station_control['anomaly_since'].dt.strftime(date_format='%Y-%m-%d %H:%M')
station_control['anomaly_since_str'] = station_control['anomaly_since_str'].fillna('-')
try:
station_control['anomaly_since_str'] = \
station_control['anomaly_since'].dt.strftime(date_format='%Y-%m-%d %H:%M')
except KeyError:
# Pour vcub_watcher intégration
# https://github.com/armgilles/vcub_keeper/issues/49#issuecomment-822504771
station_control['anomaly_since_str'] = \
station_control['En anomalie depuis'].dt.strftime(date_format='%Y-%m-%d %H:%M')

# Drop date for Kepler
station_control = station_control.drop(['last_date_anomaly', 'anomaly_since'], axis=1)
Expand Down

0 comments on commit 8776541

Please sign in to comment.