OasisLMF / ktools

In-memory simulation kernel for loss modelling.
BSD 3-Clause "New" or "Revised" License
28 stars 19 forks source link

Missing header in Wheatsheaf output #323

Closed hchagani-oasislmf closed 1 year ago

hchagani-oasislmf commented 2 years ago

Issue Description

Under certain circumstances, the Wheatsheaf AEP and OEP outputs from leccalc are missing the header row and potentially some summary IDs.

Version / Environment information

Reported in v3.8.0. Seen in v3.9.2.

hchagani-oasislmf commented 1 year ago

It would appear that there is no issue with missing summary IDs. As the header is written out when the results for the lowest summary ID are calculated, when the lowest summary ID yields no output (i.e. when all the samples are zero loss), the header is not written out.

The good news is that there is no issue with the outputted values themselves. The only thing that needs to be fixed is the missing header.

At the moment, the logic for determining whether this header is written out is rather convoluted, and is open to repeated, unnecessary checks when using index files. Although profiling indicates that these unnecessary checks have a negligible effect on performance, simplifying the logic for writing the header would aid future development. As such, this issue can be combined with https://github.com/OasisLMF/ktools/issues/278.