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
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
title: ["needs-triage"]
labels: bug
assignees: ""
---
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
title: ["needs-triage"]
labels: enhancement
assignees: ""
---
Expand Down
8 changes: 4 additions & 4 deletions docs/user-guide/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ virtualship init EXPEDITION_NAME --from-mfp CoordinatesExport.xlsx
The `CoordinatesExport.xlsx` in the `virtualship init` command refers to the .xlsx file exported from MFP. Replace the filename with the name of your exported .xlsx file (and make sure to move it from the Downloads to the folder/directory in which you are running the expedition).
```

This will create a folder/directory called `EXPEDITION_NAME` with two files: `schedule.yaml` and `ship_config.yaml` based on the sampling site coordinates that you specified in your MFP export. The `--from-mfp` flag indictates that the exported coordinates will be used.
This will create a folder/directory called `EXPEDITION_NAME` with a single file: `expedition.yaml` containing details on the ship and instrument configurations, as well as the expedition schedule based on the sampling site coordinates that you specified in your MFP export. The `--from-mfp` flag indicates that the exported coordinates will be used.

```{note}
For advanced users: it is also possible to run the expedition initialisation step without an MFP .xlsx export file. In this case you should simply run `virtualship init EXPEDITION_NAME` in the CLI. This will write example `schedule.yaml` and `ship_config.yaml` files in the `EXPEDITION_NAME` folder/directory. These files contain example waypoints, timings and instrument selections, but can be edited or propagated through the rest of the workflow unedited to run a sample expedition.
For advanced users: it is also possible to run the expedition initialisation step without an MFP .xlsx export file. In this case you should simply run `virtualship init EXPEDITION_NAME` in the CLI. This will write an example `expedition.yaml` file in the `EXPEDITION_NAME` folder/directory. This file contains example waypoints, timings, instrument selections, and ship configuration, but can be edited or propagated through the rest of the workflow unedited to run a sample expedition.
```

## Expedition scheduling & ship configuration
Expand All @@ -61,7 +61,7 @@ virtualship plan EXPEDITION_NAME
```

```{tip}
Using the `virtualship plan` tool is optional. Advanced users can also edit the `schedule.yaml` and `ship_config.yaml` files directly if preferred.
Using the `virtualship plan` tool is optional. Advanced users can also edit the `expedition.yaml` file directly if preferred.
```

The planning tool should look something like this and offers an intuitive way to make your selections:
Expand Down Expand Up @@ -111,7 +111,7 @@ For advanced users: you can also make further customisations to behaviours of al
When you are happy with your ship configuration and schedule plan, press _Save Changes_.

```{note}
On pressing _Save Changes_ the tool will check the selections are valid (for example that the ship will be able to reach each waypoint in time). If they are, the changes will be saved to the `ship_config.yaml` and `schedule.yaml` files, ready for the next steps. If your selections are invalid you should be provided with information on how to fix them.
On pressing _Save Changes_ the tool will check the selections are valid (for example that the ship will be able to reach each waypoint in time). If they are, the changes will be saved to the `expedition.yaml` file, ready for the next steps. If your selections are invalid you should be provided with information on how to fix them.
```

