Ouranosinc / lmoments3

Estimate linear moments for statistical distribution functions
https://lmoments3.readthedocs.io/en/stable/
GNU General Public License v3.0
7 stars 0 forks source link

Allow execution of code section for convergence - support Python 3.12 #17

Closed aulemahal closed 4 months ago

aulemahal commented 4 months ago

Fixes #16.

From my reading of the R implementation, the commented out section is not supposed to be attainable on the first pass. The R code initializes the variables (DEL1, DEL2, XG, XH) to zero, but with a comment saying "to assuage compilers that warn that variables 'might be used uninitialized'". I thus assume that we can use a pythonic solution to the same problem.

The variables are first set at the end of the first iteration, thus the it > 1 check.

CAUTION: I know Python, I know how to read Fortran, but I do NOT claim to understands the maths going on here.

@TC-FF, please take a look at this and confirm if this should work.

TC-FF commented 4 months ago

@aulemahal It works and it's much more understandable. I did some checks on my side and I'm able to reproduce the values.

aulemahal commented 4 months ago

I'll note that the tests pass with numpy 2 as well, which is good news.