Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/dev/map.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
15 changes: 9 additions & 6 deletions flopy4/mf6/converter/unstructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand All @@ -177,16 +176,20 @@ 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:
sg = blocks["solutiongroup"]
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"}
6 changes: 2 additions & 4 deletions test/test_mf6_codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:")
Expand Down
Loading