Skip to content

Commit

Permalink
Better error message
Browse files Browse the repository at this point in the history
  • Loading branch information
aulemahal committed Feb 13, 2024
1 parent 50b32e0 commit ca332ab
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions xclim/indices/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ def fit(
# Get the distribution
dist = get_dist(dist)

if method == "PWM" and not hasattr(dist, "lmom_fit"):
raise ValueError(
f"The given distribution {dist} does not implement the PWM fitting method. Please pass an instance from the lmoments3 package."
)

shape_params = [] if dist.shapes is None else dist.shapes.split(",")
dist_params = shape_params + ["loc", "scale"]

Expand Down

0 comments on commit ca332ab

Please sign in to comment.