Spaces:
Sleeping
Sleeping
ok6
Browse files
app.py
CHANGED
@@ -454,25 +454,46 @@ def create_gradio_app():
|
|
454 |
html_content += f"<div style='margin: 10px 0; padding: 10px; border: 1px solid #ddd; border-radius: 5px;'>"
|
455 |
html_content += f"<strong>Storm #{i+1}</strong> - Source: {source}<br>"
|
456 |
|
457 |
-
if storm_type == '
|
458 |
-
|
459 |
-
|
460 |
-
feature_count = len(geojson.get('features', []))
|
461 |
-
html_content += f"Layer: {layer_name}<br>"
|
462 |
-
html_content += f"Data points: {feature_count}<br>"
|
463 |
|
464 |
-
|
465 |
-
features = geojson.get('features', [])
|
466 |
if features:
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
|
473 |
-
|
474 |
-
|
475 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
476 |
|
477 |
elif storm_type == 'sample':
|
478 |
html_content += "<em>Sample data for demonstration</em><br>"
|
|
|
454 |
html_content += f"<div style='margin: 10px 0; padding: 10px; border: 1px solid #ddd; border-radius: 5px;'>"
|
455 |
html_content += f"<strong>Storm #{i+1}</strong> - Source: {source}<br>"
|
456 |
|
457 |
+
if storm_type == 'nhc_storm':
|
458 |
+
storm_id = storm_info.get('storm_id', 'Unknown')
|
459 |
+
forecast_points = storm_info.get('forecast_points', {})
|
|
|
|
|
|
|
460 |
|
461 |
+
features = forecast_points.get('features', [])
|
|
|
462 |
if features:
|
463 |
+
# Get current position (tau=0) and latest forecast
|
464 |
+
current_pos = None
|
465 |
+
latest_forecast = None
|
466 |
+
|
467 |
+
for feature in features:
|
468 |
+
props = feature.get('properties', {})
|
469 |
+
tau = props.get('tau', 999)
|
470 |
+
if tau == 0:
|
471 |
+
current_pos = props
|
472 |
+
if not latest_forecast or tau > latest_forecast.get('tau', -1):
|
473 |
+
latest_forecast = props
|
474 |
|
475 |
+
display_props = current_pos if current_pos else latest_forecast
|
476 |
+
|
477 |
+
if display_props:
|
478 |
+
storm_name = display_props.get('stormname', storm_id)
|
479 |
+
storm_type_detail = display_props.get('stormtype', 'Unknown')
|
480 |
+
max_wind = display_props.get('maxwind', 'N/A')
|
481 |
+
pressure = display_props.get('mslp', 'N/A')
|
482 |
+
advisory_num = display_props.get('advisnum', 'N/A')
|
483 |
+
advisory_date = display_props.get('advdate', 'N/A')
|
484 |
+
ss_num = display_props.get('ssnum', 0)
|
485 |
+
lat = display_props.get('lat', 'N/A')
|
486 |
+
lon = display_props.get('lon', 'N/A')
|
487 |
+
|
488 |
+
html_content += f"<strong>Name:</strong> {storm_name}<br>"
|
489 |
+
html_content += f"<strong>Type:</strong> {storm_type_detail}<br>"
|
490 |
+
html_content += f"<strong>Max Wind:</strong> {max_wind} kt<br>"
|
491 |
+
html_content += f"<strong>Pressure:</strong> {pressure} mb<br>"
|
492 |
+
html_content += f"<strong>Category:</strong> {ss_num if ss_num > 0 else 'N/A'}<br>"
|
493 |
+
html_content += f"<strong>Position:</strong> {lat}°N, {abs(float(lon)) if lon != 'N/A' else 'N/A'}°W<br>"
|
494 |
+
html_content += f"<strong>Advisory:</strong> #{advisory_num}<br>"
|
495 |
+
html_content += f"<strong>Updated:</strong> {advisory_date}<br>"
|
496 |
+
html_content += f"<strong>Data Points:</strong> {len(features)}<br>"
|
497 |
|
498 |
elif storm_type == 'sample':
|
499 |
html_content += "<em>Sample data for demonstration</em><br>"
|