Skip to content

ERA5 loader silently clamps out-of-range timestamps to nearest boundary #51

Description

@fjsuarez

Problem

The ERA5 field closures (wind, wave) use jax.scipy.ndimage.map_coordinates with mode="nearest". When t exceeds the temporal extent of the loaded NetCDF file, the query is silently clamped to the last available timestep.

Example: A route departing Dec 28 2024 with a 10-day crossing needs weather data into Jan 7 2025. If only 2024 data is loaded, segments arriving in 2025 silently use Dec 31 2024 18:00 weather — frozen in time, no error, no warning.

Impact

  • Optimization produces routes that ignore actual weather conditions for the later portion of the voyage
  • Performance/cost calculations are based on stale data
  • The user has no indication this is happening

Proposed solution

  1. Download script: Accept a date range (not just a single year) so overlapping data can be fetched:
    uv run scripts/download_era5.py --start 2024-12-01 --end 2025-02-01
  2. Loader: Support loading and concatenating multiple NetCDF files along the time axis
  3. Boundary warning: Log a warning (or raise) when t exceeds the dataset's temporal range

Workaround

For now, download a second year and concatenate manually with xarray, or ensure departures are early enough that the full voyage fits within the downloaded year.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    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