Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix subdaily rate2amount, add hydro transformation from lwe thickness to amount #1963

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

aulemahal
Copy link
Collaborator

Pull Request Checklist:

  • This PR addresses an already opened issue (for bug fixes / features)
  • 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?

  • The _rate_to_amount_converter relied on the FREQ_UNITS directly, now it goes through infer_sampling_units instead. In exchange for slightly more code, this fixes the issue for sub-daily freqs and gives a better error for frequencies xclim can't understand.
  • Add the "lwe thickness -> amount" hydro transformation. The inverse was already there. This is to go from a thickness of liquid water (ex: mm of rain) to an amount (ex: kg m-2), by multiplying by the liquid water density (1000 kg m-3).

Does this PR introduce a breaking change?

No.

Sorry, something went wrong.

@aulemahal aulemahal requested a review from Zeitsperre October 17, 2024 18:07
Copy link
Collaborator

@Zeitsperre Zeitsperre left a comment

Choose a reason for hiding this comment

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

Elegant.

xclim/core/units.py Outdated Show resolved Hide resolved
@github-actions github-actions bot added the approved Approved for additional tests label Oct 17, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Co-authored-by: Trevor James Smith <[email protected]>
@Zeitsperre Zeitsperre mentioned this pull request Oct 17, 2024
5 tasks
@Zeitsperre Zeitsperre added the priority Immediate priority label Oct 17, 2024
@Zeitsperre Zeitsperre merged commit 029d85c into main Oct 17, 2024
21 checks passed
@Zeitsperre Zeitsperre deleted the fix-extra-units branch October 17, 2024 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Approved for additional tests priority Immediate priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't rate2amount with smaller-than-daily frequencies
2 participants