Skip to content

Data layers with a time axis interpolate backwards, and lose their values past 24 h #232

Closed

Description

@HugoFara

A data layer with more than one time slice (e.g. hourly windU/windV) returns the wrong slice:

  1. NCXYZTDataLayer.h:376 returns at*val1 + (1-at)*val2, where at goes from 0 at slice it to 1 at slice it+1. Just after slice it, the layer returns slice it+1. Line 375 also ignores startTime.
  2. dt is only set when timespan < 24 h (line 156). Above that it stays 0, and line 359 divides by it.

East spread after 300 s, GR2, from repro_time_layer.py. Each run is in its own ForeFireRunner:

windU layer East (m) West (m) Expected
constant 0 m/s 87 87
constant 8 m/s 152 87
0 → 8 m/s over 2000 s 142 87 ≈ calm
8 → 0 m/s over 2000 s 87 87 ≈ 8 m/s
either ramp over 1 day 87 87 wind lost

Was the 24 h limit meant for something? Without it, run_ensemble could follow hourly weather in one goTo; for now trigger[wind] ignores its t and applies at once.

repro_time_layer.py
"""A data layer with a time axis: calm at t=0, 8 m/s east at t=span."""
import re, numpy as np, pyforefire as pyff

def east_west(t_end, span, u):
    with pyff.ForeFireRunner() as ff:          # fresh process: the kernel keeps global state
        ff["propagationModel"] = "Farsite"; ff["fuelsTable"] = "STDfarsiteFuelsTable"; ff["minSpeed"] = 0
        ff.execute("FireDomain[sw=(0,0,0);ne=(2000,2000,0);t=0]")
        ff.addLayer("propagation", "Farsite", "propagationModel")
        ff.addIndexLayer("table", "fuel", 0, 0, 0, 2000, 2000, 0, np.full((1, 1, 10, 10), 102, np.int32))
        ff.addScalarLayer("data", "altitude", 0, 0, 0, 2000, 2000, 0, np.zeros((1, 1, 10, 10)))
        ff.addScalarLayer("data", "windU", 0, 0, 0, 2000, 2000, span, u)
        ff.addScalarLayer("data", "windV", 0, 0, 0, 2000, 2000, span, np.zeros_like(u))
        ff.execute("startFire[loc=(1000,1000,0);t=0]")
        ff.execute(f"goTo[t={t_end}]")
        x = [float(m.split(",")[0]) for m in re.findall(r"loc=\(([^)]*)\)", ff.execute("print[]"))]
        return round(max(x) - 1000), round(1000 - min(x))

ramp = np.zeros((2, 1, 2, 2)); ramp[1] = 8.0
print("constant 0 m/s,             first 300 s: east/west =", east_west(300, 0, np.zeros((1, 1, 2, 2))))
print("constant 8 m/s,             first 300 s: east/west =", east_west(300, 0, np.full((1, 1, 2, 2), 8.0)))
print("0 -> 8 m/s over 2000 s,     first 300 s: east/west =", east_west(300, 2000, ramp))
print("0 -> 8 m/s over 1 day,      first 300 s: east/west =", east_west(300, 86400, ramp))
down = np.zeros((2, 1, 2, 2)); down[0] = 8.0
print("8 -> 0 m/s over 2000 s,     first 300 s: east/west =", east_west(300, 2000, down))
print("8 -> 0 m/s over 1 day,      first 300 s: east/west =", east_west(300, 86400, down))

Drafted with Claude Opus 5.5.

Activity

  1. added theissue type on Oct 29, 2026
  2. antonio-leblanc commented on Oct 30, 2026

    @antonio-leblanc
    Collaborator

    Fixed by #235, merged into dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed incorrect behavior

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions