Skip to content

Commit 41bb069

Browse files
Merge branch 'main' into 119-fetch-add-argo-and-drifter-datasets
2 parents 1778f69 + 8b76228 commit 41bb069

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

src/virtualship/cli/_fetch.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from pathlib import Path
66
from typing import TYPE_CHECKING
77

8-
import click
98
from pydantic import BaseModel
109

1110
from virtualship.utils import _dump_yaml, _generic_load_yaml
@@ -89,13 +88,10 @@ def get_existing_download(
8988
data_folder: Path, space_time_region_hash: str
9089
) -> Path | None:
9190
"""Check if a download has already been completed. If so, return the path for existing download."""
92-
for download_path in data_folder.iterdir():
91+
for download_path in data_folder.rglob("*"):
9392
try:
9493
hash = filename_to_hash(download_path.name)
9594
except ValueError:
96-
click.echo(
97-
f"Skipping {download_path.name} as it is not a valid download folder name."
98-
)
9995
continue
10096

10197
if hash == space_time_region_hash:

src/virtualship/expedition/do_expedition.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,26 @@ def do_expedition(expedition_dir: str | Path, input_data: Path | None = None) ->
3232
ship_config = _get_ship_config(expedition_dir)
3333
schedule = _get_schedule(expedition_dir)
3434

35+
# remove instrument configurations that are not in schedule
36+
instruments_in_schedule = [
37+
waypoint.instrument.name for waypoint in schedule.waypoints
38+
]
39+
40+
for instrument in [
41+
"ARGO_FLOAT",
42+
"DRIFTER",
43+
"XBT",
44+
"CTD",
45+
"ADCP",
46+
"SHIP_UNDERWATER_ST",
47+
]: # TODO make instrument names consistent capitals or lowercase throughout codebase
48+
if (
49+
hasattr(ship_config, instrument.lower() + "_config")
50+
and instrument not in instruments_in_schedule
51+
):
52+
print(f"{instrument} configuration provided but not in schedule.")
53+
setattr(ship_config, instrument.lower() + "_config", None)
54+
3555
# load last checkpoint
3656
checkpoint = _load_checkpoint(expedition_dir)
3757
if checkpoint is None:

0 commit comments

Comments
 (0)