pytesmo
pytesmo copied to clipboard
Metrics for temporal subgroups
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 yes, I'd support to move this class to cadati
Is there not way to inherit from a standard python datetime object or similar?
@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.
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.