From 895cf4ec13e9ece0e9bceca7878c060382ac5dee Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Thu, 30 Oct 2025 19:23:01 -0400 Subject: [PATCH 1/2] update demo scope in roadmap --- docs/dev/map.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/dev/map.md b/docs/dev/map.md index 59e65cc3..c59716f3 100644 --- a/docs/dev/map.md +++ b/docs/dev/map.md @@ -4,12 +4,11 @@ Showcase a limited set of core functionality, such as: -- the v2 DFN specification schema and format - object model, data model, user-facing APIs - IO framework and ASCII file loading/writing - constructing, running, modifying simulations -Design and implementation are provisional. Implementation may take shortcuts, e.g. components hand-written instead of generated from the DFN specification. +Design and implementation are provisional. Implementation may take shortcuts, e.g. components hand-written instead of generated from the DFN specification. Demonstration is a guided tour with guardrails. Release to demo participants via `pip install` from github URL. From 59d7f67c2ee36578ccee62ddcd4bffe5cab6191d Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Mon, 3 Nov 2025 07:19:10 -0500 Subject: [PATCH 2/2] hacky fix for tdis and 'perioddata' blocks in general --- flopy4/mf6/converter/unstructure.py | 15 +++++++++------ test/test_mf6_codec.py | 6 ++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/flopy4/mf6/converter/unstructure.py b/flopy4/mf6/converter/unstructure.py index 9b6e1a4c..4047a483 100644 --- a/flopy4/mf6/converter/unstructure.py +++ b/flopy4/mf6/converter/unstructure.py @@ -156,8 +156,7 @@ def unstructure_component(value: Component) -> dict[str, Any]: field_value, structured_grid_dims=value.parent.data.dims, # type: ignore ) - if "period" in block_name: - period_block_name = block_name + if block_name == "period": period_data[field_name] = { kper: field_value.isel(nper=kper) for kper in range(field_value.sizes["nper"]) @@ -177,11 +176,15 @@ def unstructure_component(value: Component) -> dict[str, Any]: # setup indexed period blocks, combine arrays into datasets for kper, block in period_blocks.items(): - assert isinstance(period_block_name, str) - blocks[f"{period_block_name} {kper + 1}"] = { - period_block_name: xr.Dataset(block, coords=block[arr_name].coords) + blocks[f"period {kper + 1}"] = { + "period": xr.Dataset(block, coords=block[arr_name].coords) } + # combine "perioddata" block arrays (tdis, ats) into datasets + # so they render as lists. temp hack TODO do this generically + if perioddata := blocks.get("perioddata", None): + blocks["perioddata"] = {"perioddata": xr.Dataset(perioddata)} + # total temporary hack! manually set solutiongroup 1. # TODO still need to support multiple.. if "solutiongroup" in blocks: @@ -189,4 +192,4 @@ def unstructure_component(value: Component) -> dict[str, Any]: blocks["solutiongroup 1"] = sg del blocks["solutiongroup"] - return {name: block for name, block in blocks.items() if name != period_block_name} + return {name: block for name, block in blocks.items() if name != "period"} diff --git a/test/test_mf6_codec.py b/test/test_mf6_codec.py index 4c763bc2..55a367d7 100644 --- a/test/test_mf6_codec.py +++ b/test/test_mf6_codec.py @@ -130,12 +130,10 @@ def test_dumps_tdis(): print("TDIS dump:") print(dumped) assert dumped - assert "BEGIN PERIODDATA 1" in dumped + assert "BEGIN PERIODDATA" in dumped assert " 1.0 1 1.0" in dumped - assert "END PERIODDATA 1" in dumped - assert "BEGIN PERIODDATA 2" in dumped assert " 2.0 2 1.0" in dumped - assert "END PERIODDATA 2" in dumped + assert "END PERIODDATA" in dumped loaded = loads(dumped) print("TDIS load:")