Skip to content

feat: add RouteParams.write_summary_to_csv() for human-readable route export #153

Description

@gyanranjanpanda

Feature Request: Route Summary CSV Export

Summary

Add a write_summary_to_csv(filename: str) method to RouteParams and a matching --export-csv PATH CLI argument so operators and researchers can export optimised routes as a plain CSV file.

Motivation

RouteParams currently supports two output formats:

  • write_to_geojson() - machine-readable GeoJSON (good for GIS tools)
  • write_to_file() - custom JSON snapshot

Neither is directly usable in common data-analysis workflows such as opening in Excel/LibreOffice Calc or reading with pandas.read_csv(). A CSV export removes this friction without adding new dependencies.

Proposed Changes

WeatherRoutingTool/routeparams.py

New method on RouteParams:

def write_summary_to_csv(self, filename: str) -> None:
    ...

Columns per waypoint:

Column Unit
waypoint_id -
latitude_deg deg
longitude_deg deg
timestamp ISO-8601
speed_mps m/s
engine_power_kW kW
fuel_rate_kg_per_s kg/s
wave_height_m m
wind_resistance_N N
dist_to_next_m m
status -

The destination (last) row uses -99 sentinels, consistent with the existing write_to_geojson() convention.

cli.py

New optional argument:

--export-csv PATH    Path for a per-waypoint CSV summary of the optimised route.

WeatherRoutingTool/execute_routing.py

execute_routing() gains an optional csv_export_path: str = None parameter; fully backward-compatible.

Implementation

A working implementation is available on branch feature/route-summary-csv-export with two accompanying pytest tests covering column headers and sentinel values.

No New Dependencies

Uses Python's built-in csv module only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions