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

Refactor notation: degK to K #1475

Merged
merged 3 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
Changelog
=========

v0.46.0
--------------------
Contributors to this version: Éric Dupuis (:user:`coxipi`).

Internal changes
^^^^^^^^^^^^^^^^
* Change "degK" to "K" used to design Kelvin units. (:pull:`1475`).

v0.45.0 (2023-09-05)
--------------------
Contributors to this version: David Huard (:user:`huard`), Trevor James Smith (:user:`Zeitsperre`), Pascal Bourgault (:user:`aulemahal`), Juliette Lavoie (:user:`juliettelavoie`), Gabriel Rondeau-Genesse (:user:`RondeauG`), Marco Braun (:user:`vindelico`), Éric Dupuis (:user:`coxipi`).
Expand Down
14 changes: 7 additions & 7 deletions xclim/indices/_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,9 @@ def saturation_vapor_pressure(
:cite:cts:`goff_low-pressure_1946,hardy_its-90_1998,sonntag_important_1990,tetens_uber_1930,vomel_saturation_2016,world_meteorological_organization_guide_2008`
"""
if ice_thresh is not None:
thresh = convert_units_to(ice_thresh, "degK")
thresh = convert_units_to(ice_thresh, "K")
else:
thresh = convert_units_to("0 K", "degK")
thresh = convert_units_to("0 K", "K")
tas = convert_units_to(tas, "K")
ref_is_water = tas > thresh
if method in ["sonntag90", "SO90"]:
Expand Down Expand Up @@ -585,8 +585,8 @@ def relative_humidity(
if method in ("bohren98", "BA90"):
if tdps is None:
raise ValueError("To use method 'bohren98' (BA98), dewpoint must be given.")
tdps = convert_units_to(tdps, "degK")
tas = convert_units_to(tas, "degK")
tdps = convert_units_to(tdps, "K")
tas = convert_units_to(tas, "K")
L = 2.501e6
Rw = (461.5,)
hurs = 100 * np.exp(-L * (tas - tdps) / (Rw * tas * tdps)) # type: ignore
Expand All @@ -601,7 +601,7 @@ def relative_humidity(
else:
ps = convert_units_to(ps, "Pa")
huss = convert_units_to(huss, "")
tas = convert_units_to(tas, "degK")
tas = convert_units_to(tas, "K")

e_sat = saturation_vapor_pressure(tas=tas, ice_thresh=ice_thresh, method=method)

Expand Down Expand Up @@ -698,7 +698,7 @@ def specific_humidity(
"""
ps = convert_units_to(ps, "Pa")
hurs = convert_units_to(hurs, "")
tas = convert_units_to(tas, "degK")
tas = convert_units_to(tas, "K")

e_sat = saturation_vapor_pressure(tas=tas, ice_thresh=ice_thresh, method=method)

Expand Down Expand Up @@ -844,7 +844,7 @@ def snowfall_approximation(
prsn = pr * fraction.interp(tas=tas, method="linear")

elif method == "auer":
dtas = convert_units_to(tas, "degK") - convert_units_to(thresh, "degK")
dtas = convert_units_to(tas, "K") - convert_units_to(thresh, "K")

# Create nodes for the snowfall fraction: -inf, thresh, ..., thresh+6, inf [degC]
t = np.concatenate(
Expand Down