-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Currently obtaining data for an Obspack time series will return a pandas dataframe with a time column.
Example code:
from icoscp.cpb.dobj import Dobj
dobj = Dobj('https://meta.icos-cp.eu/objects/VvC1QkMAWW5Z9iUSFaPijY5W')
dobj.data
There are other time-related columns that should be in the dataframe but are not.
Here's the code that does the conversions:
Lines 478 to 500 in 1e44ff6
| """ | |
| The ICOS Carbon Portal provides a TIMESTAMP which is | |
| a unix timestamp in milliseconds [UTC] | |
| Convert the "number" to a pandas date/time object | |
| """ | |
| if 'TIMESTAMP' in df.columns and self._dtconvert: | |
| df['TIMESTAMP'] = pd.to_datetime(df.loc[:,'TIMESTAMP'],unit='ms') | |
| if 'TIMESTAMP_END' in df.columns and self._dtconvert: | |
| df['TIMESTAMP_END'] = pd.to_datetime(df.loc[:,'TIMESTAMP_END'],unit='ms') | |
| # there are files with date and time where | |
| # date is a unixtimestamp | |
| # time seconds per day | |
| if 'date' in df.columns and self._dtconvert: | |
| df['date'] = pd.to_datetime(df.loc[:,'date'],unit='D') | |
| if 'time' in df.columns and self._dtconvert: | |
| # convert unix timestamp | |
| df['time'] = pd.to_datetime(df.loc[:,'time'],unit='s') | |
| # remove the data, so that only time remains | |
| df['time'] = pd.to_datetime(df.loc[:,'time'],format='%H:%M').dt.time |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working