Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -897,6 +897,7 @@ def update_route_clusters(start_year, start_month, end_year, end_month, enso_val
|
|
897 |
cluster_info_text = "\n".join(cluster_info_lines)
|
898 |
return fig_tsne, fig_routes, fig_stats, cluster_info_text
|
899 |
|
|
|
900 |
# Gradio Interface
|
901 |
with gr.Blocks(title="Typhoon Analysis Dashboard") as demo:
|
902 |
gr.Markdown("# Typhoon Analysis Dashboard")
|
@@ -1095,9 +1096,20 @@ with gr.Blocks(title="Typhoon Analysis Dashboard") as demo:
|
|
1095 |
def update_typhoon_options(year, basin):
|
1096 |
season = ibtracs.get_season(int(year))
|
1097 |
storm_summary = season.summary()
|
1098 |
-
|
1099 |
-
|
1100 |
-
options = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1101 |
return gr.update(choices=options, value=options[0] if options else None)
|
1102 |
|
1103 |
def update_basin_options(year):
|
@@ -1133,4 +1145,6 @@ with gr.Blocks(title="Typhoon Analysis Dashboard") as demo:
|
|
1133 |
outputs=[tsne_plot, routes_plot, stats_plot, cluster_info]
|
1134 |
)
|
1135 |
|
|
|
|
|
1136 |
demo.launch(share=True)
|
|
|
897 |
cluster_info_text = "\n".join(cluster_info_lines)
|
898 |
return fig_tsne, fig_routes, fig_stats, cluster_info_text
|
899 |
|
900 |
+
# Gradio Interface
|
901 |
# Gradio Interface
|
902 |
with gr.Blocks(title="Typhoon Analysis Dashboard") as demo:
|
903 |
gr.Markdown("# Typhoon Analysis Dashboard")
|
|
|
1096 |
def update_typhoon_options(year, basin):
|
1097 |
season = ibtracs.get_season(int(year))
|
1098 |
storm_summary = season.summary()
|
1099 |
+
|
1100 |
+
# Get all storms for the year
|
1101 |
+
options = []
|
1102 |
+
for i, storm_id in enumerate(storm_summary['id']):
|
1103 |
+
try:
|
1104 |
+
storm = ibtracs.get_storm(storm_id)
|
1105 |
+
# Check if this storm matches the selected basin
|
1106 |
+
if basin == "All" or storm_id.startswith(basin):
|
1107 |
+
name = storm_summary['name'][i] if not pd.isna(storm_summary['name'][i]) else "Unnamed"
|
1108 |
+
options.append(f"{name} ({storm_id})")
|
1109 |
+
except Exception:
|
1110 |
+
# Skip any problematic storms
|
1111 |
+
continue
|
1112 |
+
|
1113 |
return gr.update(choices=options, value=options[0] if options else None)
|
1114 |
|
1115 |
def update_basin_options(year):
|
|
|
1145 |
outputs=[tsne_plot, routes_plot, stats_plot, cluster_info]
|
1146 |
)
|
1147 |
|
1148 |
+
demo.launch(share=True)
|
1149 |
+
|
1150 |
demo.launch(share=True)
|