euler314 commited on
Commit
9af3c2b
·
verified ·
1 Parent(s): 46eb885

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -1
app.py CHANGED
@@ -1171,7 +1171,34 @@ def perform_logistic_regression(start_year, start_month, end_year, end_month, re
1171
  return result
1172
  except Exception as e:
1173
  return f"Error performing logistic regression: {str(e)}"
1174
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1175
  # Define Gradio interface
1176
  def create_interface():
1177
  # Initialize data first
 
1171
  return result
1172
  except Exception as e:
1173
  return f"Error performing logistic regression: {str(e)}"
1174
+ def get_typhoons_for_year(year):
1175
+ if not year or ibtracs is None:
1176
+ return []
1177
+
1178
+ try:
1179
+ year = int(year)
1180
+ if year not in ibtracs.data:
1181
+ return []
1182
+
1183
+ season = ibtracs.get_season(year)
1184
+ storm_summary = season.summary()
1185
+
1186
+ typhoon_options = []
1187
+ for i in range(storm_summary['season_storms']):
1188
+ try:
1189
+ storm_id = storm_summary['id'][i]
1190
+ storm_name = storm_summary['name'][i]
1191
+ # Use storm name as the display name, but return the ID as the value
1192
+ display_name = f"{storm_name} ({storm_id})"
1193
+ typhoon_options.append((display_name, storm_id))
1194
+ except Exception as e:
1195
+ print(f"Error retrieving typhoon info: {e}")
1196
+ continue
1197
+
1198
+ return typhoon_options
1199
+ except Exception as e:
1200
+ print(f"Error getting typhoons for year {year}: {e}")
1201
+ return []
1202
  # Define Gradio interface
1203
  def create_interface():
1204
  # Initialize data first