Skip to content

[lakes_pwn] External outlet encoded as string '-1' crashes nlmod.gwf.lake.lake_from_gdf #72

Description

@bdestombe

Severity: minor (blocks re-enabling the LAK package on wider extents)

Where: src/nhflodata/data/mockup/lakes_pwn/.../lakes_pwn.geojson — lake 'Vlotter 0' has lakeout='-1' stored as a string (and the bassin strt is NaN).

Problem. nlmod.gwf.lake.lake_from_gdf treats any string lakeout as a boundname to resolve; no lake is named '-1', so the boundname mask is empty and gdf.loc[mask, "lakeno"].iloc[0] raises IndexError instead of creating an out-of-model outlet (which requires integer -1, flopy zero-based). Inert today only because the Vlotter lakes fall outside the Bergen extent; any wider extent that re-enables the LAK block crashes here.

Suggested fix. Store lakeout as integer -1 (or empty) in the geojson. A complementary nlmod hardening issue (parse numeric strings / raise a clear error) is filed upstream. Relates to #9 (validate geojson) and #11 (merge lakes).


From a systematic review of modelscripts/09pwnmodel2/01_pwnmodel2.py and its dependency stack (nhflotools, nhflodata, nlmod), July 2026. Every finding was traced through the actual code and adversarially verified before filing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions