diff --git a/tests/expedition/expedition_dir/ship_config.yaml b/tests/expedition/expedition_dir/ship_config.yaml index b3763f05..c057d6b5 100644 --- a/tests/expedition/expedition_dir/ship_config.yaml +++ b/tests/expedition/expedition_dir/ship_config.yaml @@ -1,3 +1,4 @@ +ship_speed_meter_per_second: 5.14 adcp_config: num_bins: 40 max_depth_meter: -1000.0 @@ -16,6 +17,5 @@ ctd_config: drifter_config: depth_meter: 0.0 lifetime_minutes: 40320.0 -ship_speed_meter_per_second: 5.14 ship_underwater_st_config: period_minutes: 5.0 diff --git a/virtual_ship/expedition/input_data.py b/virtual_ship/expedition/input_data.py index a35304e6..6ee4f1c4 100644 --- a/virtual_ship/expedition/input_data.py +++ b/virtual_ship/expedition/input_data.py @@ -139,6 +139,9 @@ def _load_drifter_fieldset(cls, directory: str | Path) -> FieldSet: for g in fieldset.gridset.grids: g.depth = -g.depth + # read in data already + fieldset.computeTimeChunk(0, 1) + return fieldset @classmethod @@ -167,4 +170,7 @@ def _load_argo_float_fieldset(cls, directory: str | Path) -> FieldSet: if max(g.depth) > 0: g.depth = -g.depth + # read in data already + fieldset.computeTimeChunk(0, 1) + return fieldset diff --git a/virtual_ship/expedition/verify_schedule.py b/virtual_ship/expedition/verify_schedule.py index f96e9acc..2f0b39b7 100644 --- a/virtual_ship/expedition/verify_schedule.py +++ b/virtual_ship/expedition/verify_schedule.py @@ -113,6 +113,36 @@ def verify_schedule( else: time = wp_next.time + # verify instruments in schedule have configuration + for wp in schedule.waypoints: + if wp.instrument is not None: + for instrument in ( + wp.instrument if isinstance(wp.instrument, list) else [wp.instrument] + ): + if ( + instrument == InstrumentType.ARGO_FLOAT + and ship_config.argo_float_config is None + ): + raise PlanningError( + "Planning has waypoint with Argo float instrument, but configuration does not configure Argo floats." + ) + elif ( + instrument == InstrumentType.CTD + and ship_config.argo_float_config is None + ): + raise PlanningError( + "Planning has waypoint with CTD instrument, but configuration does not configure CTDs." + ) + elif ( + instrument == InstrumentType.DRIFTER + and ship_config.argo_float_config is None + ): + raise PlanningError( + "Planning has waypoint with drifter instrument, but configuration does not configure drifters." + ) + else: + raise RuntimeError("Instrument not supported.") + class PlanningError(RuntimeError): """An error in the schedule."""