Skip to content

Commit df33a31

Browse files
committed
temperature -> temp_air; dewpoint -> temp_dew
1 parent 1eff53f commit df33a31

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

pvlib/atmosphere.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -337,15 +337,15 @@ def gueymard94_pw(temp_air, relative_humidity):
337337
return pw
338338

339339

340-
def rh_from_tdew(temperature, dewpoint, coeff=(6.112, 17.62, 243.12)):
340+
def rh_from_tdew(temp_air, temp_dew, coeff=(6.112, 17.62, 243.12)):
341341
"""
342342
Calculate relative humidity from dewpoint temperature using the Magnus equation.
343343
344344
Parameters
345345
----------
346-
temperature : numeric
346+
temp_air : numeric
347347
Air temperature (dry-bulb temperature). [°C]
348-
dewpoint : numeric
348+
temp_dew : numeric
349349
Dew-point temperature. [°C]
350350
coeff : tuple, default (6.112, 17.62, 243.12)
351351
Magnus equation coefficients (A, B, C). The default values are those
@@ -364,8 +364,8 @@ def rh_from_tdew(temperature, dewpoint, coeff=(6.112, 17.62, 243.12)):
364364
"""
365365

366366
# Calculate vapor pressure (e) and saturation vapor pressure (es)
367-
e = coeff[0] * np.exp((coeff[1] * temperature) / (coeff[2] + temperature))
368-
es = coeff[0] * np.exp((coeff[1] * dewpoint) / (coeff[2] + dewpoint))
367+
e = coeff[0] * np.exp((coeff[1] * temp_air) / (coeff[2] + temp_air))
368+
es = coeff[0] * np.exp((coeff[1] * temp_dew) / (coeff[2] + temp_dew))
369369

370370
# Calculate relative humidity as percentage
371371
relative_humidity = 100 * (es / e)
@@ -374,15 +374,15 @@ def rh_from_tdew(temperature, dewpoint, coeff=(6.112, 17.62, 243.12)):
374374

375375

376376
def tdew_from_rh(
377-
temperature, relative_humidity, coeff=(6.112, 17.62, 243.12)
377+
temp_air, relative_humidity, coeff=(6.112, 17.62, 243.12)
378378
):
379379
"""
380380
Calculate dewpoint temperature using Magnus equation.
381381
This is a reversal of the calculation in :py:func:`rh_from_tdew`.
382382
383383
Parameters
384384
----------
385-
temperature : numeric
385+
temp_air : numeric
386386
Air temperature (dry-bulb temperature). [°C]
387387
relative_humidity : numeric
388388
Relative humidity (0-100). [%]
@@ -407,7 +407,7 @@ def tdew_from_rh(
407407

408408
# First calculate ln(es/A)
409409
ln_term = (
410-
(coeff[1] * temperature) / (coeff[2] + temperature)
410+
(coeff[1] * temp_air) / (coeff[2] + temp_air)
411411
+ np.log(relative_humidity/100)
412412
)
413413

pvlib/tests/test_atmosphere.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ def test_tdew_to_rh_to_tdew():
9999

100100
# Calculate relative humidity using pandas series as input
101101
relative_humidity = atmosphere.rh_from_tdew(
102-
temperature=temperature_ambient,
103-
dewpoint=dewpoint_original
102+
temp_air=temperature_ambient,
103+
temp_dew=dewpoint_original
104104
)
105105

106106
dewpoint_calculated = atmosphere.tdew_from_rh(
107-
temperature=temperature_ambient,
107+
temp_air=temperature_ambient,
108108
relative_humidity=relative_humidity
109109
)
110110

@@ -137,22 +137,22 @@ def test_rh_from_tdew():
137137

138138
# Calculate relative humidity using pandas series as input
139139
rh_series = atmosphere.rh_from_tdew(
140-
temperature=temperature_ambient,
141-
dewpoint=dewpoint
140+
temp_air=temperature_ambient,
141+
temp_dew=dewpoint
142142
)
143143

144144
# Calulate relative humidity using pandas series as input
145145
# with AEKR coefficients
146146
rh_series_aekr = atmosphere.rh_from_tdew(
147-
temperature=temperature_ambient,
148-
dewpoint=dewpoint,
147+
temp_air=temperature_ambient,
148+
temp_dew=dewpoint,
149149
coeff=(6.1094, 17.625, 243.04)
150150
)
151151

152152
# Calculate relative humidity using array as input
153153
rh_array = atmosphere.rh_from_tdew(
154-
temperature=temperature_ambient.to_numpy(),
155-
dewpoint=dewpoint.to_numpy()
154+
temp_air=temperature_ambient.to_numpy(),
155+
temp_dew=dewpoint.to_numpy()
156156
)
157157

158158
# test
@@ -175,8 +175,8 @@ def test_rh_from_tdew():
175175

176176
# Calculate relative humidity using float as input
177177
rh_float = atmosphere.rh_from_tdew(
178-
temperature=temperature_ambient.iloc[0],
179-
dewpoint=dewpoint.iloc[0]
178+
temp_air=temperature_ambient.iloc[0],
179+
temp_dew=dewpoint.iloc[0]
180180
)
181181

182182
assert np.isclose(
@@ -207,26 +207,26 @@ def test_tdew_from_rh():
207207

208208
# test as series
209209
dewpoint_series = atmosphere.tdew_from_rh(
210-
temperature=temperature_ambient,
210+
temp_air=temperature_ambient,
211211
relative_humidity=relative_humidity_who
212212
)
213213

214214
# test as series with AEKR coefficients
215215
dewpoint_series_aekr = atmosphere.tdew_from_rh(
216-
temperature=temperature_ambient,
216+
temp_air=temperature_ambient,
217217
relative_humidity=relative_humidity_aekr,
218218
coeff=(6.1094, 17.625, 243.04)
219219
)
220220

221221
# test as numpy array
222222
dewpoint_array = atmosphere.tdew_from_rh(
223-
temperature=temperature_ambient.to_numpy(),
223+
temp_air=temperature_ambient.to_numpy(),
224224
relative_humidity=relative_humidity_who.to_numpy()
225225
)
226226

227227
# test as float
228228
dewpoint_float = atmosphere.tdew_from_rh(
229-
temperature=temperature_ambient.iloc[0],
229+
temp_air=temperature_ambient.iloc[0],
230230
relative_humidity=relative_humidity_who.iloc[0]
231231
)
232232

0 commit comments

Comments
 (0)