From 6e4c81e635ad3874692b209dfa56c9e986130c9e Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Thu, 22 Oct 2026 05:25:55 -0700 Subject: [PATCH] refactor(dfns): name STO's period field stress_period_data The dev2 migration collapses STO's STEADY-STATE/TRANSIENT keywords into one untagged string per period. Name it stress_period_data, like every other package's period data, instead of storage, so consumers can treat it as an ordinary single-field period block without a rename table. Applies to chf-sto, gwf-sto, olf-sto and swf-sto. Co-Authored-By: Claude Opus 5.5 --- autotest/dfns/__snapshots__/v2.0.0.dev2/chf-sto.json | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev2/chf-sto.toml | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev2/chf-sto.yaml | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev2/gwf-sto.json | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev2/gwf-sto.toml | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev2/gwf-sto.yaml | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev2/olf-sto.json | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev2/olf-sto.toml | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev2/olf-sto.yaml | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev2/swf-sto.json | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev2/swf-sto.toml | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev2/swf-sto.yaml | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev3/chf-sto.json | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev3/chf-sto.toml | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev3/chf-sto.yaml | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-sto.json | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-sto.toml | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-sto.yaml | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev3/olf-sto.json | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev3/olf-sto.toml | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev3/olf-sto.yaml | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev3/swf-sto.json | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev3/swf-sto.toml | 2 +- autotest/dfns/__snapshots__/v2.0.0.dev3/swf-sto.yaml | 2 +- autotest/dfns/test_schema.py | 6 ++++-- modflow_devtools/dfns/migrate_to_v2_0_0_dev2.py | 9 ++++++--- modflow_devtools/dfns/migrate_to_v2_0_0_dev3.py | 2 +- 27 files changed, 35 insertions(+), 30 deletions(-) diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev2/chf-sto.json b/autotest/dfns/__snapshots__/v2.0.0.dev2/chf-sto.json index 3d53b482..5d69bba6 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev2/chf-sto.json +++ b/autotest/dfns/__snapshots__/v2.0.0.dev2/chf-sto.json @@ -23,7 +23,7 @@ }, "period": { "fields": { - "storage": { + "stress_period_data": { "type": "string", "longname": "storage state", "description": "keyword to indicate that stress period IPER is steady-state. Steady-state conditions will apply until the TRANSIENT keyword is specified in a subsequent BEGIN PERIOD block.", diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev2/chf-sto.toml b/autotest/dfns/__snapshots__/v2.0.0.dev2/chf-sto.toml index de3fb477..5c10121f 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev2/chf-sto.toml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev2/chf-sto.toml @@ -16,7 +16,7 @@ longname = "export array variables to layered ascii files." description = "keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files." optional = true -[blocks.period.fields.storage] +[blocks.period.fields.stress_period_data] type = "string" longname = "storage state" description = "keyword to indicate that stress period IPER is steady-state. Steady-state conditions will apply until the TRANSIENT keyword is specified in a subsequent BEGIN PERIOD block." diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev2/chf-sto.yaml b/autotest/dfns/__snapshots__/v2.0.0.dev2/chf-sto.yaml index f86775d5..f05368b8 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev2/chf-sto.yaml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev2/chf-sto.yaml @@ -20,7 +20,7 @@ blocks: optional: true period: fields: - storage: + stress_period_data: type: string longname: storage state description: keyword to indicate that stress period IPER is steady-state. Steady-state conditions diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev2/gwf-sto.json b/autotest/dfns/__snapshots__/v2.0.0.dev2/gwf-sto.json index 64c201de..3017a39e 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev2/gwf-sto.json +++ b/autotest/dfns/__snapshots__/v2.0.0.dev2/gwf-sto.json @@ -114,7 +114,7 @@ }, "period": { "fields": { - "storage": { + "stress_period_data": { "type": "string", "longname": "storage state", "description": "keyword to indicate that stress period IPER is steady-state. Steady-state conditions will apply until the TRANSIENT keyword is specified in a subsequent BEGIN PERIOD block. If the CSUB Package is included in the GWF model, only the first and last stress period can be steady-state.", diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev2/gwf-sto.toml b/autotest/dfns/__snapshots__/v2.0.0.dev2/gwf-sto.toml index ab33e16e..1a641fef 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev2/gwf-sto.toml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev2/gwf-sto.toml @@ -101,7 +101,7 @@ shape = [ "nodes", ] -[blocks.period.fields.storage] +[blocks.period.fields.stress_period_data] type = "string" longname = "storage state" description = "keyword to indicate that stress period IPER is steady-state. Steady-state conditions will apply until the TRANSIENT keyword is specified in a subsequent BEGIN PERIOD block. If the CSUB Package is included in the GWF model, only the first and last stress period can be steady-state." diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev2/gwf-sto.yaml b/autotest/dfns/__snapshots__/v2.0.0.dev2/gwf-sto.yaml index 08741b16..e6a1344b 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev2/gwf-sto.yaml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev2/gwf-sto.yaml @@ -111,7 +111,7 @@ blocks: - nodes period: fields: - storage: + stress_period_data: type: string longname: storage state description: keyword to indicate that stress period IPER is steady-state. Steady-state conditions diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev2/olf-sto.json b/autotest/dfns/__snapshots__/v2.0.0.dev2/olf-sto.json index 90dc79e1..0597f8af 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev2/olf-sto.json +++ b/autotest/dfns/__snapshots__/v2.0.0.dev2/olf-sto.json @@ -23,7 +23,7 @@ }, "period": { "fields": { - "storage": { + "stress_period_data": { "type": "string", "longname": "storage state", "description": "keyword to indicate that stress period IPER is steady-state. Steady-state conditions will apply until the TRANSIENT keyword is specified in a subsequent BEGIN PERIOD block.", diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev2/olf-sto.toml b/autotest/dfns/__snapshots__/v2.0.0.dev2/olf-sto.toml index 3546de4e..ef3dae98 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev2/olf-sto.toml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev2/olf-sto.toml @@ -16,7 +16,7 @@ longname = "export array variables to layered ascii files." description = "keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files." optional = true -[blocks.period.fields.storage] +[blocks.period.fields.stress_period_data] type = "string" longname = "storage state" description = "keyword to indicate that stress period IPER is steady-state. Steady-state conditions will apply until the TRANSIENT keyword is specified in a subsequent BEGIN PERIOD block." diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev2/olf-sto.yaml b/autotest/dfns/__snapshots__/v2.0.0.dev2/olf-sto.yaml index 857f5d63..33b4cce8 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev2/olf-sto.yaml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev2/olf-sto.yaml @@ -20,7 +20,7 @@ blocks: optional: true period: fields: - storage: + stress_period_data: type: string longname: storage state description: keyword to indicate that stress period IPER is steady-state. Steady-state conditions diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev2/swf-sto.json b/autotest/dfns/__snapshots__/v2.0.0.dev2/swf-sto.json index a72ba5a7..040d21df 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev2/swf-sto.json +++ b/autotest/dfns/__snapshots__/v2.0.0.dev2/swf-sto.json @@ -23,7 +23,7 @@ }, "period": { "fields": { - "storage": { + "stress_period_data": { "type": "string", "longname": "storage state", "description": "keyword to indicate that stress period IPER is steady-state. Steady-state conditions will apply until the TRANSIENT keyword is specified in a subsequent BEGIN PERIOD block.", diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev2/swf-sto.toml b/autotest/dfns/__snapshots__/v2.0.0.dev2/swf-sto.toml index 1bc52837..0217f00c 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev2/swf-sto.toml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev2/swf-sto.toml @@ -16,7 +16,7 @@ longname = "export array variables to layered ascii files." description = "keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files." optional = true -[blocks.period.fields.storage] +[blocks.period.fields.stress_period_data] type = "string" longname = "storage state" description = "keyword to indicate that stress period IPER is steady-state. Steady-state conditions will apply until the TRANSIENT keyword is specified in a subsequent BEGIN PERIOD block." diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev2/swf-sto.yaml b/autotest/dfns/__snapshots__/v2.0.0.dev2/swf-sto.yaml index 6f528a99..758b0f5e 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev2/swf-sto.yaml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev2/swf-sto.yaml @@ -20,7 +20,7 @@ blocks: optional: true period: fields: - storage: + stress_period_data: type: string longname: storage state description: keyword to indicate that stress period IPER is steady-state. Steady-state conditions diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/chf-sto.json b/autotest/dfns/__snapshots__/v2.0.0.dev3/chf-sto.json index d0dbc735..3be181ac 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/chf-sto.json +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/chf-sto.json @@ -23,7 +23,7 @@ }, "period": { "fields": { - "storage": { + "stress_period_data": { "type": "string", "longname": "storage state", "description": "keyword to indicate that stress period IPER is steady-state. Steady-state conditions will apply until the TRANSIENT keyword is specified in a subsequent BEGIN PERIOD block.", diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/chf-sto.toml b/autotest/dfns/__snapshots__/v2.0.0.dev3/chf-sto.toml index 54e37262..4cf4b217 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/chf-sto.toml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/chf-sto.toml @@ -16,7 +16,7 @@ longname = "export array variables to layered ascii files." description = "keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files." optional = true -[blocks.period.fields.storage] +[blocks.period.fields.stress_period_data] type = "string" longname = "storage state" description = "keyword to indicate that stress period IPER is steady-state. Steady-state conditions will apply until the TRANSIENT keyword is specified in a subsequent BEGIN PERIOD block." diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/chf-sto.yaml b/autotest/dfns/__snapshots__/v2.0.0.dev3/chf-sto.yaml index fae4fe33..af7fcae9 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/chf-sto.yaml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/chf-sto.yaml @@ -20,7 +20,7 @@ blocks: optional: true period: fields: - storage: + stress_period_data: type: string longname: storage state description: keyword to indicate that stress period IPER is steady-state. Steady-state conditions diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-sto.json b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-sto.json index 7af2d50e..c4a5de61 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-sto.json +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-sto.json @@ -119,7 +119,7 @@ }, "period": { "fields": { - "storage": { + "stress_period_data": { "type": "string", "longname": "storage state", "description": "keyword to indicate that stress period IPER is steady-state. Steady-state conditions will apply until the TRANSIENT keyword is specified in a subsequent BEGIN PERIOD block. If the CSUB Package is included in the GWF model, only the first and last stress period can be steady-state.", diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-sto.toml b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-sto.toml index 507877f0..082068f3 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-sto.toml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-sto.toml @@ -104,7 +104,7 @@ shape = [ "nodes", ] -[blocks.period.fields.storage] +[blocks.period.fields.stress_period_data] type = "string" longname = "storage state" description = "keyword to indicate that stress period IPER is steady-state. Steady-state conditions will apply until the TRANSIENT keyword is specified in a subsequent BEGIN PERIOD block. If the CSUB Package is included in the GWF model, only the first and last stress period can be steady-state." diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-sto.yaml b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-sto.yaml index caf30e88..b1199024 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-sto.yaml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/gwf-sto.yaml @@ -114,7 +114,7 @@ blocks: - nodes period: fields: - storage: + stress_period_data: type: string longname: storage state description: keyword to indicate that stress period IPER is steady-state. Steady-state conditions diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/olf-sto.json b/autotest/dfns/__snapshots__/v2.0.0.dev3/olf-sto.json index 4b2c2cd3..e887c2a7 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/olf-sto.json +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/olf-sto.json @@ -23,7 +23,7 @@ }, "period": { "fields": { - "storage": { + "stress_period_data": { "type": "string", "longname": "storage state", "description": "keyword to indicate that stress period IPER is steady-state. Steady-state conditions will apply until the TRANSIENT keyword is specified in a subsequent BEGIN PERIOD block.", diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/olf-sto.toml b/autotest/dfns/__snapshots__/v2.0.0.dev3/olf-sto.toml index 3df9a09c..e5a70c96 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/olf-sto.toml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/olf-sto.toml @@ -16,7 +16,7 @@ longname = "export array variables to layered ascii files." description = "keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files." optional = true -[blocks.period.fields.storage] +[blocks.period.fields.stress_period_data] type = "string" longname = "storage state" description = "keyword to indicate that stress period IPER is steady-state. Steady-state conditions will apply until the TRANSIENT keyword is specified in a subsequent BEGIN PERIOD block." diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/olf-sto.yaml b/autotest/dfns/__snapshots__/v2.0.0.dev3/olf-sto.yaml index 60df6b73..3150b562 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/olf-sto.yaml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/olf-sto.yaml @@ -20,7 +20,7 @@ blocks: optional: true period: fields: - storage: + stress_period_data: type: string longname: storage state description: keyword to indicate that stress period IPER is steady-state. Steady-state conditions diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/swf-sto.json b/autotest/dfns/__snapshots__/v2.0.0.dev3/swf-sto.json index b09fc322..d442fb5b 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/swf-sto.json +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/swf-sto.json @@ -23,7 +23,7 @@ }, "period": { "fields": { - "storage": { + "stress_period_data": { "type": "string", "longname": "storage state", "description": "keyword to indicate that stress period IPER is steady-state. Steady-state conditions will apply until the TRANSIENT keyword is specified in a subsequent BEGIN PERIOD block.", diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/swf-sto.toml b/autotest/dfns/__snapshots__/v2.0.0.dev3/swf-sto.toml index 398e98cf..f797efd5 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/swf-sto.toml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/swf-sto.toml @@ -16,7 +16,7 @@ longname = "export array variables to layered ascii files." description = "keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files." optional = true -[blocks.period.fields.storage] +[blocks.period.fields.stress_period_data] type = "string" longname = "storage state" description = "keyword to indicate that stress period IPER is steady-state. Steady-state conditions will apply until the TRANSIENT keyword is specified in a subsequent BEGIN PERIOD block." diff --git a/autotest/dfns/__snapshots__/v2.0.0.dev3/swf-sto.yaml b/autotest/dfns/__snapshots__/v2.0.0.dev3/swf-sto.yaml index 28888abf..39327cfc 100644 --- a/autotest/dfns/__snapshots__/v2.0.0.dev3/swf-sto.yaml +++ b/autotest/dfns/__snapshots__/v2.0.0.dev3/swf-sto.yaml @@ -20,7 +20,7 @@ blocks: optional: true period: fields: - storage: + stress_period_data: type: string longname: storage state description: keyword to indicate that stress period IPER is steady-state. Steady-state conditions diff --git a/autotest/dfns/test_schema.py b/autotest/dfns/test_schema.py index b9f259ab..0cc833c8 100644 --- a/autotest/dfns/test_schema.py +++ b/autotest/dfns/test_schema.py @@ -389,9 +389,11 @@ def test_memory_output_attributes_rcha(dev3_spec): @pytest.mark.parametrize("name", ["chf-sto", "gwf-sto", "olf-sto", "swf-sto"]) -def test_sto_storage_field_is_untagged(dev3_spec, name): +def test_sto_period_field_is_untagged(dev3_spec, name): """STO's PERIOD block writes a bare STEADY-STATE/TRANSIENT line, no STORAGE prefix.""" - storage = dev3_spec.components[name].blocks["period"].fields["storage"] + fields = dev3_spec.components[name].blocks["period"].fields + assert "storage" not in fields + storage = fields["stress_period_data"] assert storage.tagged is False assert storage.valid == ["steady-state", "transient"] diff --git a/modflow_devtools/dfns/migrate_to_v2_0_0_dev2.py b/modflow_devtools/dfns/migrate_to_v2_0_0_dev2.py index b59fdb6e..92ede1cb 100644 --- a/modflow_devtools/dfns/migrate_to_v2_0_0_dev2.py +++ b/modflow_devtools/dfns/migrate_to_v2_0_0_dev2.py @@ -1298,7 +1298,8 @@ def _collapse_sto_keywords( """ STO packages define their period block with two mutually exclusive optional Keywords (steady-state, transient). Replace them with a single optional - String field named 'storage' with constrained valid values. + String field with constrained valid values, named 'stress_period_data' like + every other package's period data. """ _STO_KEYWORDS = frozenset({"steady-state", "transient"}) result = {} @@ -1317,7 +1318,7 @@ def _collapse_sto_keywords( continue non_sto = {name: f for name, f in fields.items() if name not in _STO_KEYWORDS} storage = v2.String( - name="storage", + name="stress_period_data", longname="storage state", description=fields["steady-state"].description, optional=True, @@ -1327,7 +1328,9 @@ def _collapse_sto_keywords( tagged=False, valid=["steady-state", "transient"], ) - result[bname] = block.model_copy(update={"fields": {**non_sto, "storage": storage}}) + result[bname] = block.model_copy( + update={"fields": {**non_sto, "stress_period_data": storage}} + ) return result diff --git a/modflow_devtools/dfns/migrate_to_v2_0_0_dev3.py b/modflow_devtools/dfns/migrate_to_v2_0_0_dev3.py index d2ff247c..f2735424 100644 --- a/modflow_devtools/dfns/migrate_to_v2_0_0_dev3.py +++ b/modflow_devtools/dfns/migrate_to_v2_0_0_dev3.py @@ -1440,7 +1440,7 @@ def to_v2_0_0_dev3( # Step 5c: clear stale string source references. # Some v1 field names are renamed by dev2 transforms (e.g. _collapse_sto_keywords - # replaces "steady-state"/"transient" with "storage"). The stress template also + # replaces "steady-state"/"transient" with "stress_period_data"). The stress template also # sets nodelist.source = "cellid" for all stress packages, including gridded # variants that have no cellid field. Clear any source that no longer resolves. v2_field_names = set(component.get_fields(recurse=True).keys())