Spaces:
Sleeping
Sleeping
Reinforce that in Hong Kong time.
Browse files- pages/7_CoWIN.py +7 -4
pages/7_CoWIN.py
CHANGED
|
@@ -8,6 +8,7 @@ import plotly.graph_objects as go
|
|
| 8 |
import numpy as np
|
| 9 |
from datetime import datetime
|
| 10 |
from branca.colormap import LinearColormap
|
|
|
|
| 11 |
|
| 12 |
st.set_page_config(layout="wide", page_title="Real-Time CoWIN Weather Data Dashboard")
|
| 13 |
|
|
@@ -40,7 +41,7 @@ attribute = st.selectbox(
|
|
| 40 |
['Temperature', 'Wind Speed', 'Relative Humidity', 'UV Radiation']
|
| 41 |
)
|
| 42 |
|
| 43 |
-
col1, col2, col3 = st.columns([1.65, 2, 1.
|
| 44 |
|
| 45 |
with col1:
|
| 46 |
attr_series = pd.Series(df[attribute].dropna())
|
|
@@ -142,7 +143,7 @@ with col2:
|
|
| 142 |
)
|
| 143 |
colormap.add_to(m)
|
| 144 |
|
| 145 |
-
st_folium(m, width=
|
| 146 |
|
| 147 |
with col3:
|
| 148 |
st.markdown(
|
|
@@ -162,6 +163,8 @@ with col3:
|
|
| 162 |
if st.button("Refresh Data"):
|
| 163 |
st.experimental_rerun()
|
| 164 |
|
| 165 |
-
|
| 166 |
-
|
|
|
|
|
|
|
| 167 |
st.experimental_rerun()
|
|
|
|
| 8 |
import numpy as np
|
| 9 |
from datetime import datetime
|
| 10 |
from branca.colormap import LinearColormap
|
| 11 |
+
import pytz
|
| 12 |
|
| 13 |
st.set_page_config(layout="wide", page_title="Real-Time CoWIN Weather Data Dashboard")
|
| 14 |
|
|
|
|
| 41 |
['Temperature', 'Wind Speed', 'Relative Humidity', 'UV Radiation']
|
| 42 |
)
|
| 43 |
|
| 44 |
+
col1, col2, col3 = st.columns([1.65, 2, 1.2])
|
| 45 |
|
| 46 |
with col1:
|
| 47 |
attr_series = pd.Series(df[attribute].dropna())
|
|
|
|
| 143 |
)
|
| 144 |
colormap.add_to(m)
|
| 145 |
|
| 146 |
+
st_folium(m, width=530, height=600)
|
| 147 |
|
| 148 |
with col3:
|
| 149 |
st.markdown(
|
|
|
|
| 163 |
if st.button("Refresh Data"):
|
| 164 |
st.experimental_rerun()
|
| 165 |
|
| 166 |
+
hk_tz = pytz.timezone('Asia/Hong_Kong')
|
| 167 |
+
current_time = datetime.now(hk_tz).strftime('%Y-%m-%dT%H:%M:%S')
|
| 168 |
+
if 'last_ran' not in st.session_state or (datetime.now(pytz.timezone('Asia/Hong_Kong')) - st.session_state.last_ran).seconds > 300:
|
| 169 |
+
st.session_state.last_ran = datetime.now(pytz.timezone('Asia/Hong_Kong'))
|
| 170 |
st.experimental_rerun()
|