Skip to content

Commit

Permalink
Merge branch 'master' into offline-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeitsperre authored Sep 11, 2023
2 parents 861214c + 71df931 commit e47c55f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Changelog

v0.46.0 (unreleased)
--------------------
Contributors to this version: Trevor James Smith (:user:`Zeitsperre`).
Contributors to this version: Éric Dupuis (:user:`coxipi`), Trevor James Smith (:user:`Zeitsperre`).

New features and enhancements
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -21,6 +21,7 @@ Breaking changes

Internal changes
^^^^^^^^^^^^^^^^
* Changed "degK" to "K" (used to designate Kelvin units). (:pull:`1475`).
* Added handling for `pytest-socket`'s ``SocketBlockedError`` in ``xclim.testing.open_dataset`` when attempting to fetch md5 validation files for cached testing data while explicitly disabling internet sockets. (:issue:`1468`, :pull:`1473`).

v0.45.0 (2023-09-05)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.45.0
current_version = 0.45.1-beta
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+).(?P<patch>\d+)(\-(?P<release>[a-z]+))?
Expand Down
2 changes: 1 addition & 1 deletion xclim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

__author__ = """Travis Logan"""
__email__ = "[email protected]"
__version__ = "0.45.0"
__version__ = "0.45.1-beta"


# Load official locales
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

0 comments on commit e47c55f

Please sign in to comment.