Open fabeit opened 9 years ago
It should be, but for atmospheric sea level surface pressure range, the effect is relatively small. see: http://www.humidity-calculator.com/index.php http://www.humidity-calculator.com/index.php and: http://www.humidity-calculator.com/index.php http://www.humidity-calculator.com/index.php
It should essentially be the reverse of qcshum in metutils which goes from SH to RH. Use Clausius-Clapeyron approximation to get saturation vapor pressure (Es in Pa) from Tair Multiple Rh by Es to get vapor pressure (E) in Pa Convert E to SH (or AH) in kg/kg based on air pressure (in Pa)
rh2qair looks like an approximation. A good test would be qair2rh(rh2qair(R,T) should return R within approximation
Ankur R Desai, Associate Professor University of Wisconsin - Madison, Atmospheric and Oceanic Sciences http://flux.aos.wisc.edu http://flux.aos.wisc.edu/ desai@aos.wisc.edu mailto:desai@aos.wisc.edu O: +1-608-520-0305 / M: +1-608-218-4208
On Jun 27, 2015, at 3:41 AM, fabeuw notifications@github.com wrote:
@mdietze https://github.com/mdietze In this formula to convert RH to SH pressure is not included, why? Isn't RH dependent on pressure?
' converts relative humidity to specific humidity
' @title https://github.com/title RH to SH
' @param https://github.com/param rh relative humidity (proportion, not %)
' @param https://github.com/param T absolute temperature (Kelvin)
' @export https://github.com/export
' @author https://github.com/author Mike Dietze
' @aliases https://github.com/aliases rh2rv
rh2qair <- function(rh, T){ qair <- rh * 2.541e6 * exp(-5415.0 / T) * 18/29 return(qair) }
— Reply to this email directly or view it on GitHub https://github.com/PecanProject/pecan/issues/518.
If anyone, whether a professor in atmospheric science or otherwise, wants to submit a pull request with a more accurate version I'd be happy for the update.
I actually tried both rh2qair and then used qair2rh and solved for qair, the difference is indeed small.
summary(ncep) calculated with rh2qair function from @mdietze Min. 1st Qu. Median Mean 3rd Qu. Max. 0.01080 0.01533 0.01602 0.01605 0.01684 0.02020 summary(ncep) calculated with qair2rh function from @dlebauer solved for qair Min. 1st Qu. Median Mean 3rd Qu. Max. 0.01083 0.01544 0.01614 0.01617 0.01695 0.02034
Wait till you get to the mountains. Also, one expects Kelvin, the other Celcius. fix is on the way.
Ankur R Desai, Associate Professor University of Wisconsin - Madison, Atmospheric and Oceanic Sciences http://flux.aos.wisc.edu http://flux.aos.wisc.edu/ desai@aos.wisc.edu mailto:desai@aos.wisc.edu O: +1-608-520-0305 / M: +1-608-218-4208
On Jun 30, 2015, at 12:40 PM, fabeuw notifications@github.com wrote:
I actually tried both rh2qair and then used qair2rh and solved for qair, the difference is indeed small.
summary(ncep) calculated with rh2qair function from @mdietze https://github.com/mdietze Min. 1st Qu. Median Mean 3rd Qu. Max. 0.01080 0.01533 0.01602 0.01605 0.01684 0.02020 summary(ncep) calculated with qair2rh function from @dlebauer https://github.com/dlebauer solved for qair Min. 1st Qu. Median Mean 3rd Qu. Max. 0.01083 0.01544 0.01614 0.01617 0.01695 0.02034
— Reply to this email directly or view it on GitHub https://github.com/PecanProject/pecan/issues/518#issuecomment-117275343.
But it’s so much more fun to just whine about it :)
Well just made a pull request to make the function be exactly correct, but not break existing calls to it.
Two issues: qair2rh works in Celcius and millibar, and assigns a default pressure of 1 ATM if one is not passed rh2qair works in Kelvin
rh2qair is called in met2CF Ameriflux/CSV/ALMA and temporal downscaling, two of these functions don’t read in pressure currently. qair2rh is called in met2model for BIOCRO/SIPNET and temporal downscaling. So 7 functions need to be changed if we want a) to make all this be in SI units and b) pass pressure around in both cases.
For now, the pull request allows a pressure in Pa to be passed to rh2qair, but doesn’t otherwise change functionality.
Ankur R Desai, Associate Professor University of Wisconsin - Madison, Atmospheric and Oceanic Sciences http://flux.aos.wisc.edu http://flux.aos.wisc.edu/ desai@aos.wisc.edu mailto:desai@aos.wisc.edu O: +1-608-520-0305 / M: +1-608-218-4208
On Jun 30, 2015, at 6:23 AM, Michael Dietze notifications@github.com wrote:
If anyone, whether a professor in atmospheric science or otherwise, wants to submit a pull request with a more accurate version I'd be happy for the update.
— Reply to this email directly or view it on GitHub https://github.com/PecanProject/pecan/issues/518#issuecomment-117129913.
great, thanks for that. Yes why not just have all the same units?!
Thanks @ankurdesai, I just merged that pull request. I'm going to leave this issue open so we remember to go back and standardize units and pass pressure explicitly.
Yes why not just have all the same units?!
@fabeuw I think the answer is different authors.
pass pressure explicitly
@mdietze some data sources don't provide pressure, thus the defaults. We could use an elevation correction (e.g. the rgbif package has a function elevation
that takes latlon).
@mdietze @ankurdesai Have we remembered to "go back and standardize units and pass pressure explicitly?". Is it still worth keeping this issue open? (Keeping in mind that closed issues are still 100% searchable, and can always be re-opened.)
This issue is stale because it has been open 365 days with no activity.
@mdietze In this formula to convert RH to SH pressure is not included, why? Isn't RH dependent on pressure?
' converts relative humidity to specific humidity
' @title RH to SH
' @param rh relative humidity (proportion, not %)
' @param T absolute temperature (Kelvin)
' @export
' @author Mike Dietze
' @aliases rh2rv
rh2qair <- function(rh, T){ qair <- rh * 2.541e6 * exp(-5415.0 / T) * 18/29 return(qair) }