Skip to content

refactor(dfns): reshape LAK period data - #391

Merged
wpbonelli merged 1 commit into
MODFLOW-ORG:developfrom
wpbonelli:lak-period-union
Oct 12, 2026
Merged

wpbonelli merged 1 commit into
MODFLOW-ORG:developfrom
wpbonelli:lak-period-union

Conversation

@wpbonelli

@wpbonelli wpbonelli commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Reshape LAK period data, remove unnecessary record

Before:

perioddata: List
  item: Record "perioddata"
    laksetting: Union
      status: Record {lakeno, status}
      stage:  Record {lakeno, stage}
      rate:   Record {outletno, rate}
      ...

After:

perioddata: List
  item: Union "laksetting"
    status: Record {lakeno, status}
    stage:  Record {lakeno, stage}
    rate:   Record {outletno, rate}
    ...

Once `number` moves into the arms as `lakeno`/`outletno`, LAK's period
record holds only `laksetting`. Make the list's element the union itself,
as PRP's `releasesetting` already is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wpbonelli wpbonelli added this to the 1.10.0 milestone Oct 12, 2026
@wpbonelli
wpbonelli marked this pull request as ready for review October 12, 2026 21:56
@wpbonelli
wpbonelli merged commit 2d7fa61 into MODFLOW-ORG:develop Oct 12, 2026
17 checks passed
@wpbonelli
wpbonelli deleted the lak-period-union branch October 12, 2026 22:48
wpbonelli added a commit to modflowpy/pyphoenix-project that referenced this pull request Oct 13, 2026
Use MODFLOW-ORG/modflow-devtools#389 and MODFLOW-ORG/modflow-devtools#391 for consistent list field typing

Up to now some packages' period data has been typed as a list of records, where the record is just a leading feature number followed by a union. Codegen used to copy the index into each of the union arms to artificially produce a list of unions. This gave a slightly less verbose API at the cost of harder-to-predict typing. Remove this so the generated field typing follows the DFNs predictably.

# before
Maw.Status(ifno=0, status="active")
Maw.HeadLimit(ifno=1, head_limit="off")

# after
Maw.StressPeriodData(ifno=0, mawsetting=Maw.Status(status="active"))
Maw.StressPeriodData(ifno=1, mawsetting=Maw.HeadLimit(head_limit="OFF"))

# mixing typed and raw format works too
Maw.StressPeriodData(ifno=0, mawsetting=("status", "active")).

Plain tuples like (0, "STATUS", "ACTIVE") can still be passed instead of the typed form. This all applies to MAW, LKT, LKE, SFR, SPC, TVK and TVS

Other changes:

* OC settings become literals, the quickstart changed because of this
* str fields no longer accept numbers, that must be typed as a union
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