Skip to content

Commit

Permalink
Added mode to get_timeseries
Browse files Browse the repository at this point in the history
  • Loading branch information
IKCAP committed Jul 26, 2024
1 parent 5ade17a commit f54484c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pylipd/lipd.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def make_bib(row):

return bibs, df

def get_timeseries(self, dsnames, to_dataframe=False):
def get_timeseries(self, dsnames, to_dataframe=False, mode="paleo", time="age"):
'''Get Legacy LiPD like Time Series Object (tso)
Parameters
Expand Down Expand Up @@ -434,7 +434,7 @@ def get_timeseries(self, dsnames, to_dataframe=False):
if type(dsnames)==str:
dsnames=[dsnames]

ts = self._get_timeseries(dsnames)
ts = self._get_timeseries(dsnames, mode=mode, time=time)
if to_dataframe == False:
return ts
elif to_dataframe == True:
Expand All @@ -448,14 +448,14 @@ def get_timeseries(self, dsnames, to_dataframe=False):

return ts, df

def _get_timeseries(self, dsnames):
def _get_timeseries(self, dsnames, mode="paleo", time="age"):
timeseries = {}
for dsname in dsnames:
converter = RDFToLiPD(self.graph)
d = converter.convert_to_json(dsname)
print("Extracting timeseries from dataset: " + dsname + " ...")
if len(d.items()):
tss = LiPD_Legacy().extract(d)
tss = LiPD_Legacy().extract(d, mode=mode, time=time)
timeseries[dsname] = tss
return timeseries

Expand Down

0 comments on commit f54484c

Please sign in to comment.