@@ -173,6 +173,7 @@ def get_map_marker_columns(self):
173
173
174
174
175
175
import click
176
+ import yaml
176
177
177
178
178
179
@click .command ()
@@ -195,6 +196,7 @@ def get_map_marker_columns(self):
195
196
)
196
197
@click .option ("--flux_out" , default = "flux.out" , help = "Path to the flux.out file" )
197
198
@click .option ("--reftime" , default = "2020-01-01" , help = "Reference time" )
199
+ @click .option ("--yaml_file" , default = None , help = "Path to the yaml file" )
198
200
def show_schism_output_ui (
199
201
schism_dir = "." ,
200
202
flux_xsect_file = "flow_station_xsects.yaml" ,
@@ -203,19 +205,49 @@ def show_schism_output_ui(
203
205
reftime = "2020-01-01" ,
204
206
repo_dir = "screened" ,
205
207
inventory_file = "inventory_datasets.csv" ,
208
+ yaml_file = None ,
206
209
):
207
- study = schismstudy .SchismStudy (
208
- schism_dir ,
209
- flux_xsect_file = flux_xsect_file ,
210
- station_in_file = station_in_file ,
211
- flux_out = flux_out ,
212
- reftime = reftime ,
213
- )
210
+ if yaml_file :
211
+ # Load the YAML file and create multiple studies
212
+ with open (yaml_file , "r" ) as file :
213
+ yaml_data = yaml .safe_load (file )
214
+
215
+ studies = []
216
+ for study_config in yaml_data .get ("schism_studies" , []):
217
+ studies .append (
218
+ schismstudy .SchismStudy (
219
+ base_dir = study_config ["base_dir" ],
220
+ flux_xsect_file = study_config .get (
221
+ "flux_xsect_file" , "flow_station_xsects.yaml"
222
+ ),
223
+ station_in_file = study_config .get ("station_in_file" , "station.in" ),
224
+ flux_out = study_config .get ("flux_out" , "flux.out" ),
225
+ reftime = study_config .get ("reftime" , "2020-01-01" ),
226
+ ** study_config .get ("additional_parameters" , {}),
227
+ )
228
+ )
229
+ else :
230
+ # Create a single study if no YAML file is provided
231
+ studies = [
232
+ schismstudy .SchismStudy (
233
+ schism_dir ,
234
+ flux_xsect_file = flux_xsect_file ,
235
+ station_in_file = station_in_file ,
236
+ flux_out = flux_out ,
237
+ reftime = reftime ,
238
+ )
239
+ ]
240
+
241
+ # Create the datastore
214
242
ds = datastore .StationDatastore (repo_dir = repo_dir , inventory_file = inventory_file )
243
+
244
+ # Define the time range
215
245
time_range = (pd .Timestamp (reftime ), pd .Timestamp (reftime ) + pd .Timedelta (days = 250 ))
246
+
247
+ # Create the UI
216
248
ui = DataUI (
217
249
SchismOutputUIDataManager (
218
- study ,
250
+ * studies ,
219
251
datastore = ds ,
220
252
time_range = time_range ,
221
253
),
0 commit comments