Skip to content

Stop storing idomain in pwnlayers/pwnlayers3 layer models - #59

Merged
bdestombe merged 1 commit into
mainfrom
pwnlayers-drop-idomain
Jul 22, 2026
Merged

Stop storing idomain in pwnlayers/pwnlayers3 layer models#59
bdestombe merged 1 commit into
mainfrom
pwnlayers-drop-idomain

Conversation

@bdestombe

Copy link
Copy Markdown
Member

Implements the durable half of NHFLO/models#120, per the nlmod maintainer's guidance there: nlmod moved to computing idomain on the fly (nlmod PR #250) precisely to avoid stale stored copies, so get_pwn_layer_model should never put it in data_vars.

  • pwnlayers3/layers.py: drop idomain from the returned dataset (09pwnmodel2 path).
  • pwnlayers/layers.py: same for the older variant (10vlotter, 16dwat path).

Verified before removal: no code in nhflotools, nlmod, or any modelscript reads the stored ds['idomain'] — every consumer (including nlmod.gwf.disv) calls nlmod.dims.layers.get_idomain(ds) fresh from thickness, and both stored copies were themselves pure get_idomain output, so no information is lost. The models-side transitional drop_vars('idomain') guard (pr3 branch) remains valid and becomes a no-op once this merges.

Test suite passes (18 passed). Merge order: independent of tools#58; before the models pr3 PR ideally, but safe in any order thanks to errors='ignore' on the script-side drop.

idomain is derived from layer thickness and goes stale on any later geometry
edit (e.g. the 09pwnmodel2 lake carve via set_model_top), while nlmod
recomputes it from thickness at package-build time and never reads the stored
variable (nlmod PR #250 'calculate_idomain_on_the_fly'). Storing it only
poisons the persisted model dataset with values that misrepresent the built
model. Direction confirmed by nlmod maintainer on NHFLO/models#120.

Both get_pwn_layer_model variants are covered: pwnlayers3 (09pwnmodel2) and
the older pwnlayers (10vlotter, 16dwat). No code in nhflotools, nlmod, or the
modelscripts reads ds['idomain']; all consumers call get_idomain(ds) fresh.
@bdestombe
bdestombe marked this pull request as ready for review July 22, 2026 09:38
@bdestombe
bdestombe merged commit d892e58 into main Jul 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant