Skip to content

Smoothing crashes on particular days; 'Newton Curve Issue' #295

@hjabbot

Description

@hjabbot

Describe the bug
PolarRoute crashes with particular datasets, probably something to do with current vectors exceeding possible vessel speeds since it pops up most with gliders, however attached is a crash experiences using the SDA as the vehicle. In the cases I was testing when I stumbled on this, I was aggregating 3 days of data for each day of a month. 2 runs failed, and they did not have overlapping days. Other runs around the failing days were ok, so this problem isn't to do with a single day's dataset, but rather the values after aggregating; probably a combination of high SIC and high currents.

In doing these tests, it dawned on me that we should be saving outputs for successfully navigated routes. All but one of the calculated routes were successful, but because one crashed, nothing was saved out.

This bug appears both on main and on 0.6.x

To Reproduce
I have provided the set of configs that fails below. Crashes during smoothing.

Screenshots & Files
2024-01-06_amsr_failing_case.zip

Traceback (most recent call last):
  File "/home/habbot/Documents/Work/BAS/repos/sdadt/venv_dev/bin/optimise_routes", line 8, in <module>
    sys.exit(optimise_routes_cli())
             ^^^^^^^^^^^^^^^^^^^^^
  File "/home/habbot/Documents/Work/BAS/repos/sdadt/PolarRoute/polar_route/utils.py", line 238, in wrapper
    res = func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^
  File "/home/habbot/Documents/Work/BAS/repos/sdadt/PolarRoute/polar_route/cli.py", line 202, in optimise_routes_cli
    smoothed_routes = rp.compute_smoothed_routes()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/habbot/Documents/Work/BAS/repos/sdadt/PolarRoute/polar_route/utils.py", line 238, in wrapper
    res = func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^
  File "/home/habbot/Documents/Work/BAS/repos/sdadt/PolarRoute/polar_route/route_planner/route_planner.py", line 700, in compute_smoothed_routes
    sf.forward()
  File "/home/habbot/Documents/Work/BAS/repos/sdadt/PolarRoute/polar_route/route_planner/crossing_smoothing.py", line 1334, in forward
    midpoint_prime = self.newton_smooth(ap.start, ap.end, ap.case, firstpoint, midpoint, lastpoint)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/habbot/Documents/Work/BAS/repos/sdadt/PolarRoute/polar_route/route_planner/crossing_smoothing.py", line 674, in newton_smooth
    midpoint = self._long_case(start, end, case, firstpoint, midpoint, lastpoint)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/habbot/Documents/Work/BAS/repos/sdadt/PolarRoute/polar_route/route_planner/crossing_smoothing.py", line 481, in _long_case
    y           = newton_optimisation_long(_F, y0, x, a, Y, u1, v1, u2, v2, speed_s, speed_e, Rd, λ_s, φ_r)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/habbot/Documents/Work/BAS/repos/sdadt/PolarRoute/polar_route/route_planner/crossing_smoothing.py", line 381, in newton_optimisation_long
    raise Exception('Newton Curve Issue - Longitude Case')
Exception: Newton Curve Issue - Longitude Case

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIt might be considered a bug...

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions