kasra-hosseini / obspyDMT

A Python toolbox for the query, retrieval, processing and management of seismological data sets, including very large, heterogeneous and/or dynamically growing ones.
http://kasra-hosseini.github.io/obspyDMT/
Other
89 stars 58 forks source link

fix lanczos sampling_rate #43

Closed ghraecakter closed 6 years ago

ghraecakter commented 6 years ago

I'm not sure if the lanczos resampling method is doing right. For example, I'd like to resample a trace from 100 Hz to 30 Hz. Since decimate couldn't do this, I turned to lanczos. The behavior didn't seem to be right though.

>>> from obspy.core import read
>>> from obspyDMT.utils.resample_handler import resample_unit
>>> tr = read()[0]
>>> resample_unit(tr.copy(), 30, 'decimate').stats.sampling_rate
33.333333333333336
# Old
>>> resample_unit(tr.copy(), 30, 'lanczos').stats.sampling_rate
9.0
# New
>>> resample_unit(tr.copy(), 30, 'lanczos').stats.sampling_rate
30.0