Skip to content

fix(core): interpolate time-varying data layers forwards, past 24 h too (#232) - #235

Merged
filippi merged 2 commits into
forefireAPI:devfrom
HugoFara:fix/time-layer-interpolation
Oct 30, 2026
Merged

filippi merged 2 commits into
forefireAPI:devfrom
HugoFara:fix/time-layer-interpolation

Conversation

@HugoFara

Copy link
Copy Markdown
Collaborator

Fixes #232. A data layer with several time slices (e.g. hourly windU/windV) now returns the right value:

  • Weights: they were swapped, so just after slice k the layer returned slice k+1. They also ignored startTime.
  • Past 24 h: dt stayed 0 when the timespan was 24 h or more, so the layer returned NaN. The 24 h limit is gone.
  • Ends: at the last slice the code read one slice past the array. Before the first slice or after the last, the layer now holds that slice.

East spread after 300 s from repro_time_layer.py in #232 (calm 87 m, constant 8 m/s 152 m):

windU layer dev this PR
0 → 8 m/s over 2000 s 142 87
8 → 0 m/s over 2000 s 87 142
8 → 0 m/s over 1 day 87 150

Tested: new data layers unit suite (3 of its 4 cases fail on dev), ctest 11/11, Python runner and ensemble tests pass. WeatherDataLayer.h has the same code but nothing includes it, so I left it alone.

Was the 24 h limit there on purpose?

Drafted with Claude Opus 5.5.

…oo (forefireAPI#232)

A data layer with several time slices weighted them the wrong way round:
just after slice k it returned slice k+1. It also ignored startTime in the
weight, read one slice past the array at the last slice, and left dt at 0
when the timespan was 24 h or more, so multi-day layers returned NaN.

Weight slices by their distance from t, measured from startTime, and hold
the first or last slice outside the time axis. New "data layers" unit suite.

@filippi filippi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @HugoFara , this was never really tested.. you fixed it

@filippi
filippi merged commit 0a912f9 into forefireAPI:dev Oct 30, 2026
5 checks passed
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.

2 participants