Re-write `temporal_sampling` to directly return the period
Opened this issue · 0 comments
In the source code at the moment we have temporal_sampling
and tsamp2period
. The first returns a symbol, the other an actual period type like Month(1)
. However, in the code the period type is what we actually use, when we use it. The symbol is used only to make decisions on if
clauses. But because there is a unique and invertible mapping between the sampling symbol and the period type, we could just be using the period type instead.
This means that we only need one function temporal_sampling
that directly returns the period of sampling, with numbers, e.g., Month(3)
is the "seasonal" period.
This generalization means that we probably don't have to write so many different clauses of code for different types of averaging. I guess then weekly averaging would come naturally from a period if Day(7)
, and seasonal comes from Month(3)
.
I guess we could leave the inverse transform from period type to symbol/string for convenience.