-
Notifications
You must be signed in to change notification settings - Fork 6
Labels
bugSomething isn't workingSomething isn't working
Description
I"m trying to load a Pastastore from zip with models that have two stressmodels: a RechargeModel and a StepModel. The loading fails because the StepModel has no attribute stress?
File ~/.venv/lib/python3.12/site-packages/pastastore/store.py:1648, in PastaStore.from_zip(cls, fname, conn, storename, progressbar, series_ext_json)
1646 elif libname in ["models"]:
1647 ml = json.load(archive.open(f), object_hook=pastas_hook)
-> [1648](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/~/.venv/lib/python3.12/site-packages/pastastore/store.py:1648) conn.add_model(ml)
1649 if storename is None:
1650 storename = conn.name
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[4], [line 2](vscode-notebook-cell:?execution_count=4&line=2)
1 #%%
----> [2](vscode-notebook-cell:?execution_count=4&line=2) pstore = pst.PastaStore.from_zip("pstore/models.zip")
File ~/.venv/lib/python3.12/site-packages/pastastore/store.py:1648, in PastaStore.from_zip(cls, fname, conn, storename, progressbar, series_ext_json)
1646 elif libname in ["models"]:
1647 ml = json.load(archive.open(f), object_hook=pastas_hook)
-> [1648](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/~/.venv/lib/python3.12/site-packages/pastastore/store.py:1648) conn.add_model(ml)
1649 if storename is None:
1650 storename = conn.name
File ~/.venv/lib/python3.12/site-packages/pastastore/base.py:921, in BaseConnector.add_model(self, ml, overwrite, validate_metadata)
919 self.validator.check_stressmodels_supported(ml)
920 # check oseries and stresses names and if they exist in store
--> [921](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/~/venv/lib/python3.12/site-packages/pastastore/base.py:921) self.validator.check_model_series_names_duplicates(ml)
922 self.validator.check_oseries_in_store(ml)
923 self.validator.check_stresses_in_store(ml)
File ~/.venv/lib/python3.12/site-packages/pastastore/validator.py:338, in Validator.check_model_series_names_duplicates(ml)
335 classkey = "class"
336 print(ml["stressmodels"].values())
337 series_names = [
--> [338](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/~/.venv/lib/python3.12/site-packages/pastastore/validator.py:338) sm["stress"]["name"]
339 for sm in ml["stressmodels"].values()
340 if sm[classkey] not in (prec_evap_model + ["WellModel"])
341 ]
343 # WellModel
344 if isin(
345 ["WellModel"],
346 [i[classkey] for i in ml["stressmodels"].values()],
347 ).any():
KeyError: 'stress'Pastastore version : 1.12.1
PyYAML version : 6.0.3
Pastas version: 1.13.2
Python version: 3.12.3
NumPy version: 2.3.5
Pandas version: 2.3.3
SciPy version: 1.17.0
Matplotlib version: 3.10.8
Numba version: 0.63.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working