## Fetch the data
Expand Down
47 changes: 24 additions & 23 deletions docs/user-guide/tutorials/Argo_data_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -28,33 +28,34 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We have downloaded the data from Copernicus Marine Service, using `virtualship fetch` and the information in following `schedule.yaml` file:\n",
"We have downloaded the data from Copernicus Marine Service, using `virtualship fetch` and the information in following `schedule` section of the `expedition.yaml` file:\n",
"```yaml\n",
"space_time_region:\n",
" spatial_range:\n",
" minimum_longitude: -5\n",
" maximum_longitude: 5\n",
" minimum_latitude: -5\n",
" maximum_latitude: 5\n",
" minimum_depth: 0\n",
" maximum_depth: 2000\n",
" time_range:\n",
" start_time: 2023-01-01 00:00:00\n",
" end_time: 2023-02-01 00:00:00\n",
"waypoints:\n",
" - instrument: ARGO_FLOAT\n",
" location:\n",
" latitude: 0.02\n",
" longitude: 0.02\n",
" time: 2023-01-01 02:00:00\n",
"schedule:\n",
" space_time_region:\n",
" spatial_range:\n",
" minimum_longitude: -5\n",
" maximum_longitude: 5\n",
" minimum_latitude: -5\n",
" maximum_latitude: 5\n",
" minimum_depth: 0\n",
" maximum_depth: 2000\n",
" time_range:\n",
" start_time: 2023-01-01 00:00:00\n",
" end_time: 2023-02-01 00:00:00\n",
" waypoints:\n",
" - instrument: ARGO_FLOAT\n",
" location:\n",
" latitude: 0.02\n",
" longitude: 0.02\n",
" time: 2023-01-01 02:00:00\n",
"```\n",
"\n",
"After running `virtualship run`, we have a `results/argo_floats.zarr` file with the data from the float."
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -79,7 +80,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -111,7 +112,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "parcels",
"display_name": "ship",
"language": "python",
"name": "python3"
},
Expand All @@ -125,7 +126,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.12.9"
}
},
"nbformat": 4,
Expand Down
28 changes: 14 additions & 14 deletions src/virtualship/cli/_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
from virtualship.utils import (
_dump_yaml,
_generic_load_yaml,
_get_schedule,
_get_ship_config,
_get_expedition,
)

if TYPE_CHECKING:
Expand All @@ -24,7 +23,7 @@
from copernicusmarine.core_functions.credentials_utils import InvalidUsernameOrPassword

import virtualship.cli._creds as creds
from virtualship.utils import SCHEDULE
from virtualship.utils import EXPEDITION

DOWNLOAD_METADATA = "download_metadata.yaml"

Expand All @@ -49,17 +48,18 @@ def _fetch(path: str | Path, username: str | None, password: str | None) -> None
data_folder = path / "data"
data_folder.mkdir(exist_ok=True)

schedule = _get_schedule(path)
ship_config = _get_ship_config(path)
expedition = _get_expedition(path)

schedule.verify(
ship_config.ship_speed_knots,
expedition.schedule.verify(
expedition.ship_config.ship_speed_knots,
input_data=None,
check_space_time_region=True,
ignore_missing_fieldsets=True,
)

space_time_region_hash = get_space_time_region_hash(schedule.space_time_region)
space_time_region_hash = get_space_time_region_hash(
expedition.schedule.space_time_region
)

existing_download = get_existing_download(data_folder, space_time_region_hash)
if existing_download is not None:
Expand All @@ -72,27 +72,27 @@ def _fetch(path: str | Path, username: str | None, password: str | None) -> None
username, password = creds.get_credentials_flow(username, password, creds_path)

# Extract space_time_region details from the schedule
spatial_range = schedule.space_time_region.spatial_range
time_range = schedule.space_time_region.time_range
spatial_range = expedition.schedule.space_time_region.spatial_range
time_range = expedition.schedule.space_time_region.time_range
start_datetime = time_range.start_time
end_datetime = time_range.end_time
instruments_in_schedule = schedule.get_instruments()
instruments_in_schedule = expedition.schedule.get_instruments()

# Create download folder and set download metadata
download_folder = data_folder / hash_to_filename(space_time_region_hash)
download_folder.mkdir()
DownloadMetadata(download_complete=False).to_yaml(
download_folder / DOWNLOAD_METADATA
)
shutil.copyfile(path / SCHEDULE, download_folder / SCHEDULE)
shutil.copyfile(path / EXPEDITION, download_folder / EXPEDITION)

if (
(
{"XBT", "CTD", "CDT_BGC", "SHIP_UNDERWATER_ST"}
& set(instrument.name for instrument in instruments_in_schedule)
)
or ship_config.ship_underwater_st_config is not None
or ship_config.adcp_config is not None
or expedition.instruments_config.ship_underwater_st_config is not None
or expedition.instruments_config.adcp_config is not None
):
print("Ship data will be downloaded. Please wait...")

Expand Down
Loading
Loading