Skip to content

Commit

Permalink
Added absolute Humidity
Browse files Browse the repository at this point in the history
  • Loading branch information
briis committed Oct 8, 2023
1 parent 7f12f90 commit ce494aa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pyweatherflow_forecast/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,16 @@ def __init__(
self._precip_minutes_local_day_final = precip_minutes_local_day_final
self._precip_minutes_local_yesterday_final = precip_minutes_local_yesterday_final

@property
def absolute_humidity(self) -> float:
"""Aboslute Humidity (g.m-3)."""
if self._air_temperature is None or self._relative_humidity is None:
return None

kelvin = self._air_temperature * 273.16
humidity = self._relative_humidity / 100
return (1320.65 / kelvin) * humidity * (10 ** ((7.4475 * (kelvin - 273.14)) / (kelvin - 39.44)))

@property
def air_density(self) -> float:
"""Air Density."""
Expand Down
1 change: 1 addition & 0 deletions test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
print("WIND DIRECTION: ", sensor_data.wind_direction)
print("WIND CARDINAL: ", sensor_data.wind_cardinal)
print("PRECIP CHECKED: ", sensor_data.precip_accum_local_day_final)
print("ABSOLUTE HUMIDITY: ", sensor_data.absolute_humidity)

# data: WeatherFlowStationData = weatherflow.get_station()
# print("STATION NAME: ", data.station_name)
Expand Down

0 comments on commit ce494aa

Please # to comment.