Skip to content

Timedeltas and arrival/departure ports from MFP export - #372

Draft
j-atkins wants to merge 160 commits into
mainfrom
cruise-data
Draft

j-atkins wants to merge 160 commits into
mainfrom
cruise-data

Conversation

@j-atkins

@j-atkins j-atkins commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

DRAFT

This PR uses the new exported fields from the MFP "Cruise Data" (see #362) to auto-fill the waypoints times using a user-prescribed --start-date and timedeltas from MFP when doing virtualship init --from-mfp.

Also, now that the ports of arrival/departure have been added to the MFP export these are now incorporated into the expedition.yaml, including a new Port model class. These act as special waypoints with times and locations but no instruments.

Further notes

  • Schedule model gets pydantic field validators, ensuring that departure and arrival ports are always ingested in an expedition (dummies are added when not specified in virtualship init). Ensures compliance with logic throughout codebase (e.g. with the RLCs).
    • These validators concern the structure of the Schedule, as a 'minimum standard' in order for other logic to work. Further checks (e.g. that waypoints can be reached in time) remain in Schedule.verify method. This is a design choice whereby these verification checks require more user thinking/interaction to relate to real-life.
  • Refactored virtualship init logic to a new module (cli/_initialise.py). Should help with readability and maintainability now that there is a lot more logic associated with this command, plus is consistent with the structure for other commands (plan and run).
  • Now adds comments to the expedition.yaml, marking e.g. # Port of Departure, Waypoint 1, Waypoint 2 and so on. This helps with config readability and is a previous user-feedback request.
  • Some of the new logic relies on the MFP export format staying the same and we do not have control over this. I have added checks along the way when ingesting (with instructions to raise an issue if a user believes something has changed). Ideally though we would also unit test for this to catch drift, but I don't know how we would go about this given it requires getting an up to date export from MFP.
  • Plan tool updated to handle Ports.
    • Ports are added in the "Waypoints" drop down but have no instrument selection options.
    • Adding/removing waypoints ignores Ports, these should not be removed/more added.

TODOs

  • Add check that an Expedition object ingested to run always has an departure and arrival port (even if empty placeholders), to ensure consistent problems module behaviour
  • Ensure Port waypoints are handled properly when reading expedition.yaml back in plan or run
  • Ensure all public facing wp comms are up to date now that Ports are a special waypoint (including Schedule, InstrumentsConfig and Checkpoint .verify() methods, plus simulate_schedule).
  • Adapt plan tool
  • Update docs
  • More tests
    • Including new test_initialise.py file w/ new tests.


Closes #362

j-atkins and others added 30 commits May 20, 2026 11:25
…ate tests with more tolerance for interpolation discrepancies
Base automatically changed from migrate-v4 to main September 14, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add depature/arrival ports and time deltas to expedition init

2 participants