Closed btrotta-bom closed 1 month ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 98.41%. Comparing base (
96cdbef
) to head (22dad9f
). Report is 10 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
In order to maintain a backlog of relevant PRs, we automatically label them as stale after 60 days of inactivity.
If this PR is still important to you, then please comment on this PR and the stale label will be removed.
Otherwise this PR will be automatically closed in 30 days time.
this should remain open
searchsort
is mapping each forecast probability to one of the probability bins and returns an index to the associated bin,put_along_axis
is using the bin index for each forecast probability to populateforecast_probabilities
with the associated probability value (setting values outside the bin to 0) andforecast_counts
with 1 (and again setting values outside the bin to 0).
Yes, correct
Speed up
ConstructReliabilityCalibrationTables
. When tested on a gridded forecast with 7 reliability bins, the speedup is around 35%. The improved performance is achieved by replacing a loop iterating over the reliability bins withnp.searchsorted
. The numpy method uses binary search, so has time complexitylog(n)
, wheren
is the number of reliability bins, whereas the old method is linear inn
. So in general we should expect a speedup of around1-log(n)/n
. Also the numpy method is vectorised, whereas the old code uses a python loop, which should give a further improvement.I have added a test for when the forecast contains nans, since the handling of this is a little trickier than in the old code.
Testing: