kujaku11 / mth5

Exchangeable and archivable format for magnetotelluric time series to better serve the community through FAIR principles.
https://mth5.readthedocs.io/en/latest/index.html
MIT License
16 stars 4 forks source link

resampling not robust #217

Closed kkappler closed 2 months ago

kkappler commented 3 months ago

Using MTH5 on a dataset sampled at 31250 Hz and calling run_ts.resample_poly(7812) failed. The initial xarray had 165714 samples.

image

This seems to be because the time axis is being sliced by taking every fourth sample, but the data are being passed through resample_poly which can have a different number of samples than a slice.

The actual error occurs in mth5/timeseries/scipy_filters.py

One solution is to do this: ret[dim] = new_dim[:len(ret.time)] instead of ret[dim] = new_dim

but a warning should also be logged if the two axes are of unequal length

image