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

Add relative humidity from temp/dewpoint function #680

Closed
wants to merge 6 commits into from
Closed

Add relative humidity from temp/dewpoint function #680

wants to merge 6 commits into from

Conversation

lsterzinger
Copy link
Contributor

I added a function to calculate relative humidity from temperature and dewpoint to calc (metpy.calc.relative_humidity_from_dewpoint).

This is my first ever pull request to an open source project, if there's anything I've done wrong please feel free to let me know.

@CLAassistant
Copy link

CLAassistant commented Dec 11, 2017

CLA assistant check
All committers have signed the CLA.

@@ -25,6 +26,14 @@
from metpy.testing import assert_almost_equal, assert_array_almost_equal, assert_nan
from metpy.units import units

def test_relative_humidity_from_dewpoint():

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E302 expected 2 blank lines, found 1

@@ -25,6 +26,14 @@
from metpy.testing import assert_almost_equal, assert_array_almost_equal, assert_nan
from metpy.units import units

def test_relative_humidity_from_dewpoint():
"""Test Relative Humidity calculation"""
assert_almost_equal(relative_humidity_from_dewpoint(25. * units.degC, 15. * units.degC), 53.83*units.percent, 2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (116 > 95 characters)
E226 missing whitespace around arithmetic operator

"""Test Relative Humidity calculation"""
assert_almost_equal(relative_humidity_from_dewpoint(25. * units.degC, 15. * units.degC), 53.83*units.percent, 2)

def test_relative_humidity_from_dewpoint_with_f():

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E302 expected 2 blank lines, found 1


def test_relative_humidity_from_dewpoint_with_f():
"""Test Relative Humidity accepts temperature in Fahrenheit"""
assert_almost_equal(relative_humidity_from_dewpoint(70. * units.degF, 55. * units.degF), 58.96*units.percent, 2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (116 > 95 characters)
E226 missing whitespace around arithmetic operator

@@ -21,6 +21,43 @@

sat_pressure_0c = 6.112 * units.millibar

@exporter.export

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E302 expected 2 blank lines, found 1

"""


a = 17.269

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E303 too many blank lines (2)



a = 17.269
e = 6.1078*units.mb * np.exp(a*(dewpt-(273.16*units.kelvin))/(dewpt-(35.86*units.kelvin)))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E226 missing whitespace around arithmetic operator


a = 17.269
e = 6.1078*units.mb * np.exp(a*(dewpt-(273.16*units.kelvin))/(dewpt-(35.86*units.kelvin)))
e_s = 6.1078*units.mb * np.exp(a*(temperature-273.16*units.kelvin)/(temperature-35.86*units.kelvin))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E226 missing whitespace around arithmetic operator
E501 line too long (104 > 95 characters)

e = 6.1078*units.mb * np.exp(a*(dewpt-(273.16*units.kelvin))/(dewpt-(35.86*units.kelvin)))
e_s = 6.1078*units.mb * np.exp(a*(temperature-273.16*units.kelvin)/(temperature-35.86*units.kelvin))

return 100. * (e/e_s) * units.percent

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E226 missing whitespace around arithmetic operator

def test_relative_humidity_from_dewpoint():
"""Test Relative Humidity calculation"""
assert_almost_equal(relative_humidity_from_dewpoint(25. * units.degC, 15. * units.degC),
53.83 * units.percent, 2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E128 continuation line under-indented for visual indent

def test_relative_humidity_from_dewpoint_with_f():
"""Test Relative Humidity accepts temperature in Fahrenheit"""
assert_almost_equal(relative_humidity_from_dewpoint(70. * units.degF, 55. * units.degF),
58.96 * units.percent, 2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E128 continuation line under-indented for visual indent


a = 17.269
e = 6.1078 * units.mb * np.exp(a * (dewpt - (273.16 * units.kelvin))
/ (dewpt - (35.86 * units.kelvin)))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E128 continuation line under-indented for visual indent
W503 line break before binary operator

e = 6.1078 * units.mb * np.exp(a * (dewpt - (273.16 * units.kelvin))
/ (dewpt - (35.86 * units.kelvin)))
e_s = 6.1078 * units.mb * np.exp(a * (temperature - 273.16 * units.kelvin)
/ (temperature - 35.86 * units.kelvin))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E128 continuation line under-indented for visual indent
W503 line break before binary operator

e_s = 6.1078 * units.mb * np.exp(a * (temperature - 273.16 * units.kelvin)
/ (temperature - 35.86 * units.kelvin))

return 100. * (e/e_s) * units.percent

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E226 missing whitespace around arithmetic operator

e_s = 6.1078 * units.mb * np.exp(a * (temperature - 273.16 * units.kelvin) /
(temperature - 35.86 * units.kelvin))

return 100. * (e/e_s) * units.percent

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E226 missing whitespace around arithmetic operator

@lsterzinger lsterzinger deleted the add-relative-humidity branch December 11, 2017 19:03
@lsterzinger
Copy link
Contributor Author

Closed so I can fix all the pep8 errors. I will resubmit a pull request after styling is correct, sorry for the issues.

@dopplershift
Copy link
Member

No worries! That's the bot's job, to catch the style issues; not an issue at all that your initial submission didn't match our style. Thanks for your interest in contributing.

For future reference, it would have been perfectly acceptable to just keep pushing commits to this PR. You can use git push --force after using git rebase if you wanted to clean up the history.

@lsterzinger
Copy link
Contributor Author

Good to know, thanks! I re-submitted my pull request here #681, let me know if there's anything else I need to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants