pastas / pastastore

:spaghetti: :convenience_store: Tools for managing timeseries and Pastas models

Home Page:https://pastastore.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when running `solve_models()` on a pastastore

OnnoEbbens opened this issue · comments

When I run pstore.solve_models() I get this error:

Solving models: 0it [00:00, ?it/s]INFO:pastas.timeseries:Nan-values were removed at the end of the time series B58A0092-004.
INFO:pastas.timeseries:Cannot determine frequency of series B58A0092-004: freq=None. The time series is irregular.
INFO:pastas.timeseries:Time Series B58A0092-004: 13 nan-value(s) was/were found and filled with: drop.
INFO:pastas.timeseries:User provided frequency for time series RH_ELL: freq=D
INFO:pastas.timeseries:User provided frequency for time series EV24_ELL: freq=D
Solving models: 0it [00:00, ?it/s]
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-15-3c39fc9ad072> in <module>
----> 1 pstore.solve_models()

~\anaconda3\envs\dev\lib\site-packages\pastastore\store.py in solve_models(self, mls, report, ignore_solve_errors, store_result, progressbar, **kwargs)
    619         desc = "Solving models"
    620         for ml_name in (tqdm(mls, desc=desc) if progressbar else mls):
--> 621             ml = self.conn.get_models(ml_name)
    622 
    623             m_kwargs = {}

~\anaconda3\envs\dev\lib\site-packages\pastastore\base.py in get_models(self, names, return_dict, progressbar, squeeze, update_ts_settings)
    737         """
    738         models = []
--> 739         names = self._parse_names(names, libname="models")
    740         desc = "Get models"
    741         for n in (tqdm(names, desc=desc) if progressbar else names):

~\anaconda3\envs\dev\lib\site-packages\pastastore\base.py in _parse_names(self, names, libname)
    935                 raise ValueError(f"No library '{libname}'!")
    936         else:
--> 937             raise NotImplementedError(f"Cannot parse 'names': {names}")
    938 
    939     @ staticmethod

NotImplementedError: Cannot parse 'names': Model(oseries=B58A0092-004, name=B58A0092-004, constant=True, noisemodel=True)

I think the error occurs since version 0.7.0 because pstore.conn.models returns a pastastore.base.ModelAccessor now instead of a list.

I'm not getting this error... The code above the for loop refers to model_names:

        if mls is None:
            mls = self.conn.model_names
        elif isinstance(mls, ps.Model):
            mls = [mls.name]

Are you sure you're not on an older version?

I get the error when I run notebook 3 from the hydropandas examples using pastastore version 0.7.0.

https://github.com/ArtesiaWater/hydropandas/blob/master/examples/03_pastastore_from_observations.ipynb

Ah my bad, this was fixed in dev, but not yet in the latest release (0.7.0). I should probably make a new release.

I think you can revert your change and use the dev version.

Ah yes sorry should have checked that first.

I reverted the changes