Skip to content

Parametric pdf#2323

Open
coxipi wants to merge 4 commits intomainfrom
add_parametric_pdf
Open

Parametric pdf#2323
coxipi wants to merge 4 commits intomainfrom
add_parametric_pdf

Conversation

@coxipi
Copy link
Contributor

@coxipi coxipi commented Feb 17, 2026

Pull Request Checklist:

  • This PR addresses an already opened issue (for bug fixes / features)
    • This PR fixes #xyz
  • Tests for the changes have been added (for bug fixes / features)
    • (If applicable) Documentation has been added / updated (for bug fixes / features)
  • CHANGELOG.rst has been updated (with summary of main changes)
    • Link to issue (:issue:number) and pull request (:pull:number) has been added

What kind of change does this PR introduce?

  • Add xclim.indices.stats.parametric_pdf

Does this PR introduce a breaking change?

Other information:

coxipi and others added 4 commits February 17, 2026 10:04
Signed-off-by: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com>

def parametric_pdf(
p: xr.DataArray,
x: xr.DataArray | float | Sequence[float],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a DataArray makes sense here, so I can assign units with it. Do you agree? I could also change parametric_cdf in this way

dist = get_dist(dist or p.attrs["scipy_dist"])

data = xr.apply_ufunc(
lambda x, p: dist.pdf(x, *p),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do we think of in-line lambda functions? I'm guessing this would not pass on the council ...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can make exceptions.

Simple functions are better than more complex ones; If it's easily read/understood, I don't see a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments