@@ -106,30 +106,6 @@ def render_panel(
106106 )
107107
108108
109- @panel .callback (
110- Input ("@app" , "selectedPlaceGroup" ),
111- Input ("@app" , "selectedDatasetId" ),
112- Input ("@app" , "selectedTimeLabel" ),
113- Input ("button" , "clicked" ),
114- Output ("error_message" , "children" ),
115- )
116- def update_error_message (
117- ctx : Context ,
118- place_group : list [dict [str , Any ]] | None = None ,
119- dataset_id : str | None = None ,
120- _time_label : float | None = None ,
121- _clicked : bool | None = None ,
122- ) -> str :
123- dataset = get_dataset (ctx , dataset_id )
124- points = get_places (ctx , place_group )
125- if dataset is None :
126- return "Missing dataset selection"
127- elif not points :
128- return "Missing point selection"
129- else :
130- return ""
131-
132-
133109def get_spectra (
134110 dataset : xr .Dataset ,
135111 place_group : gpd .GeoDataFrame ,
@@ -189,15 +165,13 @@ def get_spectra(
189165
190166@panel .callback (
191167 State ("@app" , "selectedDatasetTitle" ),
192- State ("@app" , "selectedTimeLabel" ),
193168 Input ("@app" , "selectedTimeLabel" ),
194169 Output ("text" , "children" ),
195170)
196171def update_text (
197172 ctx : Context ,
198173 dataset_title : str | None = None ,
199174 time_label : str | None = None ,
200- _time_label : bool | None = None ,
201175) -> list | None :
202176
203177 if time_label :
@@ -209,7 +183,6 @@ def update_text(
209183 State ("@app" , "selectedDatasetId" ),
210184 Input ("@app" , "selectedTimeLabel" ),
211185 State ("@app" , "selectedPlaceGroup" ),
212- State ("@app" , "selectedPlaceGeometry" ),
213186 State ("select_places" , "value" ),
214187 Input ("button" , "clicked" ),
215188 Output ("plot" , "chart" ),
@@ -220,17 +193,22 @@ def update_plot(
220193 dataset_id : str | None = None ,
221194 time_label : str | None = None ,
222195 place_group : list [dict [str , Any ]] | None = None ,
223- place_geometry : str | None = None ,
224196 place : list | None = None ,
225197 _clicked : bool | None = None ,
226198) -> tuple [alt .Chart | None , str ]:
227199 dataset = get_dataset (ctx , dataset_id )
200+ has_point = any (
201+ feature .get ("geometry" , {}).get ("type" ) == "Point"
202+ for collection in place_group
203+ for feature in collection .get ("features" , [])
204+ )
228205 if dataset is None :
229206 return None , "Missing dataset selection"
230- elif not place_geometry :
231- return None , "Missing place geometry selection"
207+ elif not place_group or not has_point :
208+ return None , "Missing point selection"
232209 elif not place :
233- return None , "Missing point value selection from dropdown"
210+ return None , "Missing point selection from dropdown"
211+
234212 place_group = gpd .GeoDataFrame (
235213 [
236214 {
@@ -304,23 +282,3 @@ def update_theme(
304282 theme_mode = "default"
305283
306284 return theme_mode
307-
308-
309- @panel .callback (
310- State ("@app" , "selectedDatasetId" ),
311- State ("@app" , "selectedTimeLabel" ),
312- State ("@app" , "selectedPlaceGroup" ),
313- State ("select_places" , "value" ),
314- Input ("@app" , "selectedTimeLabel" ),
315- Output ("plot" , "chart" ),
316- Output ("error_message" , "children" ),
317- )
318- def update_timestep (
319- ctx : Context ,
320- dataset_id : str ,
321- time_label : str ,
322- place_group : list [dict [str , Any ]],
323- place : list ,
324- _new_time_label : bool | None = None ,
325- ) -> tuple [alt .Chart , str ] | None :
326- return update_plot (ctx , dataset_id , time_label , place_group , place )
0 commit comments