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

Metrics for temporal subgroups #266

Merged
merged 24 commits into from
Aug 22, 2023
Merged

Conversation

wpreimes
Copy link
Member

@wpreimes wpreimes commented Apr 4, 2022

Add a more flexible wrapper to calculate metrics for temporal subsets, e.g to compute metrics using data for certain days of a year. We used this one e.g. in SMART-DRI to calculate correlation values for groups of 10-days (over 13 years) to estimate varying levels of subsurface scattering throughout the year (wet/dry season).

Before, this was only possible on a monthly basis: https://github.com/TUW-GEO/pytesmo/blob/master/src/pytesmo/validation_framework/metric_calculators_adapters.py#L43

Now there is a data distributor to extract certain dates, date_ranges for any year to apply the metrics calculator to.
However, this might be over-complicated, but I haven't found a way to only use e.g. pandas for this yet, but I'm pretty sure it is possible using groupby or so.

@pstradio @s-scherrer if you have any comments let me know. If we find no better solution I will probably add this class to cadati @sebhahn

@wpreimes wpreimes marked this pull request as draft April 4, 2022 08:05
@sebhahn
Copy link
Member

sebhahn commented Apr 4, 2022

@wpreimes yes, I'd support to move this class to cadati

Is there not way to inherit from a standard python datetime object or similar?

@wpreimes
Copy link
Member Author

wpreimes commented Apr 4, 2022

@s-scherrer thanks for the feedback. I will update this PR. I will also add an small example notebook, which might clear up a few things.

@wpreimes wpreimes marked this pull request as ready for review August 21, 2023 14:39
@wpreimes
Copy link
Member Author

I have implemented the above suggested changes. There is now an example in the the notebook at pytesmo/docs/examples/validation_framework.ipynb. The GenericDatetime has been renamed to YearlessDatetime which better reflects the purpose. However, I will keep this in pytesmo for now (pytesmo/time_series/grouping.py) as this is very specific and I currently don't see any usage outside of pytesmo.

@wpreimes wpreimes merged commit 3617649 into TUW-GEO:master Aug 22, 2023
8 checks passed
@wpreimes wpreimes deleted the set-metrics branch August 22, 2023 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants