diff --git a/src/virtualship/cli/_fetch.py b/src/virtualship/cli/_fetch.py index cfa52a61..4eb0d2d3 100644 --- a/src/virtualship/cli/_fetch.py +++ b/src/virtualship/cli/_fetch.py @@ -5,7 +5,6 @@ from pathlib import Path from typing import TYPE_CHECKING -import click from pydantic import BaseModel from virtualship.utils import _dump_yaml, _generic_load_yaml @@ -89,13 +88,10 @@ def get_existing_download( data_folder: Path, space_time_region_hash: str ) -> Path | None: """Check if a download has already been completed. If so, return the path for existing download.""" - for download_path in data_folder.iterdir(): + for download_path in data_folder.rglob("*"): try: hash = filename_to_hash(download_path.name) except ValueError: - click.echo( - f"Skipping {download_path.name} as it is not a valid download folder name." - ) continue if hash == space_time_region_hash: diff --git a/src/virtualship/expedition/do_expedition.py b/src/virtualship/expedition/do_expedition.py index 1846ea14..de5d8a3a 100644 --- a/src/virtualship/expedition/do_expedition.py +++ b/src/virtualship/expedition/do_expedition.py @@ -32,6 +32,26 @@ def do_expedition(expedition_dir: str | Path, input_data: Path | None = None) -> ship_config = _get_ship_config(expedition_dir) schedule = _get_schedule(expedition_dir) + # remove instrument configurations that are not in schedule + instruments_in_schedule = [ + waypoint.instrument.name for waypoint in schedule.waypoints + ] + + for instrument in [ + "ARGO_FLOAT", + "DRIFTER", + "XBT", + "CTD", + "ADCP", + "SHIP_UNDERWATER_ST", + ]: # TODO make instrument names consistent capitals or lowercase throughout codebase + if ( + hasattr(ship_config, instrument.lower() + "_config") + and instrument not in instruments_in_schedule + ): + print(f"{instrument} configuration provided but not in schedule.") + setattr(ship_config, instrument.lower() + "_config", None) + # load last checkpoint checkpoint = _load_checkpoint(expedition_dir) if checkpoint is None: