Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -331,14 +331,47 @@ def show_weather_info(data):
|
|
331 |
|
332 |
# νλ©΄μ νμ
|
333 |
weather_icon = ""
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
precip_mark = weather_icon
|
341 |
-
|
342 |
st.markdown(f'''
|
343 |
<div class="time-container">
|
344 |
<div style="text-align: center; margin-bottom: 0.5rem; font-size: 6em; font-weight: bold; color: black;">
|
|
|
331 |
|
332 |
# νλ©΄μ νμ
|
333 |
weather_icon = ""
|
334 |
+
current_time_str = current_time.strftime('%Y%m%d%H')
|
335 |
+
|
336 |
+
# Check current precipitation type first
|
337 |
+
if data['PRECPT_TYPE'] in ["λΉ", "λ", "λΉ/λ", "λΉλ°©μΈ"]:
|
338 |
+
if data['PRECPT_TYPE'] in ["λΉ", "λΉλ°©μΈ"]:
|
339 |
+
weather_icon = "β"
|
340 |
+
elif data['PRECPT_TYPE'] == "λ":
|
341 |
+
weather_icon = "β"
|
342 |
+
elif data['PRECPT_TYPE'] == "λΉ/λ":
|
343 |
+
weather_icon = "ββ"
|
344 |
+
else:
|
345 |
+
# Find nearest forecast time when no current precipitation
|
346 |
+
nearest_forecast = None
|
347 |
+
min_time_diff = float('inf')
|
348 |
+
|
349 |
+
for forecast in forecast_data:
|
350 |
+
forecast_time = datetime.strptime(forecast['FCST_DT'], '%Y%m%d%H%M')
|
351 |
+
time_diff = abs((forecast_time - current_time).total_seconds())
|
352 |
+
if time_diff < min_time_diff:
|
353 |
+
min_time_diff = time_diff
|
354 |
+
nearest_forecast = forecast
|
355 |
+
|
356 |
+
if nearest_forecast:
|
357 |
+
if nearest_forecast['PRECPT_TYPE'] in ["λΉ", "λ", "λΉ/λ", "λΉλ°©μΈ"]:
|
358 |
+
if nearest_forecast['PRECPT_TYPE'] in ["λΉ", "λΉλ°©μΈ"]:
|
359 |
+
weather_icon = "β"
|
360 |
+
elif nearest_forecast['PRECPT_TYPE'] == "λ":
|
361 |
+
weather_icon = "β"
|
362 |
+
elif nearest_forecast['PRECPT_TYPE'] == "λΉ/λ":
|
363 |
+
weather_icon = "ββ"
|
364 |
+
else:
|
365 |
+
# Use SKY_STTS when no precipitation
|
366 |
+
sky_status = nearest_forecast['SKY_STTS']
|
367 |
+
if sky_status == "λ§μ":
|
368 |
+
weather_icon = "β"
|
369 |
+
elif sky_status == "ꡬλ¦":
|
370 |
+
weather_icon = "β
"
|
371 |
+
elif sky_status == "νλ¦Ό":
|
372 |
+
weather_icon = "β"
|
373 |
+
|
374 |
precip_mark = weather_icon
|
|
|
375 |
st.markdown(f'''
|
376 |
<div class="time-container">
|
377 |
<div style="text-align: center; margin-bottom: 0.5rem; font-size: 6em; font-weight: bold; color: black;">
|