You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the fit function with the PWM method and a lmoments3 dist fails if the dataarray contains slices with less than dist.numargs + 2 non-null values (see below for an reproducible example). The simple solution would be to add another check in _fitfunc_1d when using the PWM method. I already implemented a monkeypatch for us so will provide a PR in a sec.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
python3.11/site-packages/xclim/indices/stats.py:51) args, kwargs = _fit_start(x, dist.name, **fitkwargs)
python3.11/site-packages/lmoments3/distr.py:66) elif not lmom_ratios:
ValueError: At least 2 data points must be provided.
Additional context
No response
Contribution
I would be willing/able to open a Pull Request to address this bug.
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
I'm not sure I fully understand the issue : why wouldn't we want to raise an error here ? If this call is invalid with lmoments3 shouldn't the user be made aware of it ?
I found that for larger DataArrays it's quite difficult to figure out why the call is failing for one and not for another since this is often done slices of the data. For all-nan slices we already return NaNs which makes sense, I guess we could raise a warning for affected slices or have a setting that like fail_on_too_few_args ?
Setup Information
Description
Using the fit function with the
PWM
method and a lmoments3 dist fails if the dataarray contains slices with less thandist.numargs + 2
non-null values (see below for an reproducible example). The simple solution would be to add another check in_fitfunc_1d
when using thePWM
method. I already implemented a monkeypatch for us so will provide a PR in a sec.Steps To Reproduce
fails with
Additional context
No response
Contribution
Code of Conduct
The text was updated successfully, but these errors were encountered: