-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat: legacy effective temperature #379
base: master
Are you sure you want to change the base?
Changes from 3 commits
5ef87a2
4b865f5
edf3de5
756ef54
5a85a7a
5e94de8
8aa242b
50cdf32
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Effective temperature transitioned from legacy code of @stgeorges""" | ||
|
||
def effective_temperature(Ta, ws, rh, SR, ac): | ||
# inputs: (Ta, ws, rh, SR, ac): | ||
if ws <= 0.2: | ||
# formula by Missenard | ||
TE = Ta - 0.4*(Ta - 10)*(1-rh/100) | ||
elif ws > 0.2: | ||
# modified formula by Gregorczuk (WMO, 1972; Hentschel, 1987) | ||
TE = 37 - ( (37-Ta)/(0.68-(0.0014*rh)+(1/(1.76+1.4*(ws**0.75)))) ) - (0.29 * Ta * (1-0.01*rh)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The spacing here needs to follow PEP8. As do all of the variable names: |
||
|
||
# Radiative-effective temperature | ||
TRE = TE + ((1 - 0.01*ac)*SR) * ((0.0155 - 0.00025*TE) - (0.0043 - 0.00011*TE)) | ||
|
||
if TRE < 1: | ||
effectTE = -4 | ||
comfortable = 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This whole set of conditionals should be in a separate function. Much like you see here in the apparent temperature module: https://github.com/ladybug-tools/ladybug-comfort/blob/master/ladybug_comfort/at.py Also, we don't need the 0/1 for comfortable. We can infer that from the category. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chriswmackey im working on documentation at the moment and had a question, do you know what the variable effectTE is? I would like to document it |
||
elif TRE >= 1 and TE < 9: | ||
effectTE = -3 | ||
comfortable = 0 | ||
elif TRE >= 9 and TE < 17: | ||
effectTE = -2 | ||
comfortable = 0 | ||
elif TRE >= 17 and TE < 21: | ||
effectTE = -1 | ||
comfortable = 0 | ||
elif TRE >= 21 and TE < 23: | ||
effectTE = 0 | ||
comfortable = 1 | ||
elif TRE >= 23 and TE < 27: | ||
effectTE = 1 | ||
comfortable = 0 | ||
elif TRE >= 27: | ||
effectTE = 2 | ||
comfortable = 0 | ||
|
||
return TRE, effectTE, comfortable, [] | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
ladybug-core==0.43.18 | ||
numpy |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# coding utf-8 | ||
|
||
import pytest | ||
|
||
from ladybug_comfort.et import effective_temperature | ||
|
||
def test_effective_temperature(): | ||
"""Test the effective_temperature function""" | ||
et_obj = effective_temperature(Ta=13.7, | ||
ws=7.8, | ||
rh=74, | ||
SR=104, | ||
ac=318) | ||
assert et_obj[0] == 0.07758930406978726 | ||
assert et_obj[1] == -4 | ||
assert et_obj[2] == 0 | ||
assert et_obj[3] == [] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a docstring here