Closed OnnoEbbens closed 4 years ago
The pastastore was designed to build models from timeseries stored in the oseries/stresses. When adding a model it is assumed the timeseries are also present in the store. So if you build a model from timeseries not contained in the pastastore, it will happily add the model, but will not be able to re-create it when loading it.
Generally, it is easier to add your oseries/stresses to the Pastastore and build your models from there. Your approach should work however, but the name of the series is different in the model than in the pastastore. I think if you set the name to 'stand_m_tov_nap' it should work:
pstore.add_oseries(df['stand_m_tov_nap'], name='stand_m_tov_nap')
A better idea is probably to rename your series before building the model to give it a more unique name:
oseries = df['stand_m_tov_nap']
oseries.name = "piezometer_xx"
# build model, etc...
Based on your issue, I think we can improve the behavior of the pastastore. I can make it so that when you add a model for which the timeseries are not present in the pastastore, it automatically adds those timeseries for you.
58b9359 adds functionality when adding a model that checks whether the oseries and stresses are contained in the PastaStore. If they cannot be found, the timeseries are added to the PastaStore. A test was added to ensure this works.
@OnnoEbbens, let me know if the issue can be closed!
Closed by #12
I create a pastas model and add a Stressmodel to it. Then I add this model to a Pastastore using the following code:
Then when I try to retrieve with
pstore.get_models('tm')
the model I get this error:Now I understand that I have to add the oseries and stresses to the pastastore seperately. So I use:
But still I get the same error when using
pstore.get_models('tm')
. This is because the oseries is added to the pastastore under the name 'to' while the model dictionary saves the stress series under the name 'stand_m_tov_nap'. This is the name of the pandas Series that was used to create the oseries.I think this has to do with the way a model is added to the pastastore but I don't know how to solve it.