Closed d-chambers closed 2 weeks ago
Hey @d-chambers, I just ran this, and it works with applying units:
import dascore as dc
from dascore.units import s
time = dc.to_timedelta64(2)
pa_tapered_1 = pa.taper(time=time*s)
pa_tapered_2 = pa.taper(time=2*s)
assert p_tapered_1 == p_tapered_2
assert np.array_equal(pa_tapered_1.data, pa_tapered_2.data), "The arrays are not equal."
It's expected to use units with taper
since kwarg is the percentage of the total length of the dimension or absolute units.
I also tried rolling (without specifying units) and got the same result:
import dascore as dc
time = dc.to_timedelta64(2)
mean_pa_1 = pa.rolling(time=time, step=0.5).mean()
mean_pa_2 = pa.rolling(time=2, step=0.5).mean()
assert np.array_equal(mean_pa_1.dropna("time").data, mean_pa_2.dropna("time").data), "The arrays are not equal."
Hey @d-chambers, I just ran this, and it works with applying units:
Interesting. Yes, I think the current issue is when a single timedelta64 is passed without applying units to it. Timedelta64 is a bit of a weird case in that it already has units implied.
closed by #422
Description
Both numpy and python time deltas should be recognized as time units.
For example, this currently fails:
It should recognize
time
as a time.Versions