spedas / pyspedas

Python-based Space Physics Environment Data Analysis Software
https://pyspedas.readthedocs.io/
MIT License
143 stars 58 forks source link

Function resample has problems #807

Closed nickssl closed 3 months ago

nickssl commented 3 months ago

The routine resample in pytplot does not work.

The following example in resample gives errors:

pytplot.store_data('d', data={'x':[2,5,8,11,14,17,21], 'y':[[1,1],[2,2],[100,100],[4,4],[5,5],[6,6],[7,7]]})
pytplot.resample('d',[3,4,5,6,7,18],'d_resampled')

TypeError: When interpolating over a datetime-like coordinate, the coordinates to interpolate to must be either datetime strings or datetimes. Instead got
<xarray.IndexVariable 'time' (time: 6)> Size: 24B

Also, this function uses data_quants directly, which should be avoided when possible.

jameswilburlewis commented 3 months ago

We can probably replace it for now with a wrapper around one of the other interpolation routines we already have. See https://github.com/spedas/pyspedas/issues/816 and https://github.com/spedas/pyspedas/issues/372. We'll track this as part of the broader duplicated functionality issues.