Closed olyson closed 11 months ago
As a workaround, I've modified the code in question like this:
with np.errstate(under='ignore')
score_missed[ptype] = both[ptype] / (both[ptype] + missed[ptype])
which now completes with no errors. The code calculation agrees with my hand calculation. Still not sure why the underflow error occurred.
I have seen this problem before but have no explanation, it does not make sense. Your solution is the right correction, I will commit. Thanks!
Nate
On Thu, Nov 9, 2023 at 2:16 PM Keith Oleson @.***> wrote:
As a workaround, I've modified the code in question like this:
with np.errstate(under='ignore') score_missed[ptype] = both[ptype] / (both[ptype] + missed[ptype])
which now completes with no errors. The code calculation agrees with my hand calculation. Still not sure why the underflow error occurred.
— Reply to this email directly, view it on GitHub https://github.com/rubisco-sfa/ILAMB/issues/82#issuecomment-1804455541, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKFCB6QZH2VXXFXWMXRO23YDUTYPAVCNFSM6AAAAAA7DMUZJWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBUGQ2TKNJUGE . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Thanks Nate!
76c9123
I'm using ILAMB2.7. In a run with two models I'm getting the following error in the Permafrost confrontation for one of the models:
[DEBUG][5][WorkConfront][Permafrost/Obu2018][SturmSnowtk] Traceback (most recent call last): File "/glade/p/cesm/lmwg/diag/ILAMB/CODE/ilamb/bin/ilamb-run", line 561, in WorkConfront c.confront(m) File "/glade/work/oleson/conda-envs/ilamb_lmwg/lib/python3.7/site-packages/ILAMB/ConfPermafrost.py", line 276, in confront score_missed[ptype] = both[ptype] / (both[ptype] + missed[ptype]) File "/glade/work/oleson/conda-envs/ilamb_lmwg/lib/python3.7/site-packages/numpy/ma/core.py", line 4197, in truediv return true_divide(self, other) File "/glade/work/oleson/conda-envs/ilamb_lmwg/lib/python3.7/site-packages/numpy/ma/core.py", line 1166, in call m |= domain(da, db) File "/glade/work/oleson/conda-envs/ilamb_lmwg/lib/python3.7/site-packages/numpy/ma/core.py", line 853, in call return umath.absolute(a) * self.tolerance >= umath.absolute(b) FloatingPointError: underflow encountered in double_scalars
As noted, Line 276 in ConfPermafrost.py is:
So I've printed out the variable values entering into that calculation using: print("ptype: ",ptype) print("missed: ",missed[ptype]) print("both: ",both[ptype]) print("both+missed: ",both[ptype]+missed[ptype])
The values are: ptype: d missed: 3.1715914949311625 both: 0.5357629054099063 both+missed: 3.707354400341069
I don't see any problem with those values in that calculation and I don't see why there would be an underflow.
Interestingly, the other model works fine and the calculation is completed successfully and the values are:
ptype: d missed: 2.692865569871369 both: 1.73930589189917 both+missed: 4.432171461770539 both/both+missed: 0.3924274832103093 score_missed: 0.3924274832103093
Any ideas? Maybe I'm not printing out the variables I think I am?