Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def timeseries_to_xarray(time_series):
- attrs = ts.fields.copy()
- data = attrs.pop('data').value
- timestamps = attrs.pop('timestamps').value
- for k,v in attrs.iteritems():
- # replace any links with their name
- try:
- attrs[k] = v.name
- except AttributeError:
- pass
- xarr = xr.DataArray(
- data = data,
- name=time_series.name,
- dims = ('unknown','time'),
- coords = {'time':timestamps},
- attrs = attrs,
- )
- return xarr
Add Comment
Please, Sign In to add comment