-
Notifications
You must be signed in to change notification settings - Fork 234
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
Latent heat for ED2 #774
Comments
I don't think so but it would probably be in / should go in
|
Ok, so there's definitely an inconsistency here within model2netcdf.ED2 because on line 281 it has what appears to be the correct terms:
but in the other version, on line 412, it only uses evaporation, which is seems wrong because LE involves both evaporation and transpiration
And yes, if either or both of those are in moles or mm instead of watts you need to do the conversion: https://github.com/EDmodel/ED2/wiki/Glossary---unit-conversions |
No, I know I need to do the conversion, I was asking is the conversion method already in pecan or do I need to add it there? |
I am having an issue currently getting the conversion working. I think I figured out what the problem is, but I don't know how to fix it. I created the function below in data.atmosphere/R/metutils.R and recompiled pecan, but when I call to this function in model2netcdf.ED2.R, it causes the that to crash. I assume the issue is with the param E, but how do I do it correctly? ##' Estimate latent heat from evaporated water [kg/s -> W] LHE <- function(E){ |
@Viskari the function looks like it should work, e.g. if I put |
P.S. While you are at it I would suggest adding an analogous function to go from evaporation to latent heat, as well as some tests. And perhaps use more informative names ... here are my suggestions ##' @title Convert evaporation rate to latent heat flux
##'
##' This function converts latent heat flux given in watts from evaporation rate given in mm/s (= kg/m2/s)
## The latent heat of vaporization for water (lambda) is 2,264,760 J kg-1, so E * lambda = LH
##' @return latent heat flux (LH) in units of Watts/m2 or J/m2/s
##' @param E Evaporation [kg/m2s]
##' @export
##' @author Toni Viskari
evaporation2latentheat <- function(E){
LH <- 2272000 * E
return(LH)
}
##' @title Convert latent heat flux to evaporation rate
##'
##' This function converts evaporation rate given in mm/s (= kg/m2/s) to latent heat flux
## The latent heat of vaporization for water (lambda) is 2,264,760 J kg-1, so E * lambda = LH
##' @return Evaporation Rate in units of mm/s or kg/m2/s
##' @param LH Latent Heat (W/m2)
##' @export
##' @author Toni Viskari, David LeBauer
latentheat2evaporation <- function(LH){
E = LH / 2272000
return(E)
}
PPS Wednesdays are great days for adding new tests ... just put the lines test_that('conversions between latent heat and evaporation work',{
expect_equal(evaporation2latentheat(10), 10 * 2272000)
expect_equal(latentheat2evaporation(10), 10 / 2272000)
expect_equal(latentheat2evaporation(evaporation2latentheat(1)), 1)
}) |
I just tried to rerun, but there seems to be a database issue with our On Wed, Apr 13, 2016 at 6:17 PM, David LeBauer [email protected]
|
@Viskarihttps://github.com/Viskari Rafael changed around some hostname/IP mapping on the server which messed up PEcAn. He is changing it all back now to get it up and running again. On Apr 13, 2016, at 8:16 PM, Viskari <[email protected]mailto:[email protected]> wrote: I just tried to rerun, but there seems to be a database issue with our On Wed, Apr 13, 2016 at 6:17 PM, David LeBauer <[email protected]mailto:[email protected]>
— |
OK @Viskari try it now |
Okay, got everything running now. So the problem with the function that model2netcdf is complaining about not finding it: [1] "----- Processing year: 2000" Do I need to add some additional link to it? |
Did you recompile PEcAn so the package is built, and did you include the package in the dependencies for the ED package? |
I recompiled, but I hadn't added it to the dependencies. Where do you do that addition? |
Okay, second question how do I do the addition? Do I just add the function name or the data module to the dependencies list? |
Yes |
The package name goes in the dependencies list, not the function name |
This issue is stale because it has been open 365 days with no activity. |
As I was going over the output from ED2 as presented by pecan, I realized that ED2 doesn't actually give out latent heat, but the amount of water evaporated and that pecan doesn't currently convert that to energy.
So I thought to ask, before I start adding anything to the code, does pecan have that conversion available? Or should I add it there myself?
The text was updated successfully, but these errors were encountered: