Skip to content

Commit ff6cb77

Browse files
committed
catch case of all E0 numerically the same
which caused problems with Gaussian process fitting
1 parent 9759155 commit ff6cb77

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

R/PartitioningLasslop10Nighttime.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,13 @@ partGLSmoothTempSens <- function(
416416
warning(
417417
"No respiration-temperature relationship for any period of the ",yr,"th year. "
418418
, "Using mean temperature sensitivity of other years for this year.")
419+
} else if (sd(E0WinFinite$E0)/mean(E0WinFinite$E0) < 0.01) {
420+
# little variability in E0 estimates, no need to smooth
421+
# takes care of error with mlegp if all E0 are the same (Kai 25)
422+
# if only few records are available the uncertainty for the gaps is
423+
# underestimated
424+
E0WinYr$E0 = mean(E0WinFinite$E0)
425+
E0WinYr$sdE0 = max(E0WinFinite$sdE0)
419426
} else {
420427
if (!requireNamespace("mlegp")) stop(
421428
"package mlegp is required for Lasslop daytime partitioning.",

0 commit comments

Comments
 (0)