@@ -140,9 +140,14 @@ def _impose_data_selection(
140
140
selection : config .Selection ,
141
141
select_time : bool = True ,
142
142
time_dim : Optional [str ] = None ,
143
+ select_aux : bool = False ,
143
144
) -> xr .Dataset :
144
145
"""Returns selection of dataset specified in Selection instance."""
145
- dataset = dataset [selection .variables ].sel (
146
+ if select_aux and selection .aux_variables is not None :
147
+ sel_variables = set (selection .variables ) | set (selection .aux_variables )
148
+ else :
149
+ sel_variables = selection .variables
150
+ dataset = dataset [sel_variables ].sel (
146
151
latitude = selection .lat_slice ,
147
152
longitude = selection .lon_slice ,
148
153
)
@@ -314,10 +319,12 @@ def open_forecast_and_truth_datasets(
314
319
)
315
320
316
321
obs_all_times = _impose_data_selection (
317
- obs , data_config .selection , select_time = False
322
+ obs ,
323
+ data_config .selection ,
324
+ select_time = False ,
318
325
)
319
326
forecast_all_times = _impose_data_selection (
320
- forecast , data_config .selection , select_time = False
327
+ forecast , data_config .selection , select_time = False , select_aux = True
321
328
)
322
329
323
330
if data_config .by_init : # Will select appropriate chunks later
@@ -328,6 +335,7 @@ def open_forecast_and_truth_datasets(
328
335
forecast ,
329
336
data_config .selection ,
330
337
time_dim = 'init_time' if data_config .by_init else 'time' ,
338
+ select_aux = True ,
331
339
)
332
340
333
341
# Determine ground truth dataset
0 commit comments