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 for Fahrenheit deltas, degree-days and others. #1804

Merged
merged 12 commits into from
Jul 3, 2024
Merged

Conversation

aulemahal
Copy link
Collaborator

@aulemahal aulemahal commented Jun 26, 2024

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)
  • CHANGES.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?

  • New function ensure_absolute_temperature that converts temperature units to their absolute counterpart assuming they represented a delta. So °C becomes K and °F becomes °R. Anything else goes unmodified (including compound units like °C m (whatever that means)).
  • Use this function in to_agg_units to ensure a correct output for op "std", "var" and "integral".

Does this PR introduce a breaking change?

No

Other information:

Pint has "delta_degC" and "delta_degF" for temperature differences, but CF does not. So this new function helps in the specific case where we know the data is delta-like, which happens for the given op.

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. LGTM.

CHANGES.rst Outdated Show resolved Hide resolved
@github-actions github-actions bot added the approved Approved for additional tests label Jun 27, 2024
@coveralls
Copy link

Coverage Status

coverage: 90.593% (-0.002%) from 90.595%
when pulling 684582e on fix-temp-integral
into a375d78 on main.

@coveralls
Copy link

Coverage Status

coverage: 90.603% (+0.008%) from 90.595%
when pulling c14e52b on fix-temp-integral
into 23fd681 on main.

@coveralls
Copy link

Coverage Status

coverage: 90.658% (+0.009%) from 90.649%
when pulling b10e849 on fix-temp-integral
into 67285be on main.

@coveralls
Copy link

Coverage Status

coverage: 90.658% (+0.009%) from 90.649%
when pulling 9b1889a on fix-temp-integral
into 86b6bc5 on main.

@Zeitsperre Zeitsperre merged commit 26a47ef into main Jul 3, 2024
19 checks passed
@Zeitsperre Zeitsperre deleted the fix-temp-integral branch July 3, 2024 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Approved for additional tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Degree day calculation unit handling errors
6 participants