pastas / pastastore

:spaghetti: :convenience_store: Tools for managing timeseries and Pastas models
https://pastastore.readthedocs.io
MIT License
15 stars 4 forks source link

add pastas.timeseries.TimeSeries object to a PastaStore using PastaStore.add_oseries() #34

Closed OnnoEbbens closed 3 years ago

OnnoEbbens commented 3 years ago

I think it would be nice to modify PastaStore.add_oseries() in such a way that the series argument can be a pastas.timeseries.TimeSeries object. Now only pandas DataFrame and Series are supported. It can save you some code, for example when adding a Dino csv file to the store.

Now:

series = ps.read_dino(fname)
store.add_oseries(series.series_original, name=series.name, metadata=series.metadata)

Proposed change:

series = ps.read_dino(fname)
store.add_oseries(series)

What are your thoughts on this?

dbrakenhoff commented 3 years ago

Good idea!

Only problem I can see is that it might become confusing when the user is not getting back a pastas.TimeSeries object when retrieving data. But making it easy to add pastas.TimeSeries is probably worth that potential (minor) confusion.

dbrakenhoff commented 3 years ago

The name still has to be passed individually, but timeseries and metadata can be taken from the pastas.TimeSeries object.

series = ps.read_dino(fname)
store.add_oseries(series, series.name)

Closed by #40