Skip to content

Commit

Permalink
v1.4.0
Browse files Browse the repository at this point in the history
manages value of LMA when set to NULL or 0, depending on when PROSPECT- D or PROSPECT-PRO is expected
  • Loading branch information
jbferet committed Aug 16, 2023
1 parent b38ecc9 commit e62fb65
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# prospect v1.4.0

## fixes
deal with default values when seting proteins, CBC and LMA to non constant value

# prospect v1.3.0

new release including JOSS draft

# prospect v1.2.7

## fixes
Expand Down
15 changes: 10 additions & 5 deletions R/Lib_PROSPECT.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,28 @@
#' @param N numeric. Leaf structure parameter
#' @param CHL numeric. Chlorophyll content (microg.cm-2)
#' @param CAR numeric. Carotenoid content (microg.cm-2)
#' @param ANT numeric. Anthocyain content (microg.cm-2)
#' @param ANT numeric. Anthocyanin content (microg.cm-2)
#' @param BROWN numeric. Brown pigment content (Arbitrary units)
#' @param EWT numeric. Equivalent Water Thickness (g.cm-2)
#' @param LMA numeric. Leaf Mass per Area (g.cm-2)
#' @param PROT numeric. protein content (g.cm-2)
#' @param CBC numeric. NonProtCarbon-based constituent content (g.cm-2)
#' @param CBC numeric. NonProt Carbon-based constituent content (g.cm-2)
#' @param alpha numeric. Solid angle for incident light at surface of leaf
#'
#' @return leaf directional-hemisphrical reflectance and transmittance
#' @return leaf directional-hemispherical reflectance and transmittance
#' @importFrom expint expint
#' @export
PROSPECT <- function(SpecPROSPECT, N = 1.5, CHL = 40.0,
CAR = 8.0, ANT = 0.0, BROWN = 0.0, EWT = 0.01,
LMA = NULL, PROT = 0.0, CBC = 0.0, alpha = 40.0) {


# if calling PROSPECT-PRO (protein content or CBC defined by user)
# then set LMA to 0 in any case
if (!is.null(PROT) | !is.null(CBC)) {
if (!is.null(LMA) & (PROT > 0 | CBC > 0)) {
if (PROT > 0 | CBC > 0){
if (is.null(LMA)) LMA <- 0
}
if (!LMA==0 & (PROT > 0 | CBC > 0)) {
message("PROT and/or CBC are not set to 0")
message("LMA is not set to 0 neither, which is physically incorrect")
message("(LMA = PROT + CBC)")
Expand All @@ -49,6 +53,7 @@ PROSPECT <- function(SpecPROSPECT, N = 1.5, CHL = 40.0,
LMA <- 0
}
}
# if calling PROSPECT-D (protein content or CBC defined by user and > 0)
# setting default value for LMA
if (is.null(LMA)){
LMA <- 0.008
Expand Down
6 changes: 3 additions & 3 deletions man/PROSPECT.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e62fb65

Please sign in to comment.