Splitting a model whose model level OBS package has an observation with a second cellid,
such as flow-ja-face, fails in Mf6Splitter._remap_obs(). The branch that remaps the
second cellid is only reached when pkg_type is None, which is the model level OBS
package (model_splitter.py:3377), and it has never worked.
File "flopy/mf6/utils/model_splitter.py", line 3963, in split_model
paks = self._remap_package(package)
File "flopy/mf6/utils/model_splitter.py", line 3377, in _remap_package
mapped_data = self._remap_obs(package, mapped_data, self._node_map)
File "flopy/mf6/utils/model_splitter.py", line 2912, in _remap_obs
list(cellid2[conv_idx])
TypeError: only integer scalar arrays can be converted to a scalar index
Four problems in that branch:
model_splitter.py:2912 — cellid2 is rebound to a python list at 2897 and 2906, then
indexed with an integer array. Same for layers2 at 2947.
model_splitter.py:2943 — tmp_node[cidx].to_list(), an array has tolist().
model_splitter.py:2941 — model.modelgrid.get_lrc() is called on the split model grid.
A VertexGrid has no get_lrc(), so this cannot work for a DISV model. It also builds a
cellid for the split model from the split model grid, where the surrounding code uses
_new_node_to_cellid().
- The layer is taken from the original cellid but the node is converted with a layer of 0,
so the two would have to be recombined the way _new_node_to_cellid() does.
Reproducer, on a model with a model level OBS package:
flopy.mf6.ModflowUtlobs(
gwf,
continuous={"obs.csv": [("faceflow", "flow-ja-face", (0, 4, 4), (0, 4, 5)),
("h1", "head", (0, 4, 4))]},
)
Mf6Splitter(sim).split_model(array)
Note for whoever picks this up: #2820 adds an option to split a structured model into DISV
models, so a fix should build the second cellid through _new_node_to_cellid() rather than
get_lrc(), which handles both grid types.
Splitting a model whose model level OBS package has an observation with a second cellid,
such as
flow-ja-face, fails inMf6Splitter._remap_obs(). The branch that remaps thesecond cellid is only reached when
pkg_typeisNone, which is the model level OBSpackage (
model_splitter.py:3377), and it has never worked.Four problems in that branch:
model_splitter.py:2912—cellid2is rebound to a python list at 2897 and 2906, thenindexed with an integer array. Same for
layers2at 2947.model_splitter.py:2943—tmp_node[cidx].to_list(), an array hastolist().model_splitter.py:2941—model.modelgrid.get_lrc()is called on the split model grid.A
VertexGridhas noget_lrc(), so this cannot work for a DISV model. It also builds acellid for the split model from the split model grid, where the surrounding code uses
_new_node_to_cellid().so the two would have to be recombined the way
_new_node_to_cellid()does.Reproducer, on a model with a model level OBS package:
Note for whoever picks this up: #2820 adds an option to split a structured model into DISV
models, so a fix should build the second cellid through
_new_node_to_cellid()rather thanget_lrc(), which handles both grid types.