antarctica / PolarRoute

Long-distance maritime polar route planning, taking into account complex changing environmental conditions.
https://antarctica.github.io/PolarRoute/
MIT License
17 stars 3 forks source link

CLI PolarRoute Dijkstra Filename #257

Closed Ulvetanna closed 7 months ago

Ulvetanna commented 8 months ago

Currently if provide the command line optimise_routes something in the form: optimise_routes config mesh -o ./Outputs/routes.json -d then it will fail as it tries to append the _dijkstra at the start of the path string.

Ulvetanna commented 8 months ago

The easy fix is to change the code below, from:

  if args.dijkstra:
      # Form a unique name for the dijkstra output
      dijkstra_output_file_strs = output_file_strs
      dijkstra_output_file_strs[0] += '_dijkstra'

to

    if args.dijkstra:
        # Form a unique name for the dijkstra output
        dijkstra_output_file_strs = output_file_strs
        dijkstra_output_file_strs[-2] += '_dijkstra'

This is because it's indexing on the . and the -1 entry is the file-postfix so it should be the second from last -2 Could someone make the code change and update the codebase