thouska / spotpy

A Statistical Parameter Optimization Tool
https://spotpy.readthedocs.io/en/latest/
MIT License
248 stars 150 forks source link

Fix np.float16 to string conversion #264

Open cheginit opened 3 years ago

cheginit commented 3 years ago

Based on this bug report in numpy's repo, rounding a np.float16 could lead to inf. So instead, I propose to use a numpy function for converting a float to str. For example:

np.format_float_positional(np.float16(7.33), 4)

correctly return 7.33 but:

str(round(np.float16(7.33), 4))

returns inf.

coveralls commented 3 years ago

Pull Request Test Coverage Report for Build 904


Files with Coverage Reduction New Missed Lines %
spotpy/algorithms/sceua.py 2 85.46%
<!-- Total: 2 -->
Totals Coverage Status
Change from base Build 903: 0.1%
Covered Lines: 4111
Relevant Lines: 4854

💛 - Coveralls