From 5534a975fde0a52fe0ce2b11b7b43b495fdb4556 Mon Sep 17 00:00:00 2001 From: jlarsen Date: Tue, 29 Apr 2025 17:05:53 -0700 Subject: [PATCH 1/3] fix(model_names, X): updates to ApiSimulation and ApiModel * filter interface models from model_names * slice x array by nodetouser.size to avoid IndexErrors from MAW heads --- modflowapi/extensions/apimodel.py | 2 +- modflowapi/extensions/apisimulation.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modflowapi/extensions/apimodel.py b/modflowapi/extensions/apimodel.py index c6c9860..bcd13bf 100644 --- a/modflowapi/extensions/apimodel.py +++ b/modflowapi/extensions/apimodel.py @@ -315,7 +315,7 @@ def X(self): """ x = self.mf6.get_value(self.mf6.get_var_address("X", self.name)) array = np.full(self.size, np.nan) - array[self.nodetouser] = x + array[self.nodetouser] = x[:self.nodetouser.size] return array.reshape(self.shape) def _set_node_mapping(self): diff --git a/modflowapi/extensions/apisimulation.py b/modflowapi/extensions/apisimulation.py index 75b592b..e41e052 100644 --- a/modflowapi/extensions/apisimulation.py +++ b/modflowapi/extensions/apisimulation.py @@ -283,6 +283,10 @@ def load(mf6): id_var_addr = mf6.get_var_address("ID", name) if name.startswith("SLN"): continue + elif name.startswith("GWTIM") or name.startswith("GWFIM") or name.startswith("GWEIM"): + continue + elif name.startswith("GWFCON") or name.startswith("GWTCON") or name.startswith("GWECON"): + continue if id_var_addr not in variables: continue From 72786570a352012f17dcdd96d2f15794c536f891 Mon Sep 17 00:00:00 2001 From: jlarsen Date: Tue, 29 Apr 2025 17:08:04 -0700 Subject: [PATCH 2/3] linting --- modflowapi/extensions/apimodel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modflowapi/extensions/apimodel.py b/modflowapi/extensions/apimodel.py index bcd13bf..7936d84 100644 --- a/modflowapi/extensions/apimodel.py +++ b/modflowapi/extensions/apimodel.py @@ -315,7 +315,7 @@ def X(self): """ x = self.mf6.get_value(self.mf6.get_var_address("X", self.name)) array = np.full(self.size, np.nan) - array[self.nodetouser] = x[:self.nodetouser.size] + array[self.nodetouser] = x[: self.nodetouser.size] return array.reshape(self.shape) def _set_node_mapping(self): From 2cc5087e361984b6f61486c8e342e25acbd8376e Mon Sep 17 00:00:00 2001 From: jlarsen Date: Wed, 30 Apr 2025 07:30:58 -0700 Subject: [PATCH 3/3] * filter interface model names out of SLN names --- modflowapi/extensions/apisimulation.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modflowapi/extensions/apisimulation.py b/modflowapi/extensions/apisimulation.py index e41e052..268af23 100644 --- a/modflowapi/extensions/apisimulation.py +++ b/modflowapi/extensions/apisimulation.py @@ -305,6 +305,8 @@ def load(mf6): id_var_addr = mf6.get_var_address("ID", name) if name.lower() in models or name == "TDIS": continue + if name.startswith("GWTIM") or name.startswith("GWFIM") or name.startswith("GWEIM"): + continue if id_var_addr not in variables: continue