tobac-project / tobac

Tracking and object-based analysis of clouds
BSD 3-Clause "New" or "Revised" License
102 stars 54 forks source link

Refactor of PBC distance functions #386

Closed w-k-jones closed 5 months ago

w-k-jones commented 11 months ago

Following on from #384 , I've carried out a more substantial refactoring of the PBC distance calculation functions. This includes improved validation of PBC keyword parameters, and optimisation of the calc_distance_coords_pbc to reduce the amount of work performed each time it is called. build_distance_function should now be the uniform way to create a PBC dist func across all routines

Change in performance of tracking with PBCs (for a 24x1200x3600 dataset):

No PBCs: 4.41 s ± 445 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
Pre-refactor: 52 s ± 4.26 s per loop (mean ± std. dev. of 7 runs, 1 loop each)
Post-refactor: 23.7 s ± 570 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
github-actions[bot] commented 11 months ago

Linting results by Pylint:

Your code has been rated at 8.72/10 (previous run: 8.72/10, +0.00) The linting score is an indicator that reflects how well your code version follows Pylint’s coding standards and quality metrics with respect to the RC_v1.5.x branch. A decrease usually indicates your new code does not fully meet style guidelines or has potential errors.

codecov[bot] commented 11 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 57.21%. Comparing base (08f84b2) to head (319d7a3). Report is 214 commits behind head on RC_v1.5.x.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## RC_v1.5.x #386 +/- ## ============================================= + Coverage 56.91% 57.21% +0.29% ============================================= Files 20 20 Lines 3440 3459 +19 ============================================= + Hits 1958 1979 +21 + Misses 1482 1480 -2 ``` | [Flag](https://app.codecov.io/gh/tobac-project/tobac/pull/386/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tobac-project) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/tobac-project/tobac/pull/386/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tobac-project) | `57.21% <100.00%> (+0.29%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tobac-project#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.