Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/virtualship/cli/_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
20 changes: 20 additions & 0 deletions src/virtualship/expedition/do_expedition.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down