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

Custom statistics #1138

Closed
wants to merge 5 commits into from
Closed

Custom statistics #1138

wants to merge 5 commits into from

Conversation

thorbjoernl
Copy link
Collaborator

@thorbjoernl thorbjoernl commented Apr 26, 2024

Change Summary

Another step towards allowing users to specify their own custom statistics implementations. pyaerocom.stats.stats now provides a register_custom_statistic() method which allows adding a custom implementation for a statistic. It is not yet being read from the config dict directly but the functionality can be invoked by adding the following to cfg_benchmark.py:

    from pyaerocom.stats.stats import register_custom_statistic

    register_custom_statistic("customstat1", fun= lambda x, y, w: 5)
    register_custom_statistic("customstat2", fun= lambda x, y, w: 3)

Related issue number

fixes #1114

Checklist

  • Start with a draft-PR
  • The PR title is a good summary of the changes
  • PR is set to AeroTools and a tentative milestone
  • Documentation reflects the changes where applicable
  • Tests for the changes exist where applicable
  • Tests pass locally
  • Tests pass on CI
  • At least 1 reviewer is selected
  • Make PR ready to review

@thorbjoernl thorbjoernl added this to the m2024-05 milestone Apr 26, 2024
Copy link

codecov bot commented Apr 26, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 78.68%. Comparing base (e5f9ac6) to head (b19e0d9).
Report is 3 commits behind head on main-dev.

Files Patch % Lines
pyaerocom/stats/stats.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           main-dev    #1138   +/-   ##
=========================================
  Coverage     78.68%   78.68%           
=========================================
  Files           126      127    +1     
  Lines         20084    20093    +9     
=========================================
+ Hits          15803    15811    +8     
- Misses         4281     4282    +1     
Flag Coverage Δ
unittests 78.68% <85.71%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@thorbjoernl thorbjoernl modified the milestones: m2024-05, m2024-06 May 2, 2024
@lewisblake lewisblake modified the milestones: m2024-06, m2024-07 May 27, 2024
@lewisblake lewisblake modified the milestones: m2024-07, m2024-08 Jun 17, 2024
@thorbjoernl
Copy link
Collaborator Author

Closing since we agreed that this wasn't a priority for the moment.

@thorbjoernl thorbjoernl closed this Jul 3, 2024
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.

Allow configuration and implementation of custom statistics in calc_statistics()
2 participants