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

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

OnnoEbbens opened this issue · comments

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?

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.

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