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
On a CannotCalculate exception, xtype processing should stop and an appropriate value returned #929
Conversation
Something needs to be done for the get_aggregate function at line 128. I think we want something like this added to the try/except
|
Got to be careful about separating implementation from policy. The implementation detects that a type cannot be calculated, but it's policy what to do about it, such as setting the value to As an example That's the theory, although I don't think xtypes is entirely consistent about this. |
That probably explains why I am unsure… So let’s step back. Maybe we should just deal with has_data in this pull request and move this discussion to WeeWX development group? Your call. |
Gives me a headache too, and I invented it! I think the idea is sound, but details of the details in the implementation can be challenging. Sounds like Seasons is trying to calculate something like
But, I'm not sure that it's better than your solution. |
My ‘argument’ for where I proposed is consistency. If we put the handling in tags.py we should probably move the has_data like I did in commit. |
I'm trying to come up with a regression test for your PR, but I'm having trouble. I cannot get the line vt = xtype.get_aggregate(obs_type, timespan, 'not_null', db_manager) to raise What are you seeing to trigger your addition? |
Never mind. I figured out a test case. |
Here is what I think happened… |
Take a look at the bellrichm-CannotCalculateFinal branch and see if that works for your extension. |
For
I would say I am all for merging this PR and if required, having a separate for |
FWIW, a call to |
I tend to agree. If one is calculating an aggregate of a synthetic type over an interval, and one or more of its ingredients are missing in that interval, then those values should be ignored. The rest will still be valid. Currently, we set the results of the aggregation to |
I think we are getting close... |
That's exactly where I was headed. Merged into Thanks, Rich. I appreciate the effort it took to dive into the details of the XTypes system! |
Yup, I think we are done. Thanks for bearing with me. |
No description provided.