Skip to content

Draft: integrate land rerouting and FMS into the SWOPP3 pipeline#60

Draft
daniprec wants to merge 7 commits into
swoppfrom
feat/swopp3-fms-land-pipeline
Draft

Draft: integrate land rerouting and FMS into the SWOPP3 pipeline#60
daniprec wants to merge 7 commits into
swoppfrom
feat/swopp3-fms-land-pipeline

Conversation

@daniprec
Copy link
Copy Markdown
Member

Goal

Combine the two open lines of work into the actual end-to-end optimized SWOPP3 pipeline:

This follow-up makes the optimized route pipeline easier to read and reason about by making the optimization stages explicit:

  1. CMA-ES builds the optimized route
  2. land rerouting corrects coastline crossings
  3. FMS refines the rerouted path
  4. RISE evaluates the final route energy

Dependency status

This PR is intentionally a dependent draft.

It should only be reviewed or merged after both prerequisite PRs are in:

The base branch is docs/swopp3-era5-pipeline to keep the SWOPP3 pipeline context in place, but this branch also carries the land-rerouting pieces needed to exercise the combined flow. After #58 and #59 land, this PR should be rebased or retargeted so the final diff only shows the true follow-up changes.

What changes here

  • add reroute_around_land() and its A*-based helper pipeline in routetools/land.py
  • add regression coverage for land-rerouting behaviour in tests/test_reroute_land.py
  • add scripts/demo_land_avoidance.py for visual validation of GC -> reroute -> FMS routes between ports
  • update routetools/swopp3_runner.py so optimized departures use an explicit pipeline:
    • CMA-ES optimization
    • land rerouting
    • FMS refinement
    • energy evaluation
  • remove the implicit defaults / **kwargs parameter plumbing from the SWOPP3 runner path and make the solver calls explicit
  • extend tests/test_swopp3_runner.py so the runner contract is clearer and the optimization stages are asserted directly

Why this PR exists separately

The previous PRs establish the prerequisites, but they do not yet show the final optimized SWOPP3 route pipeline in one place. This draft isolates that final integration step and the readability cleanup around it.

Validation

  • make hooks
  • make test

@daniprec
Copy link
Copy Markdown
Member Author

Added commit da15c9b to this branch.

This updates the land-avoidance configuration so the reroute A* scale is stored once on the Land object and inherited by the SWOPP3 runner and the demo instead of being hard-coded at each call site.

What changed:

  • Land now carries a shared avoidance_resolution_scale
  • reroute_around_land() defaults to that shared setting when no override is passed
  • load_natural_earth_land_mask() and the SWOPP3/demo entrypoints configure that setting once when the land mask is built
  • regression coverage was added for the default propagation path

Validation:

  • make hooks
  • make test
  • uv run scripts/demo_land_avoidance.py --land-avoidance-resolution-scale 1

Next I am changing the land-mask resolution defaults to trade some coastline detail for faster execution.

@daniprec
Copy link
Copy Markdown
Member Author

Added follow-up commit 3c6bfd9 to make SWOPP3 land handling faster.

This changes the SWOPP3 CLI to build corridor land masks with an explicit --land-resolution option and a coarser default of 0.05 degrees instead of relying on the Natural Earth loader's much finer default. The goal is to shrink the corridor land grid substantially so mask construction and rerouting are cheaper in the common SWOPP3 path.

What changed:

  • added _load_corridor_land_mask() in scripts/swopp3_run.py so corridor land-mask loading is explicit and testable
  • added --land-resolution to the SWOPP3 CLI
  • set the SWOPP3 default land-mask resolution to 0.05 degrees for a faster default execution path
  • added regression coverage that asserts the configured resolution and avoidance scale are forwarded into load_natural_earth_land_mask()

Validation:

  • make hooks
  • make test
  • uv run scripts/swopp3_run.py --cases AGC_WPS --max-departures 1 --quiet --land-resolution 0.05 --output-dir output/swopp3_speed_smoke

Smoke result:

  • the CLI completed successfully and built the land mask with land_resolution=0.05, avoidance_scale=1.

Base automatically changed from docs/swopp3-era5-pipeline to swopp March 16, 2026 11:33
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.

1 participant