Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-write temporal_sampling to directly return the period #96

Open
Datseris opened this issue Jun 17, 2022 · 0 comments
Open

Re-write temporal_sampling to directly return the period #96

Datseris opened this issue Jun 17, 2022 · 0 comments
Labels
breaking This will introduce a breaking change clarity Will increase clarity of source code enhancement New feature or request temporal Related with the Time dimension

Comments

@Datseris
Copy link
Member

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.

@Datseris Datseris added enhancement New feature or request breaking This will introduce a breaking change temporal Related with the Time dimension clarity Will increase clarity of source code labels Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking This will introduce a breaking change clarity Will increase clarity of source code enhancement New feature or request temporal Related with the Time dimension
Projects
None yet
Development

No branches or pull requests

1 participant