lautenberger / elmfire

Eulerian Level set Model of FIRE spread
https://elmfire.io
Eclipse Public License 2.0
23 stars 11 forks source link

Feature request: timings at size thresholds #30

Closed vvvvalvalval closed 10 months ago

vvvvalvalval commented 10 months ago

This issue requests a new output type for ELMFIRE, and proposes a configuration schema for it.

Problem statement

For some use cases, it is valuable to know the times since ignition at which each simulated fire reaches certain size thresholds (if ever).

Proposed solution

New configuration in elmfire.data would look like:

&OUTPUTS
...
TIME_AT_BURNED_ACRES(:) = 1.0, 3.0, 10.0, 30.0, 100.0, 300.0, 500.0, 700.0, 1000.0
TIME_AT_BURNED_ACRES_CSV = 'path/to/my/burned-acres-timings.csv'

The output CSV would look like:

icase, atotal_threshold_ac, toa_hr
...
1789, 1.0, 1.43
1789, 3.0, 2.25
1789, 10.0, 5.18
1790, 3.0, 3.12
...

The 3rd line displayed above says: "The simulated fire number 1789 reached a size of 10 acres at 5.18 simulated hours of spread". In this example, we see that fire 1789 never reaches 100 acres, since the next line is about fire 1790. We also see that fire 1790 started with an initial size larger than 1 acre (which is fine), such that no 1 ac event was emitted.

lautenberger commented 10 months ago

A few tweaks will make this a bit easier to implement:

Separate csvs written by each process would then be consolidated during post processing, something like this:

rm -f burned-acres-timings.csv
for f in burned-acres-timings_*.csv; do
    cat $f >> burned-acres-timings.csv
done
rm -f burned-acres-timings_*.csv
vvvvalvalval commented 10 months ago

@lautenberger this looks fine by me. I generally welcome the use of several CSV output files, as that facilitates parallel processing by downstream consumers.

vvvvalvalval commented 10 months ago

@lautenberger that said, may I suggest writing those CSVs under a sub-directory? Might be more convenient for consumers.

lautenberger commented 10 months ago

I'd like to keep all the outputs written by ELMFIRE in OUTPUTS_DIRECTORY but we can certainly move files around in post processing to clean up the directory structure.

lautenberger commented 10 months ago

This is implemented in commit https://github.com/lautenberger/elmfire/commit/113eb28c8c3e060c57bdf303975fe34fdf1edd7c. The main enhancement is to implement the keyword TIME_AT_BURNED_ACRES(:) in the &OUTPUTS namelist group. csv outputs are written to OUTPUTS_DIRECTORY with filename burned-acres-timings_####.csv.