|
19 | 19 | from .verify_schedule import verify_schedule |
20 | 20 |
|
21 | 21 |
|
22 | | -def do_expedition(expedition_dir: str | Path) -> None: |
| 22 | +def do_expedition(expedition_dir: str | Path, input_data: Path | None = None) -> None: |
23 | 23 | """ |
24 | 24 | Perform an expedition, providing terminal feedback and file output. |
25 | 25 |
|
26 | 26 | :param expedition_dir: The base directory for the expedition. |
| 27 | + :param input_data: Input data folder folder (override used for testing). |
27 | 28 | """ |
28 | 29 | if isinstance(expedition_dir, str): |
29 | 30 | expedition_dir = Path(expedition_dir) |
@@ -51,7 +52,10 @@ def do_expedition(expedition_dir: str | Path) -> None: |
51 | 52 |
|
52 | 53 | # load fieldsets |
53 | 54 | input_data = _load_input_data( |
54 | | - expedition_dir=expedition_dir, schedule=schedule, ship_config=ship_config |
| 55 | + expedition_dir=expedition_dir, |
| 56 | + schedule=schedule, |
| 57 | + ship_config=ship_config, |
| 58 | + input_data=input_data, |
55 | 59 | ) |
56 | 60 |
|
57 | 61 | # verify schedule makes sense |
@@ -115,13 +119,31 @@ def _get_ship_config(expedition_dir: Path) -> ShipConfig | None: |
115 | 119 |
|
116 | 120 |
|
117 | 121 | def _load_input_data( |
118 | | - expedition_dir: Path, schedule: Schedule, ship_config: ShipConfig |
| 122 | + expedition_dir: Path, |
| 123 | + schedule: Schedule, |
| 124 | + ship_config: ShipConfig, |
| 125 | + input_data: Path | None, |
119 | 126 | ) -> InputData: |
120 | | - aoi_hash = hash_model(schedule.area_of_interest) |
121 | | - download_directory = get_existing_download(expedition_dir, aoi_hash) |
| 127 | + """ |
| 128 | + Load the input data. |
| 129 | +
|
| 130 | + :param expedition_dir: Directory of the expedition. |
| 131 | + :type expedition_dir: Path |
| 132 | + :param schedule: Schedule object. |
| 133 | + :type schedule: Schedule |
| 134 | + :param ship_config: Ship configuration. |
| 135 | + :type ship_config: ShipConfig |
| 136 | + :param input_data: Folder containing input data. |
| 137 | + :type input_data: Path | None |
| 138 | + :return: InputData object. |
| 139 | + :rtype: InputData |
| 140 | + """ |
| 141 | + if input_data is None: |
| 142 | + aoi_hash = hash_model(schedule.area_of_interest) |
| 143 | + input_data = get_existing_download(expedition_dir, aoi_hash) |
122 | 144 |
|
123 | 145 | return InputData.load( |
124 | | - directory=download_directory, |
| 146 | + directory=input_data, |
125 | 147 | load_adcp=ship_config.adcp_config is not None, |
126 | 148 | load_argo_float=ship_config.argo_float_config is not None, |
127 | 149 | load_ctd=ship_config.ctd_config is not None, |
|
0 commit comments