Skip to content

DynamicFootprint: confluence example and tests/test_2 - #62

Open
sstruzik wants to merge 1 commit into
mainfrom
feature/dynamic-footprint-confluence
Open

sstruzik wants to merge 1 commit into
mainfrom
feature/dynamic-footprint-confluence

Conversation

@sstruzik

Copy link
Copy Markdown
Contributor

Companion to OasisLMF/OasisLMF#2219 (issue OasisLMF/OasisLMF#2218). Merge OasisLMF#2219 first: this model's lookup now uses the join_rows step, which only exists there, so this PR's automatic CI run (oasislmf from main) fails until it lands. To test both together beforehand, run the model-tests workflow by hand with oasislmf_branch = feature/confluence-section-merge.

What changes in DynamicFootprint

A confluence example: areaperils lying in several sections, which one event can drive at once.

  • Sections 3001-3003 overlap on 18 existing areaperils of the grid (columns 0, 1 and 9 of rows 2-7). Each row is one combination of sections (S1, S1+S2, S2, S1+S3, S1+S2+S3, S2+S3), each column one hazard uncertainty variant: none, the same number of realisations everywhere, or different numbers between sections and between return periods.
  • Three new hazard case partitions and new event definition rows for events 1-8. The existing partitions, the other events' rows and section 2143's polygon are untouched.
  • The cells avoid section 2143's polygon, whose edges run along the grid's diagonals (a point on them falls in or out on the seventh decimal), and tests/test_1's locations. test_1's portfolio only uses section 2143, so it never loads the new sections.
  • The hazard case has no probability column, like the rest of the model: realisations are written as repeated rows (equal weights), e.g. .25/.5/.25 as one value once, one twice, one once.
  • Intensities stay within intensity bins 1-29, which the model's (PiWind) vulnerability covers.
  • Lookup: a join_sections step (type join_rows) after the section rtree gives a location in several sections one keys value (3001;3002).
  • tests/test_2: the 18 locations, one loss line each, default section merge (max).
  • make_confluence_data.py adds the example to the model data, and only it; show_confluence.py prints the footprint OasisLMF builds at those areaperils, without a model run.

Verification (with OasisLMF#2219 installed)

  • test_1: output byte-identical to its existing expected results.
  • test_2: every location gets exactly its sections in the keys; the footprint matches hand-computed values (e.g. event 1: S1+S3 gives 13 at rp 50, every region containing S2 gives 15 at rp 200); 126 event x location losses, all positive.
  • Both tests pass --check-results.

🤖 Generated with Claude Code

Sections 3001-3003 overlap on 18 existing areaperils of the grid, in every
combination of one, two and three sections, each with no hazard
uncertainty, the same number of realisations everywhere, or different
numbers between sections and return periods. Events 1-8 drive them. The
cells are clear of section 2143's polygon and of tests/test_1's locations,
so test_1 is unchanged.

The lookup gets a join_sections step (type join_rows) after the section
rtree, giving a location in several sections one keys value (3001;3002).
make_confluence_data.py adds the example to the model data (and only it);
show_confluence.py prints the footprint built at those areaperils.

Requires OasisLMF with the join_rows step and the section merge
(OasisLMF#2219); merge that first.

Refs OasisLMF/OasisLMF#2218

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants