2727
2828# Set the default mission to the first mission in the list.
2929all_missions = get_missions ()
30- default_mission = all_missions [0 ][' value' ]
30+ default_mission = all_missions [0 ][" value" ]
3131
3232# Define the layout of the app
3333app .layout = html .Div (
5050 html .Br (),
5151 dcc .Dropdown (id = "buoy_id" ),
5252 html .Br (),
53- html .Div (
54- [
55- html .P ("Time Selection | Frequency v Energy" ),
56- dcc .Dropdown (id = "time_dropdown" ),
57- ],
58- id = "time_selection" ,
59- ),
6053 html .Hr (),
6154 dbc .Card (id = "latest_info" , body = True ),
6255 html .Footer ("Version 0.8" ),
@@ -108,17 +101,15 @@ def update_ids(mission):
108101 [
109102 Output ("graph_area" , "children" ),
110103 Output ("latest_info" , "children" ),
111- Output ("time_selection" , "style" ),
112104 ],
113105 [Input ("buoy_id" , "value" )],
114106)
115107def update_layout (buoy_id ):
116108 if buoy_id == "All" :
117- style = {"display" : "none" }
118- return multi_layout , multi_info_card , style
109+ return multi_layout , multi_info_card
119110 else :
120111 style = {"display" : "block" }
121- return single_layout , single_info_card , style
112+ return single_layout , single_info_card
122113
123114
124115# Update multi-buoy graphs
@@ -145,24 +136,6 @@ def update_multi(buoy_id, mission):
145136 return no_update , no_update , no_update , no_update
146137
147138
148- # Update time dropdown options for single buoy
149- @callback (
150- [Output ("time_dropdown" , "options" ), Output ("time_dropdown" , "value" )],
151- [Input ("buoy_id" , "value" ), Input ("mission_dropdown" , "value" )],
152- )
153- def update_time_dropdown (buoy_id , mission ):
154- if buoy_id != "All" :
155- start_date , end_date = get_mission_time (mission )
156- df = get_swift_data ([buoy_id ], start_date , end_date )
157- if df is not None :
158- df ["times" ] = pd .to_datetime (df ["time" ])
159- date_strings = df ["times" ].dt .strftime ("%Y-%m-%d %H:%M:%S%z" ).tolist ()
160- options = [{"label" : date , "value" : date } for date in date_strings ]
161- value = date_strings [0 ]
162- return options , value
163- return no_update , no_update
164-
165-
166139# Update single buoy graphs and info
167140@callback (
168141 [
@@ -181,10 +154,9 @@ def update_time_dropdown(buoy_id, mission):
181154 [
182155 Input ("buoy_id" , "value" ),
183156 Input ("mission_dropdown" , "value" ),
184- Input ("time_dropdown" , "value" ),
185157 ],
186158)
187- def update_single (buoy_id , mission , selected_time_str ):
159+ def update_single (buoy_id , mission ):
188160 if buoy_id != "All" :
189161 start_date , end_date = get_mission_time (mission )
190162 df = get_swift_data ([buoy_id ], start_date , end_date )
@@ -198,7 +170,7 @@ def update_single(buoy_id, mission, selected_time_str):
198170 spectrogram_fig = no_update ,
199171 )
200172 if df is not None :
201- single_graphs = get_single_graphs (df , buoy_id , selected_time_str )
173+ single_graphs = get_single_graphs (df )
202174 # Info Card
203175 single_graphs .current_id = buoy_id
204176 single_graphs .buoy_info = single_card (df , buoy_id )
0 commit comments