diff --git a/.gitmodules b/.gitmodules index 43a20263..ae1d5bef 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "src/SOILWAT2"] path = src/SOILWAT2 url = https://github.com/DrylandEcology/SOILWAT2 - branch = release/devel_v7.0.0 + branch = read_more_daily_input diff --git a/NAMESPACE b/NAMESPACE index 815db1b3..8b07e24c 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -16,6 +16,7 @@ export(calc_RRs_Chambers2014) export(calc_RRs_Maestas2016) export(calc_SMTRs) export(calc_SiteClimate) +export(calc_dailyInputFlags) export(check_SWRC_vs_PTF) export(check_TranspirationRegions) export(check_ptf_availability) @@ -84,6 +85,7 @@ export(get_version) export(get_years_from_weatherDF) export(get_years_from_weatherData) export(has_soilTemp_failed) +export(is_missing_weather) export(list_matched_swrcs_ptfs) export(lookup_annual_CO2a) export(nrow_output) @@ -146,7 +148,11 @@ export(swrc_vwc_to_swp) export(time_columns) export(update_biomass) export(update_requested_years) +export(upgrade_weatherHistory) +export(weatherGenerator_dataColumns) export(weatherHistory) +export(weather_dataAggFun) +export(weather_dataColumns) exportClasses(swCarbon) exportClasses(swCloud) exportClasses(swEstab) diff --git a/NEWS.md b/NEWS.md index 0734c7ff..e52f0d6e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,12 +4,16 @@ * `SOILWAT2` updated to v7.0.0 * This version produces nearly identical simulation output as the previous release under default values. - Small deviations arise due to a fix in the handling of soil moisture values - between field capacity and saturation. + Small deviations arise due to + 1. a fix in the handling of soil moisture values + between field capacity and saturation; + 2. a fix in the calculation of potential natural vegetation; and + 3. a fix in the calculation of climate variables (if used). ## New features * New method `sw_upgrade()` upgrades objects with - outdated `rSOILWAT2` S4 classes to the current version. + outdated `rSOILWAT2` S4 classes to the current version; + new `upgrade_weatherHistory()` upgrades outdated weather history objects. * New `get_soilmoisture()` to consistently extract soil moisture content, volumetric water content (bulk soil), or volumetric water content for the matric component. @@ -21,6 +25,21 @@ * New `time_columns()` returns the output column indices with time information. * New `nrow_output()` returns the number of time steps in output. +* Daily weather inputs, in addition to the previous variables + maximum air temperature, minimum air temperature, and precipitation amount, + can now process the following variables (issue #229; @dschlaep, @N1ckP3rsl3y): + * Cloud cover (can be replaced by shortwave radiation) + * Wind speed (can be replaced by wind components) + * Wind speed eastward component (optional) + * Wind speed northward component (optional) + * Relative humidity (can be replaced by max/min humidity, specific humidity + dew point temperature, or vapor pressure) + * Maximum relative humidity (optional) + * Minimum relative humidity (optional) + * Specific humidity (optional) + * Dew point temperature (optional) + * Actual vapor pressure (optional) + * Downward surface shortwave radiation (optional) * This version now handles a variety of soil water retention curves `SWRC` and pedotransfer functions `PTF` (issue #207, @dschlaep). @@ -94,7 +113,15 @@ as inputs (value 0, as previously). * `SWPtoVWC()` and `VWCtoSWP()` are deprecated in favor of `swrc_swp_to_vwc()` and `swrc_vwc_to_swp()` respectively. - +* Class `swWeather` gains new slots (issue #229) + * `"use_cloudCoverMonthly"`, `"use_windSpeedMonthly"`, and + `"use_humidityMonthly"` which determine whether mean monthly values + (from `swCloud`) or daily values (from `swWeatherData`) are utilized; + * `"dailyInputFlags"` which indicates which of the 14 possible daily + weather variables are present in the inputs; + * `"desc_rsds"` which describes units of input shortwave radiation. +* Class `swWeatherData` gains new columns in slot `"data"` that accommodate + all 14 possible daily weather variables (issue #229). # rSOILWAT2 v5.4.1 * This version produces identical simulation output as the previous release. diff --git a/R/A_swGenericMethods.R b/R/A_swGenericMethods.R index 91bd4a0c..88fa20ac 100644 --- a/R/A_swGenericMethods.R +++ b/R/A_swGenericMethods.R @@ -48,6 +48,8 @@ rSW2_version <- function() { #' @examples #' get_version(rSOILWAT2::sw_exampleData) #' get_version(sw_exec(rSOILWAT2::sw_exampleData)) +#' get_version(as.numeric_version("4.1.3")) +#' get_version(packageVersion("rSOILWAT2")) #' #' @export setGeneric("get_version", function(object) standardGeneric("get_version")) @@ -57,11 +59,16 @@ setMethod( "get_version", signature = "ANY", definition = function(object) { - tmp <- try(object@version, silent = TRUE) - if (inherits(tmp, "try-error")) { - NA_character_ + tmp <- try(inherits(object, "numeric_version"), silent = TRUE) + if (inherits(tmp, "try-error") || !isTRUE(tmp)) { + tmp <- try(object@version, silent = TRUE) + if (inherits(tmp, "try-error")) { + NA_character_ + } else { + as.character(as.numeric_version(tmp)) + } } else { - as.character(as.numeric_version(tmp)) + as.character(object) # numeric version } } ) diff --git a/R/D_swWeather.R b/R/D_swWeather.R index 1ff471b2..dee9b45b 100644 --- a/R/D_swWeather.R +++ b/R/D_swWeather.R @@ -57,10 +57,10 @@ setClass( prototype = list( MonthlyScalingParams = array( NA_real_, - dim = c(12, 6), + dim = c(12, 8), dimnames = list( NULL, - c("PPT", "MaxT", "MinT", "SkyCover", "Wind", "rH") + c("PPT", "MaxT", "MinT", "SkyCover", "Wind", "rH", "ActVP", "ShortWR") ) ) ) @@ -72,10 +72,10 @@ setValidity( val <- TRUE temp <- dim(object@MonthlyScalingParams) - if (temp[2] != 6) { + if (temp[2] != 8) { msg <- paste( - "@MonthlyScalingParams must have exactly 6 columns ", - "corresponding to PPT, MaxT, MinT, SkyCover, Wind, rH" + "@MonthlyScalingParams must have exactly 8 columns ", + "corresponding to PPT, MaxT, MinT, SkyCover, Wind, rH, ActVP, ShortWR" ) val <- if (isTRUE(val)) msg else c(val, msg) } @@ -120,6 +120,52 @@ swMonthlyScalingParams <- function(...) { do.call("new", args = c("swMonthlyScalingParams", tmp)) } +sw_upgrade_MonthlyScalingParams <- function( # nolint: object_length_linter. + MonthlyScalingParams, + verbose = FALSE +) { + if (verbose) { + message("Upgrading object `MonthlyScalingParams`.") + } + + #--- Add new columns (use default values) + default <- swMonthlyScalingParams() + vars_exp <- colnames(default@MonthlyScalingParams) + vars_has <- colnames(MonthlyScalingParams) + + if (!all(vars_exp %in% vars_has)) { + res <- default@MonthlyScalingParams + res[, vars_has] <- MonthlyScalingParams[, vars_has] + res + } else { + MonthlyScalingParams + } +} + + +#' @rdname sw_upgrade +setMethod( + "sw_upgrade", + signature = "swMonthlyScalingParams", + definition = function(object, verbose = FALSE) { + tmp <- try(validObject(object), silent = TRUE) + if (inherits(tmp, "try-error")) { + if (verbose) { + message("Upgrading object of class `swMonthlyScalingParams`.") + } + + object@MonthlyScalingParams <- suppressWarnings( + sw_upgrade_MonthlyScalingParams(object@MonthlyScalingParams) + ) + + #--- Check validity and return + validObject(object) + } + + object + } +) + #####################WEATHERSETUP.IN################################### @@ -163,7 +209,12 @@ setClass( pct_SnowRunoff = "numeric", use_weathergenerator = "logical", use_weathergenerator_only = "logical", - FirstYear_Historical = "integer" + FirstYear_Historical = "integer", + use_cloudCoverMonthly = "logical", + use_windSpeedMonthly = "logical", + use_humidityMonthly = "logical", + desc_rsds = "integer", + dailyInputFlags = "logical" ), # TODO: this class should not contain `swMonthlyScalingParams` but # instead be a composition, i.e., have a slot of that class @@ -174,7 +225,14 @@ setClass( pct_SnowRunoff = NA_real_, use_weathergenerator = NA, use_weathergenerator_only = NA, - FirstYear_Historical = NA_integer_ + FirstYear_Historical = NA_integer_, + use_cloudCoverMonthly = NA, + use_windSpeedMonthly = NA, + use_humidityMonthly = NA, + desc_rsds = NA_integer_, + # NOTE: 14 must be + # equal to rSW2_glovars[["kSOILWAT2"]][["kINT"]][["MAX_INPUT_COLUMNS"]] + dailyInputFlags = rep(NA, 14L) ) ) @@ -185,8 +243,18 @@ setValidity( sns <- setdiff(slotNames("swWeather"), inheritedSlotNames("swWeather")) for (sn in sns) { - if (length(slot(object, sn)) != 1) { - msg <- paste0("@", sn, " must have exactly one value.") + n_exp <- if (sn %in% "dailyInputFlags") { + rSW2_glovars[["kSOILWAT2"]][["kINT"]][["MAX_INPUT_COLUMNS"]] + } else { + 1L + } + + n_has <- length(slot(object, sn)) + + if (n_has != n_exp) { + msg <- paste0( + "@", sn, " has n = ", n_has, " instead of n = ", n_exp, " value(s)." + ) val <- if (isTRUE(val)) msg else c(val, msg) } } @@ -233,6 +301,36 @@ swWeather <- function(...) { } + + +#' @rdname sw_upgrade +setMethod( + "sw_upgrade", + signature = "swWeather", + definition = function(object, verbose = FALSE) { + tmp <- try(validObject(object), silent = TRUE) + if (inherits(tmp, "try-error")) { + # Upgrade `MonthlyScalingParams` with dedicated upgrade method first; + # `swMonthlyScalingParams()` via `swWeather()` cannot handle + # an increased number of columns in `MonthlyScalingParams` otherwise + object@MonthlyScalingParams <- suppressWarnings( + sw_upgrade_MonthlyScalingParams( + object@MonthlyScalingParams, + verbose = verbose + ) + ) + + if (verbose) { + message("Upgrading object of class `swWeather`.") + } + object <- suppressWarnings(swWeather(object)) + } + + object + } +) + + #' @rdname swWeather-class #' @export setMethod( @@ -427,14 +525,22 @@ setMethod( object@pct_SnowRunoff <- readNumeric(infiletext[6]) object@use_weathergenerator <- readLogical(infiletext[7]) object@FirstYear_Historical <- readInteger(infiletext[8]) + object@use_cloudCoverMonthly <- readLogical(infiletext[9]) + object@use_windSpeedMonthly <- readLogical(infiletext[10]) + object@use_relHumidityMonthly <- readLogical(infiletext[11]) + object@desc_rsds <- readLogical(infiletext[12]) + + for (i in seq_len(14)) { + object@dailyInputFlags[i] <- readLogical(infiletext[12 + 1]) + } - data <- matrix(data = c(rep(1, 12), rep(NA, 12 * 5)), nrow = 12, ncol = 6) - colnames(data) <- c("PPT", "MaxT", "MinT", "SkyCover", "Wind", "rH") + data <- matrix(data = c(rep(1, 12), rep(NA, 12 * 5)), nrow = 12, ncol = 8) + colnames(data) <- c("PPT", "MaxT", "MinT", "SkyCover", "Wind", "rH", "actVP", "shortWR") rownames(data) <- c("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December") - for (i in 21:32) { - data[i - 20, ] <- readNumerics(infiletext[i], 8)[2:8] + for (i in 1:12) { + data[i, ] <- readNumerics(infiletext[12 + 14 + i], 8)[2:8] } object@MonthlyScalingParams <- data diff --git a/R/D_swWeatherData.R b/R/D_swWeatherData.R index 7d951f05..7547388e 100644 --- a/R/D_swWeatherData.R +++ b/R/D_swWeatherData.R @@ -23,6 +23,44 @@ ############################################################################## + +#' List names of currently implemented daily weather variables +#' @return A vector of daily weather variable names. +#' @export +weather_dataColumns <- function() { + c( + "Tmax_C", "Tmin_C", "PPT_cm", + "cloudCov_pct", + "windSpeed_mPERs", "windSpeed_east_mPERs", "windSpeed_north_mPERs", + "rHavg_pct", "rHmax_pct", "rHmin_pct", "specHavg_pct", "Tdewpoint_C", + "actVP_kPa", + "shortWR" + ) +} + +#' Functions to summarize currently implemented daily weather variables +#' @return A named vector of functions that summarize +#' daily weather variables across time. +#' @export +weather_dataAggFun <- function() { + c( + "Tmax_C" = mean, + "Tmin_C" = mean, + "PPT_cm" = sum, + "cloudCov_pct" = mean, + "windSpeed_mPERs" = mean, + "windSpeed_east_mPERs" = mean, + "windSpeed_north_mPERs" = mean, + "rHavg_pct" = mean, + "rHmax_pct" = mean, + "rHmin_pct" = mean, + "specHavg_pct" = mean, + "Tdewpoint_C" = mean, + "actVP_kPa" = mean, + "shortWR" = mean + ) +} + #' Class \code{"swWeatherData"} #' #' The methods listed below work on this class and the proper slot of the class @@ -43,9 +81,17 @@ #' (i.e., the \pkg{SOILWAT2} "testing" defaults) are copied. #' @slot year An integer value. The calendar year of the weather \code{data} #' object. -#' @slot data A 365 x 4 or 366 x 4 matrix representing daily weather data for -#' one calendar \code{year} with columns \var{DOY}, \var{Tmax_C}, -#' \var{Tmin_C}, and \var{PPT_cm}. +#' @slot data A 365 x 15 or 366 x 15 matrix representing daily weather data for +#' one calendar \code{year} with columns +#' \var{DOY}, +#' \var{Tmax_C}, \var{Tmin_C}, \var{PPT_cm}, +#' \var{cloudCov_pct}, +#' \var{windSpeed_mPERs}, +#' \var{windSpeed_east_mPERs}, \var{windSpeed_north_mPERs}, +#' \var{rHavg_pct}, \var{rHmax_pct}, \var{rHmin_pct}, +#' \var{specHavg_pct}, \var{Tdewpoint_C}, +#' \var{actVP_kPa}, and +#' \var{shortWR}. #' #' @seealso \code{\linkS4class{swInputData}} \code{\linkS4class{swFiles}} #' \code{\linkS4class{swWeather}} \code{\linkS4class{swCloud}} @@ -66,10 +112,15 @@ setClass( slots = c(data = "matrix", year = "integer"), prototype = list( # NOTE: 999 should be rSW2_glovars[["kSOILWAT2"]][["kNUM"]][["SW_MISSING"]] + # NOTE: 15 must be + # equal to 1 + rSW2_glovars[["kSOILWAT2"]][["kINT"]][["MAX_INPUT_COLUMNS"]] data = array( - data = c(1:366, rep(999, 366 * 3)), - dim = c(366, 4), - dimnames = list(NULL, c("DOY", "Tmax_C", "Tmin_C", "PPT_cm")) + data = c(1:366, rep(NA, 366 * 15L)), + dim = c(366, 15L), + dimnames = list( + NULL, + c("DOY", weather_dataColumns()) + ) ), year = NA_integer_ ) @@ -79,18 +130,26 @@ setValidity( "swWeatherData", function(object) { val <- TRUE + ref <- new("swWeatherData") - if (!(length(object@year) == 1 && isTRUE(is.finite(object@year)) && - isTRUE(object@year >= 0))) { - msg <- "@year must be exactly one positive finite value." + if ( + !( + length(object@year) == 1 && + ( + isTRUE(is.finite(object@year) && object@year >= 0) || + isTRUE(is.na(object@year)) + ) + ) + ) { + msg <- "@year must be exactly one positive value or NA." val <- if (isTRUE(val)) msg else c(val, msg) } tmp <- dim(object@data) - if (tmp[2] != 4) { + if (tmp[2] != ncol(ref@data)) { msg <- paste( - "@data must have exactly 4 columns corresponding to", - "DOY, Tmax_C, Tmin_C, PPT_cm" + "@data must have exactly", ncol(ref@data), "columns corresponding to", + toString(colnames(ref@data)) ) val <- if (isTRUE(val)) msg else c(val, msg) } @@ -130,6 +189,33 @@ swWeatherData <- function(...) { } +#' @rdname sw_upgrade +#' @export +upgrade_weatherHistory <- function(object, verbose = FALSE) { + tmp <- try(dbW_check_weatherData(object, check_all = FALSE), silent = TRUE) + if (inherits(tmp, "try-error") || !isTRUE(tmp)) { + if (verbose) { + message("Upgrading `weatherHistory` object.") + } + + ref <- new("swWeatherData") + + object <- lapply( + object, + function(old) { + new <- ref + new@year <- old@year + new@data <- new@data[seq_len(nrow(old@data)), , drop = FALSE] + new@data[, colnames(old@data)] <- old@data + new + } + ) + } + + object +} + + #' @rdname swWeatherData-class #' @export weatherHistory <- function(weatherList = NULL) { @@ -147,6 +233,9 @@ setMethod( "swReadLines", signature = c(object = "swWeatherData", file = "character"), function(object, file) { + .Deprecated("C_rSW2_readAllWeatherFromDisk") + warning("swReadLines works only with traditional weather data.") + object@year <- as.integer( strsplit( x = basename(file), @@ -161,8 +250,10 @@ setMethod( blank.lines.skip = TRUE, sep = "\t" ) + stopifnot(ncol(data) != 4L) colnames(data) <- c("DOY", "Tmax_C", "Tmin_C", "PPT_cm") - object@data <- as.matrix(data) + object@data[] <- NA + object@data[, colnames(data)] <- as.matrix(data) object }) diff --git a/R/K_swContainer.R b/R/K_swContainer.R index 9899cfc3..825543c9 100644 --- a/R/K_swContainer.R +++ b/R/K_swContainer.R @@ -240,18 +240,26 @@ setMethod( if (!suppressWarnings(check_version(object))) { for (sn in slotNames(object)) { - tmp <- try(validObject(slot(object, sn)), silent = TRUE) - if (inherits(tmp, "try-error")) { - slot(object, sn) <- suppressWarnings( - sw_upgrade(slot(object, sn), verbose = FALSE) - ) - - msg_upgrades <- c(msg_upgrades, sn) + if (identical(sn, "weatherHistory")) { + if (!dbW_check_weatherData(slot(object, sn), check_all = FALSE)) { + slot(object, sn) <- suppressWarnings( + upgrade_weatherHistory(slot(object, sn)) + ) + msg_upgrades <- c(msg_upgrades, sn) + } + + } else { + tmp <- try(validObject(slot(object, sn)), silent = TRUE) + if (inherits(tmp, "try-error")) { + slot(object, sn) <- suppressWarnings( + sw_upgrade(slot(object, sn), verbose = FALSE) + ) + msg_upgrades <- c(msg_upgrades, sn) + } } } - - if (length(msg_upgrades) > 1) { + if (length(msg_upgrades) > 0) { if (verbose) { message( "Upgrading object of class `swInputData`: ", diff --git a/R/Rsw.R b/R/Rsw.R index 750f8d87..315eb5b8 100644 --- a/R/Rsw.R +++ b/R/Rsw.R @@ -73,7 +73,8 @@ sw_verbosity <- function(verbose = TRUE) { #' built-in Markov weather generator (see examples section). If you use the #' weather generator, then you have to provide appropriate values for the input #' (files) \var{mkv_covar.in} and \var{mkv_prob.in} for your simulation run - -#' currently, \pkg{rSOILWAT2} does not contain code to estimate these values. +#' see \code{\link{dbW_estimate_WGen_coefs}} or +#' \code{\link{dbW_generateWeather}}. #' #' @param inputData an object of the \var{S4} class #' \code{\linkS4class{swInputData}} which is generated from @@ -257,7 +258,6 @@ sw_exec <- function( # Upgrade essential slots if input object is from an older version inputData <- sw_upgrade(inputData, verbose = !quiet) - if (!check_version(inputData, level = "minor")) { warning( "Object `inputData is outdated; ", @@ -266,6 +266,19 @@ sw_exec <- function( } + # Upgrade weather data if object is from an outdated version + if (!is.null(weatherList)) { + weatherList <- upgrade_weatherHistory(weatherList, verbose = !quiet) + + if (!dbW_check_weatherData(weatherList)) { + warning( + "Object `weatherList is outdated; ", + "SOILWAT2 may fail or produce unexpected outcomes." + ) + } + } + + #--- Estimate SWRC parameters # if not yet estimated # if requested PTF only implemented in R diff --git a/R/rSOILWAT2_deprecated.R b/R/rSOILWAT2_deprecated.R index 4172fbc8..12956ab1 100644 --- a/R/rSOILWAT2_deprecated.R +++ b/R/rSOILWAT2_deprecated.R @@ -1175,3 +1175,83 @@ estimate_PotNatVeg_composition_old <- function(MAP_mm, MAT_C, Grasses = c3c4ann ) } + + + +## ------ Scanning of SOILWAT input text files ------ +readCharacter <- function(text, showWarnings = FALSE) { + .Deprecated("SOILWAT2's read functionality") + tmp <- strsplit(x = text, split = "\t")[[1]][1] + unlist(strsplit(x = tmp, split = " "))[1] +} + +readInteger <- function(text,showWarnings=FALSE) { + .Deprecated("SOILWAT2's read functionality") + tmp <- suppressWarnings(as.integer(strsplit(x=text,split="\t")[[1]][1])) + if(is.na(tmp)) { + if(showWarnings) print(paste("Line: ",text,sep="")) + if(showWarnings) print("Not formatted with \t. Going to try [space].") + tmp <- suppressWarnings(as.integer(strsplit(x=text,split=" ")[[1]][1])) + if(is.na(tmp)) { + stop("Bad Line. Or Bad line numbers.") + } + } + return(tmp) +} + +readLogical <- function(text,showWarnings=FALSE) { + .Deprecated("SOILWAT2's read functionality") + tmp <- suppressWarnings(as.logical(as.integer(strsplit(x=text,split="\t")[[1]][1]))) + if(is.na(tmp)) { + if(showWarnings) print(paste("Line: ",text,sep="")) + if(showWarnings) print("Not formatted with \t. Going to try [space].") + tmp <- suppressWarnings(as.logical(as.integer(strsplit(x=text,split=" ")[[1]][1]))) + if(is.na(tmp)) { + stop("Bad Line. Or Bad line numbers.") + } + } + return(tmp) +} + +readNumeric <- function(text,showWarnings=FALSE) { + .Deprecated("SOILWAT2's read functionality") + tmp <- suppressWarnings(as.numeric(strsplit(x=text,split="\t")[[1]][1])) + if(is.na(tmp)) { + if(showWarnings) print(paste("Line: ",text,sep="")) + if(showWarnings) print("Not formatted with \t. Going to try [space].") + tmp <- suppressWarnings(as.numeric(strsplit(x=text,split=" ")[[1]][1])) + if(is.na(tmp)) { + stop("Bad Line. Or Bad line numbers.") + } + } + return(tmp) +} + +readNumerics <- function(text,expectedArgs,showWarnings=FALSE) { + .Deprecated("SOILWAT2's read functionality") + tmp <- strsplit(x=text,split="\t")[[1]] + tmp <- tmp[tmp != ""] #get rid of extra spaces + if(length(tmp) > expectedArgs) tmp <- tmp[1:expectedArgs] #get rid of comment? + tmp <- suppressWarnings(as.numeric(tmp)) + if(any(is.na(tmp))) { + if(showWarnings & any(is.na(tmp))) print(paste("Line: ",text,sep="")) + if(showWarnings & any(is.na(tmp))) print("Not formatted with \t. Going to try [space].") + tmp <- strsplit(x=text,split="\t")[[1]][1] #remove comment + tmp <- strsplit(x=tmp,split=" ")[[1]] + tmp <- tmp[tmp!=""] #remove extra spaces + tmp <- suppressWarnings(as.numeric(tmp[1:expectedArgs])) + if(any(is.na(tmp))) { + #last try. tried set by \t then by space. Now try both + tmp <- strsplit(x=text,split=" ",fixed=T)[[1]] + tmp <- unlist(strsplit(x=tmp,split="\t",fixed=T)) + tmp <- tmp[tmp!=""] #remove extra spaces + tmp <- suppressWarnings(as.numeric(tmp[1:expectedArgs])) + if(any(is.na(tmp))) stop("Bad Line. Or Bad line numbers.") + } + } + if(length(tmp) != expectedArgs) { + if(showWarnings) print(paste("Line: ",text,sep="")) + stop(paste("Expected ",expectedArgs," Got ",length(tmp),sep="")) + } + return(tmp) +} diff --git a/R/swWeatherGenerator.R b/R/swWeatherGenerator.R index 785bb7c7..5a983c0d 100644 --- a/R/swWeatherGenerator.R +++ b/R/swWeatherGenerator.R @@ -18,6 +18,13 @@ ############################################################################### +#' List daily weather variables incorporated in the weather generator +#' @export +weatherGenerator_dataColumns <- function() { + c("Tmax_C", "Tmin_C", "PPT_cm") +} + + #' Estimate coefficients for use by \var{SOILWAT2} weather generator #' #' Estimates coefficients for the two site-specific files @@ -1025,6 +1032,14 @@ compare_weather <- function( #' #' @return A list of elements of class \code{\linkS4class{swWeatherData}}. #' +#' @section Details: +#' The current implementation of the weather generator produces values +#' only for variables in [weatherGenerator_dataColumns()]. +#' Values are generated for those days where at least one of the implemented +#' variables is missing; if any value is missing, then values for that day of +#' all implemented variables will be replaced by those produced +#' by the weather generator. +#' #' @examples #' # Load data for 1949-2010 #' wdata <- data.frame(dbW_weatherData_to_dataframe(rSOILWAT2::weatherData)) @@ -1078,6 +1093,7 @@ compare_weather <- function( #' ) #' unlink(list.files(path), force = TRUE) #' +#' @md #' @export dbW_generateWeather <- function( weatherData, @@ -1117,13 +1133,25 @@ dbW_generateWeather <- function( swYears_EndYear(sw_in) <- max(years) swYears_StartYear(sw_in) <- min(years) - # Turn on weather generator + # Turn on weather generator (to fill in missing values) swWeather_UseMarkov(sw_in) <- TRUE + swWeather_UseMarkovOnly(sw_in) <- FALSE # Set weather generator coefficients swMarkov_Prob(sw_in) <- wgen_coeffs[["mkv_doy"]] swMarkov_Conv(sw_in) <- wgen_coeffs[["mkv_woy"]] + # Turn off monthly use flags + sw_in@weather@use_cloudCoverMonthly <- FALSE + sw_in@weather@use_humidityMonthly <- FALSE + sw_in@weather@use_windSpeedMonthly <- FALSE + + # Specify available daily input variables + # and prescribe Tmax, Tmin, PPT + dif <- calc_dailyInputFlags(weatherData) + dif[weatherGenerator_dataColumns()] <- TRUE + sw_in@weather@dailyInputFlags <- dif + #--- Process weather in SOILWAT2 set.seed(seed) diff --git a/R/sw_dbW_WeatherDatabase.R b/R/sw_dbW_WeatherDatabase.R index fcc3fb3b..9b485f3c 100644 --- a/R/sw_dbW_WeatherDatabase.R +++ b/R/sw_dbW_WeatherDatabase.R @@ -32,10 +32,9 @@ #' days and columns represent the weather variables #' (see `weatherDF_dataColumns`). #' @param weatherDF_dataColumns A vector of character strings. The column -#' names of `weatherDF` in the correct order for `SOILWAT2` that are -#' representing calendar year `year` (optional), day of year `DOY`, -#' daily maximum air temperature `Tmax_C`, daily minimum air temperature -#' `Tmin_C`, and daily precipitation amount `PPT_cm`. +#' names of `weatherDF` in the correct order for `SOILWAT2` including +#' calendar year `year` (optional) and day of year `DOY`, see +#' [weather_dataColumns()]. #' #' #' @param years A numeric vector. The calendar years. @@ -1943,6 +1942,10 @@ dbW_weatherData_to_blob <- function(weatherData, type = "gzip") { #' \var{weath}. #' @param startYear Numeric. Extracted weather data will start with this year. #' @param endYear Numeric. Extracted weather data will end with this year. +#' @param dailyInputFlags A logical vector of length `MAX_INPUT_COLUMNS`, +#' see `"weathsetup.in"`. +#' @param method A character string. `"R"` uses code in `R` to read files as-is +#' whereas `"C"` uses `"SOILWAT2"` code to read and process files. #' #' @return A list of elements of class \code{\linkS4class{swWeatherData}}. #' @@ -1957,21 +1960,48 @@ dbW_weatherData_to_blob <- function(weatherData, type = "gzip") { #' path_demo <- system.file("extdata", "example1", package = "rSOILWAT2") #' #' ## ------ Simulation with data prepared beforehand and separate weather data -#' ## Read inputs from files on disk +#' ## Read inputs from files on disk (via SOILWAT2) #' sw_in3 <- sw_inputDataFromFiles(dir = path_demo, files.in = "files.in") #' -#' ## Read forcing weather data from files on disk (there are also functions -#' ## to set up a SQLite database for the weather data) -#' sw_weath3 <- getWeatherData_folders( -#' LookupWeatherFolder = file.path(path_demo, "Input"), -#' weatherDirName = "data_weather", filebasename = "weath", -#' startYear = 1979, endYear = 2010) +#' ## Read forcing weather data from files on disk (via SOILWAT2) +#' sw_weath3c <- getWeatherData_folders( +#' LookupWeatherFolder = file.path(path_demo, "Input"), +#' weatherDirName = "data_weather", +#' filebasename = "weath", +#' startYear = 1979, +#' endYear = 2010, +#' method = "C" +#' ) +#' +#' ## Read forcing weather data from files on disk (via R) +#' sw_weath3r <- getWeatherData_folders( +#' LookupWeatherFolder = file.path(path_demo, "Input"), +#' weatherDirName = "data_weather", +#' filebasename = "weath", +#' startYear = 1979, +#' endYear = 2010, +#' method = "R" +#' ) +#' +#' ## Weather data (for the non-calculated variables) should be identical +#' identical( +#' sw_weath3c[[1L]]@data[, 1:4], +#' rSOILWAT2::get_WeatherHistory(sw_in3)[[1L]]@data[, 1:4] +#' ) +#' identical( +#' sw_weath3r[[1L]]@data[, 1:4], +#' rSOILWAT2::get_WeatherHistory(sw_in3)[[1L]]@data[, 1:4] +#' ) #' #' ## List of the slots of the input objects of class 'swWeatherData' -#' utils::str(sw_weath3, max.level=1) +#' utils::str(sw_weath3c, max.level = 1) +#' utils::str(sw_weath3r, max.level = 1) #' #' ## Execute the simulation run -#' sw_out3 <- sw_exec(inputData = sw_in3, weatherList = sw_weath3) +#' sw_out3c <- sw_exec(inputData = sw_in3, weatherList = sw_weath3c) +#' sw_out3r <- sw_exec(inputData = sw_in3, weatherList = sw_weath3r) +#' +#' all.equal(sw_out3c, sw_out3r) #' #' @export #' @md @@ -1980,9 +2010,13 @@ getWeatherData_folders <- function( weatherDirName = NULL, filebasename = "weath", startYear = NULL, - endYear = NULL + endYear = NULL, + dailyInputFlags = c(rep(TRUE, 3L), rep(FALSE, 11L)), + method = c("R", "C") ) { + method <- match.arg(method) + if (is.null(LookupWeatherFolder) || is.null(filebasename)) { stop( "Need 'LookupWeatherFolder' and 'filebasename' ", @@ -1990,6 +2024,13 @@ getWeatherData_folders <- function( ) } + stopifnot( + identical( + length(dailyInputFlags), + rSW2_glovars[["kSOILWAT2"]][["kINT"]][["MAX_INPUT_COLUMNS"]] + ) + ) + dir_weather <- if (is.null(weatherDirName)) { LookupWeatherFolder } else { @@ -2002,23 +2043,54 @@ getWeatherData_folders <- function( } ) - if (!endsWith(filebasename, ".")) { - filebasename <- paste0(filebasename, ".") + if (endsWith(filebasename, ".")) { + # remove trailing "." + filebasename <- sub("\\.$", "", filebasename) } - years <- as.numeric(sub(pattern = filebasename, replacement = "", fweath)) + + years <- as.integer( + sub(pattern = paste0(filebasename, "."), replacement = "", fweath) + ) stopifnot(!anyNA(years)) - index <- select_years(years, startYear, endYear) + ids <- select_years(years, startYear, endYear) + used_years <- years[ids] + + if (method == "C") { + .Call( + C_rSW2_readAllWeatherFromDisk, + dir_weather, + filebasename, + used_years[[1L]], + used_years[[length(used_years)]], + dailyInputFlags + ) - weathDataList <- list() - for (k in seq_along(index)) { - weathDataList[[k]] <- swReadLines( - swWeatherData(year = years[index[k]]), - file.path(dir_weather, fweath[index[k]]) + } else if (method == "R") { + ids_cols <- c(1L, 1L + which(dailyInputFlags)) + + res <- mapply( + function(fname, yr) { + object <- new("swWeatherData") + object@year <- yr + data <- utils::read.table( + fname, + header = FALSE, + comment.char = "#", + blank.lines.skip = TRUE, + sep = "\t" + ) + stopifnot(ncol(data) %in% (0:1 + sum(dailyInputFlags))) + object@data <- object@data[seq_len(nrow(data)), , drop = FALSE] + object@data[, ids_cols] <- as.matrix(data) + object + }, + file.path(dir_weather, fweath[ids]), + used_years, + SIMPLIFY = FALSE ) - } - names(weathDataList) <- as.character(years[index]) - weathDataList + stats::setNames(res, as.character(used_years)) + } } @@ -2049,6 +2121,37 @@ set_missing_weather <- function(data, valNA = NULL) { data } +#' Check which weather values are missing +#' +#' @param x A two-dimensional numeric object. +#' +#' @return A logical object with same dimensions as `x` +#' +#' @examples +#' x <- data.frame( +#' Tmax = c(-1.5, 2, NA, 999), +#' Tmin = c(-5, NaN, 999, -5) +#' ) +#' +#' is_missing_weather(x) +#' +#' @md +#' @export +is_missing_weather <- function(x) { + x <- as.matrix(x) + + vals_missing <- c( + NA, + NaN, + rSW2_glovars[["kSOILWAT2"]][["kNUM"]][["SW_MISSING"]] + ) + + array( + data = x %in% vals_missing, + dim = dim(x), + dimnames = dimnames(x) + ) +} #' Convert an object of class \code{\linkS4class{swWeatherData}} to a data.frame #' @@ -2084,7 +2187,7 @@ dbW_weatherData_to_dataframe <- function(weatherData, valNA = NULL) { dbW_weatherData_round <- function( weatherData, digits = 4L, - weatherDF_dataColumns = c("Tmax_C", "Tmin_C", "PPT_cm") + weatherDF_dataColumns = weather_dataColumns() ) { lapply( weatherData, @@ -2106,6 +2209,8 @@ dbW_weatherData_round <- function( #' @param time_step A character string. #' @param na.rm A logical value. Should missing daily values be removed before #' calculating monthly temperature and precipitation. +#' @param funs A named vector of functions. The names must match column names +#' in `dailySW` and the function are used to summarize daily weather values. #' #' @md #' @name dbW_temporal_summaries @@ -2113,11 +2218,18 @@ NULL #' @rdname dbW_temporal_summaries #' @export -dbW_weatherData_to_monthly <- function(dailySW, na.rm = FALSE, valNA = NULL) { +dbW_weatherData_to_monthly <- function( + dailySW, + na.rm = FALSE, + valNA = NULL, + funs = weather_dataAggFun() +) { + vars <- names(funs) + monthly <- matrix( nrow = length(dailySW) * 12, - ncol = 5, - dimnames = list(NULL, c("Year", "Month", "Tmax_C", "Tmin_C", "PPT_cm")) + ncol = 2 + length(vars), + dimnames = list(NULL, c("Year", "Month", vars)) ) for (y in seq_along(dailySW)) { @@ -2127,19 +2239,16 @@ dbW_weatherData_to_monthly <- function(dailySW, na.rm = FALSE, valNA = NULL) { format = "%Y-%j", tz = "UTC" )$mon + 1 tmp <- set_missing_weather(weath@data, valNA = valNA) - monthly[1:12 + 12 * (y - 1), ] <- data.matrix(cbind( - Year = weath@year, - Month = 1:12, - aggregate( - tmp[, c("Tmax_C", "Tmin_C")], - by = list(month), - FUN = mean, - na.rm = na.rm - )[, 2:3], - PPT_cm = as.vector( - tapply(tmp[, "PPT_cm"], month, FUN = sum, na.rm = na.rm) + + ids <- 1:12 + 12 * (y - 1) + monthly[ids, "Year"] <- weath@year + monthly[ids, "Month"] <- seq_len(12L) + + for (var in vars) { + monthly[ids, var] <- as.vector( + tapply(tmp[, var], month, FUN = funs[[var]], na.rm = na.rm) ) - )) + } } monthly @@ -2151,7 +2260,8 @@ dbW_weatherData_to_monthly <- function(dailySW, na.rm = FALSE, valNA = NULL) { dbW_dataframe_aggregate <- function( dailySW, time_step = c("Year", "Month", "Week", "Day"), - na.rm = FALSE + na.rm = FALSE, + funs = weather_dataAggFun() ) { time_step <- match.arg(time_step) @@ -2190,18 +2300,22 @@ dbW_dataframe_aggregate <- function( ) } - as.matrix(cbind( - hout, - Tmax_C = as.vector( - tapply(dailySW[, "Tmax_C"], INDEX = idaggs, FUN = mean, na.rm = na.rm) - ), - Tmin_C = as.vector( - tapply(dailySW[, "Tmin_C"], INDEX = idaggs, FUN = mean, na.rm = na.rm) - ), - PPT_cm = as.vector( - tapply(dailySW[, "PPT_cm"], INDEX = idaggs, FUN = sum, na.rm = na.rm) + vars <- names(funs) + + res <- as.matrix( + cbind( + hout, + matrix(ncol = length(vars), dimnames = list(NULL, vars)) ) - )) + ) + + for (var in vars) { + res[, var] <- as.vector( + tapply(dailySW[, var], INDEX = idaggs, FUN = funs[[var]], na.rm = na.rm) + ) + } + + res } #' @rdname dbW_temporal_summaries @@ -2287,20 +2401,18 @@ get_years_from_weatherDF <- function(weatherDF, years, weatherDF_dataColumns) { dbW_dataframe_to_weatherData <- function( weatherDF, years = NULL, - weatherDF_dataColumns = c("DOY", "Tmax_C", "Tmin_C", "PPT_cm"), + weatherDF_dataColumns = c("DOY", weather_dataColumns()), round = 2 ) { if ( - !(length(weatherDF_dataColumns) == 4) || - !all(weatherDF_dataColumns %in% colnames(weatherDF)) + !all(weatherDF_dataColumns %in% colnames(weatherDF)) ) { stop( - "Not every required weatherDF_dataColumns is available in the ", + "Not every weatherDF_dataColumns is available in the ", "'weatherDF' object" ) } - ylist <- get_years_from_weatherDF(weatherDF, years, weatherDF_dataColumns) if (isTRUE(is.logical(round) && round || is.numeric(round))) { @@ -2310,10 +2422,12 @@ dbW_dataframe_to_weatherData <- function( weatherData <- list() for (i in seq_along(ylist$years)) { ydata <- as.matrix( - weatherDF[ylist$year_ts == ylist$years[i], - weatherDF_dataColumns] + weatherDF[ + ylist$year_ts == ylist$years[i], + weatherDF_dataColumns + ] ) - colnames(ydata) <- c("DOY", "Tmax_C", "Tmin_C", "PPT_cm") + colnames(ydata) <- c("DOY", weather_dataColumns()) weatherData[[i]] <- swWeatherData( year = ylist$years[i], data = ydata @@ -2355,7 +2469,8 @@ dbW_weather_to_SOILWATfiles <- function( weatherData = NULL, weatherDF = NULL, years = NULL, - weatherDF_dataColumns = c("DOY", "Tmax_C", "Tmin_C", "PPT_cm") + weatherDF_dataColumns = c("DOY", weather_dataColumns()), + digits = 4L ) { stopifnot(is.null(weatherData) || is.null(weatherDF)) @@ -2366,11 +2481,10 @@ dbW_weather_to_SOILWATfiles <- function( } else if (!is.null(weatherDF)) { if ( - !(length(weatherDF_dataColumns) == 4) || !all(weatherDF_dataColumns %in% colnames(weatherDF)) ) { stop( - "Not every required weatherDF_dataColumns is available in the ", + "Not every weatherDF_dataColumns is available in the ", "'weatherDF' object" ) } @@ -2395,7 +2509,7 @@ dbW_weather_to_SOILWATfiles <- function( sw.filename <- file.path(path, paste0("weath.", years[y])) sw.comments <- c( paste("# weather for site", site.label, "year = ", years[y]), - "# DOY Tmax(C) Tmin(C) PPT(cm)" + paste0("# ", toString(weatherDF_dataColumns)) ) utils::write.table( @@ -2408,14 +2522,21 @@ dbW_weather_to_SOILWATfiles <- function( col.names = FALSE ) - utils::write.table( - data.frame( - data.sw[, 1], - formatC(data.sw[, 2], digits = 2, format = "f"), - formatC(data.sw[, 3], digits = 2, format = "f"), - formatC(data.sw[, 4], digits = 2, format = "f"), - stringsAsFactors = FALSE + tmp <- data.frame( + data.sw[, 1], + matrix( + data = NA_character_, + ncol = length(weatherDF_dataColumns) - 1L ), + stringsAsFactors = FALSE + ) + + for (kv in seq_along(weatherDF_dataColumns)[-1]) { + tmp[, kv] <- formatC(data.sw[, kv], digits = digits, format = "f") + } + + utils::write.table( + tmp, file = sw.filename, append = TRUE, sep = "\t", @@ -2503,7 +2624,7 @@ dbW_convert_to_GregorianYears <- function( type = c("asis", "sequential"), name_year = "Year", name_DOY = "DOY", - name_data = c("Tmax_C", "Tmin_C", "PPT_cm"), + name_data = weather_dataColumns(), valNA = NULL ) { @@ -2551,19 +2672,23 @@ dbW_convert_to_GregorianYears <- function( wdata2 <- data.frame( Year = 1900 + tdays1$year, DOY = 1 + tdays1$yday, - var1 = NA, - var2 = NA, - var3 = NA + matrix(ncol = length(name_data)), + stringsAsFactors = FALSE ) colnames(wdata2) <- c(name_year, name_DOY, name_data) # Transfer existing values - tmp <- apply(wdata[, c(name_year, name_DOY)], 1, paste, collapse = "/") + tmp <- apply( + wdata[, c(name_year, name_DOY), drop = FALSE], + MARGIN = 1, + FUN = paste, + collapse = "/" + ) id_xdf <- format(as.Date(tmp, format = "%Y/%j")) id_xdf2 <- format(as.Date(tdays)) id_match <- match(id_xdf2, id_xdf, nomatch = 0) - wdata2[id_match > 0, name_data] <- wdata[id_match, name_data] + wdata2[id_match > 0, name_data] <- wdata[id_match, name_data, drop = FALSE] wdata2 } @@ -2577,94 +2702,83 @@ dbW_convert_to_GregorianYears <- function( #' represents daily data for one Gregorian year #' #' @param x An object. +#' @param check_all A logical value #' #' @return A logical value. #' +#' @examples +#' dbW_check_weatherData(rSOILWAT2::weatherData) +#' dbW_check_weatherData(weatherHistory()) +#' dbW_check_weatherData(weatherHistory(), check_all = FALSE) +#' +#' #' @export -dbW_check_weatherData <- function(x) { - length(x) > 0 && - inherits(x, "list") && - all(sapply(x, inherits, what = "swWeatherData")) && - isTRUE(all.equal( - unname(sapply(x, function(xyr) nrow(slot(xyr, "data")))), - 365 + as.integer( - rSW2utils::isLeapYear(sapply(x, slot, name = "year")) +dbW_check_weatherData <- function(x, check_all = TRUE) { + res <- + length(x) > 0 && + inherits(x, "list") && + all(vapply(x, inherits, what = "swWeatherData", FUN.VALUE = NA)) && + all( + vapply( + x, + FUN = function(object) { + isTRUE(is.logical(validObject(object, test = TRUE))) + }, + FUN.VALUE = NA + ) ) - )) -} -# nolint start -## ------ Scanning of SOILWAT input text files ------ -readCharacter <- function(text, showWarnings = FALSE) { - tmp <- strsplit(x = text, split = "\t")[[1]][1] - unlist(strsplit(x = tmp, split = " "))[1] -} + if (res) { + yrs <- vapply(x, slot, name = "year", FUN.VALUE = NA_integer_) + ids_check <- !is.na(yrs) -readInteger <- function(text,showWarnings=FALSE) { - tmp <- suppressWarnings(as.integer(strsplit(x=text,split="\t")[[1]][1])) - if(is.na(tmp)) { - if(showWarnings) print(paste("Line: ",text,sep="")) - if(showWarnings) print("Not formatted with \t. Going to try [space].") - tmp <- suppressWarnings(as.integer(strsplit(x=text,split=" ")[[1]][1])) - if(is.na(tmp)) { - stop("Bad Line. Or Bad line numbers.") - } - } - return(tmp) -} + if (isTRUE(check_all) || sum(ids_check) > 0) { + if (isTRUE(check_all)) { + ids_check <- seq_along(x) + } -readLogical <- function(text,showWarnings=FALSE) { - tmp <- suppressWarnings(as.logical(as.integer(strsplit(x=text,split="\t")[[1]][1]))) - if(is.na(tmp)) { - if(showWarnings) print(paste("Line: ",text,sep="")) - if(showWarnings) print("Not formatted with \t. Going to try [space].") - tmp <- suppressWarnings(as.logical(as.integer(strsplit(x=text,split=" ")[[1]][1]))) - if(is.na(tmp)) { - stop("Bad Line. Or Bad line numbers.") - } - } - return(tmp) -} + has_days <- vapply( + x[ids_check], + function(xyr) nrow(slot(xyr, "data")), + FUN.VALUE = NA_integer_ + ) + expected_days <- 365L + as.integer(rSW2utils::isLeapYear(yrs[ids_check])) -readNumeric <- function(text,showWarnings=FALSE) { - tmp <- suppressWarnings(as.numeric(strsplit(x=text,split="\t")[[1]][1])) - if(is.na(tmp)) { - if(showWarnings) print(paste("Line: ",text,sep="")) - if(showWarnings) print("Not formatted with \t. Going to try [space].") - tmp <- suppressWarnings(as.numeric(strsplit(x=text,split=" ")[[1]][1])) - if(is.na(tmp)) { - stop("Bad Line. Or Bad line numbers.") + res <- res && identical(unname(has_days), expected_days) } } - return(tmp) + + res } -readNumerics <- function(text,expectedArgs,showWarnings=FALSE) { - tmp <- strsplit(x=text,split="\t")[[1]] - tmp <- tmp[tmp != ""] #get rid of extra spaces - if(length(tmp) > expectedArgs) tmp <- tmp[1:expectedArgs] #get rid of comment? - tmp <- suppressWarnings(as.numeric(tmp)) - if(any(is.na(tmp))) { - if(showWarnings & any(is.na(tmp))) print(paste("Line: ",text,sep="")) - if(showWarnings & any(is.na(tmp))) print("Not formatted with \t. Going to try [space].") - tmp <- strsplit(x=text,split="\t")[[1]][1] #remove comment - tmp <- strsplit(x=tmp,split=" ")[[1]] - tmp <- tmp[tmp!=""] #remove extra spaces - tmp <- suppressWarnings(as.numeric(tmp[1:expectedArgs])) - if(any(is.na(tmp))) { - #last try. tried set by \t then by space. Now try both - tmp <- strsplit(x=text,split=" ",fixed=T)[[1]] - tmp <- unlist(strsplit(x=tmp,split="\t",fixed=T)) - tmp <- tmp[tmp!=""] #remove extra spaces - tmp <- suppressWarnings(as.numeric(tmp[1:expectedArgs])) - if(any(is.na(tmp))) stop("Bad Line. Or Bad line numbers.") - } - } - if(length(tmp) != expectedArgs) { - if(showWarnings) print(paste("Line: ",text,sep="")) - stop(paste("Expected ",expectedArgs," Got ",length(tmp),sep="")) + +#' Determine used weather variables based on values +#' +#' @param x Weather data, i.e., +#' a list where each element is of class [`swWeatherData`], or +#' a data frame with appropriate columns (see [dbW_weatherData_to_dataframe()]). +#' @param name_data A vector of character strings. The column names of `x` +#' with weather variables. +#' +#' @return A logical vector for each of the possible input variables with +#' `TRUE` if at least one value is not missing. +#' +#' @examples +#' calc_dailyInputFlags(rSOILWAT2::weatherData) +#' calc_dailyInputFlags(dbW_weatherData_to_dataframe(rSOILWAT2::weatherData)) +#' +#' +#' @md +#' @export +calc_dailyInputFlags <- function(x, name_data = weather_dataColumns()) { + if (isTRUE(dbW_check_weatherData(x, check_all = FALSE))) { + x <- dbW_weatherData_to_dataframe(x) } - return(tmp) + + apply( + !is_missing_weather(x[, name_data, drop = FALSE]), + MARGIN = 2L, + FUN = any + ) } -# nolint end diff --git a/data-raw/prepare_testInput_objects.R b/data-raw/prepare_testInput_objects.R index 9ff76222..01564ecb 100755 --- a/data-raw/prepare_testInput_objects.R +++ b/data-raw/prepare_testInput_objects.R @@ -102,9 +102,9 @@ for (k in seq_along(list_backups)) { #------ Helper functions ----- -compare_objects <- function(new, old) { +compare_objects <- function(new, old, tolerance = 1e-9) { # Compare to previous version - res_cmp <- waldo::compare(old, new) + res_cmp <- waldo::compare(old, new, tolerance = tolerance) # Ignore "timestamp" has_timestamp_diff <- grepl("timestamp", res_cmp, fixed = TRUE) @@ -339,6 +339,8 @@ for (it in seq_along(tests)) { slot(sw_input, "weatherHistory") } + stopifnot(rSOILWAT2::dbW_check_weatherData(sw_weather)) + #--- Compare weather to previous version res_cmp <- waldo::compare( readRDS( diff --git a/data-raw/prepare_weatherData_object.R b/data-raw/prepare_weatherData_object.R index a6957472..dbc6714e 100755 --- a/data-raw/prepare_weatherData_object.R +++ b/data-raw/prepare_weatherData_object.R @@ -23,4 +23,6 @@ weatherData <- rSOILWAT2::getWeatherData_folders( filebasename = "weath" ) +stopifnot(rSOILWAT2::dbW_check_weatherData(weatherData)) + usethis::use_data(weatherData, internal = FALSE) # nolint: namespace_linter. diff --git a/data/sw_exampleData.rda b/data/sw_exampleData.rda index 1635b84e..dc107750 100644 Binary files a/data/sw_exampleData.rda and b/data/sw_exampleData.rda differ diff --git a/data/weatherData.rda b/data/weatherData.rda index e08e2b36..ef512a39 100644 Binary files a/data/weatherData.rda and b/data/weatherData.rda differ diff --git a/inst/extdata/example1/Input/data_weather_daymet/weath.1980 b/inst/extdata/example1/Input/data_weather_daymet/weath.1980 new file mode 100644 index 00000000..ff9cfa49 --- /dev/null +++ b/inst/extdata/example1/Input/data_weather_daymet/weath.1980 @@ -0,0 +1,368 @@ +# weather for site daymet example at -105.58 / 39.59 year = 1980 +# DOY, Tmax_C, Tmin_C, PPT_cm, vp_kPa, rsds_WPERm2 +1 -0.37 -9.20 0.28 0.30 160.21 +2 -4.78 -14.96 0.35 0.19 179.14 +3 -3.79 -18.36 0.00 0.13 283.01 +4 -1.30 -11.12 0.00 0.25 230.08 +5 3.08 -8.41 0.00 0.27 253.18 +6 -5.61 -10.70 0.00 0.27 137.65 +7 -8.23 -17.36 0.67 0.16 171.22 +8 -3.68 -17.02 0.31 0.16 215.17 +9 1.01 -12.80 0.36 0.23 219.36 +10 -3.06 -9.67 0.57 0.29 135.10 +11 -1.79 -19.50 0.00 0.13 317.62 +12 -0.30 -13.73 0.54 0.21 222.45 +13 1.26 -6.50 0.00 0.38 205.60 +14 2.69 -5.21 0.00 0.41 208.96 +15 -0.81 -9.70 0.00 0.29 231.93 +16 -1.36 -14.57 0.00 0.20 296.91 +17 -1.22 -13.83 0.00 0.21 292.40 +18 -7.26 -15.12 0.70 0.19 166.46 +19 -5.09 -17.63 0.00 0.15 298.45 +20 0.53 -14.62 0.00 0.20 324.21 +21 -2.89 -14.40 0.00 0.20 288.61 +22 -4.01 -20.04 0.00 0.12 337.75 +23 0.15 -17.90 0.00 0.15 350.72 +24 3.75 -11.23 0.00 0.25 332.46 +25 -3.21 -10.99 0.49 0.26 173.65 +26 -10.02 -23.09 0.39 0.10 248.51 +27 -5.48 -17.48 0.12 0.15 314.07 +28 -6.69 -18.95 0.27 0.14 244.74 +29 -4.01 -16.48 0.29 0.17 248.87 +30 -5.41 -15.51 0.54 0.18 222.64 +31 1.22 -18.80 0.00 0.14 387.42 +32 -0.07 -15.41 0.00 0.18 361.83 +33 -0.65 -9.10 0.00 0.31 257.91 +34 4.30 -7.15 0.00 0.36 317.39 +35 0.21 -6.28 0.00 0.38 211.96 +36 1.02 -10.30 0.00 0.28 322.83 +37 4.99 -9.69 0.00 0.28 368.80 +38 -4.79 -11.23 1.09 0.26 164.79 +39 -2.02 -23.78 0.00 0.09 426.90 +40 0.21 -21.39 0.00 0.11 427.85 +41 0.94 -16.41 0.00 0.17 407.83 +42 -1.09 -17.11 0.00 0.16 399.48 +43 -0.76 -15.28 0.00 0.19 382.90 +44 1.31 -12.04 0.00 0.24 366.80 +45 4.35 -11.54 0.00 0.23 399.98 +46 0.11 -7.11 0.06 0.36 236.38 +47 0.66 -9.39 0.00 0.30 313.71 +48 0.53 -12.77 0.00 0.22 378.66 +49 1.24 -8.00 0.38 0.33 225.90 +50 1.85 -7.81 0.00 0.34 314.88 +51 -0.41 -7.88 0.00 0.34 260.39 +52 -0.49 -6.47 0.00 0.38 220.52 +53 -2.40 -11.30 0.00 0.26 319.19 +54 -3.84 -11.40 0.29 0.26 217.13 +55 -4.72 -13.35 0.00 0.22 322.80 +56 3.77 -13.94 0.00 0.18 479.35 +57 4.28 -9.70 0.00 0.26 439.03 +58 8.00 -10.93 0.00 0.21 492.09 +59 11.31 -5.17 0.00 0.32 470.39 +60 1.20 -7.16 0.28 0.36 238.18 +61 1.49 -17.55 0.00 0.13 509.16 +62 4.80 -12.69 0.00 0.19 498.46 +63 3.96 -5.71 0.00 0.38 359.98 +64 -1.76 -9.96 0.19 0.29 324.01 +65 0.85 -10.32 0.12 0.26 407.37 +66 1.16 -8.36 0.58 0.33 277.35 +67 -2.02 -10.27 0.88 0.28 255.68 +68 -1.89 -14.65 0.00 0.20 461.08 +69 -4.09 -13.99 0.00 0.21 402.17 +70 2.61 -8.83 0.00 0.29 450.49 +71 3.09 -11.44 0.00 0.22 517.76 +72 -4.28 -11.58 0.00 0.25 338.37 +73 0.36 -15.45 0.00 0.16 548.45 +74 5.66 -9.32 0.00 0.24 537.70 +75 3.95 -4.68 0.00 0.41 393.45 +76 -5.61 -13.72 0.97 0.21 289.64 +77 2.84 -21.70 0.00 0.09 618.91 +78 5.47 -11.21 0.00 0.21 574.09 +79 1.56 -8.19 0.00 0.32 431.33 +80 1.43 -13.38 0.00 0.19 554.01 +81 4.96 -10.45 0.00 0.23 560.44 +82 -3.43 -10.32 0.35 0.28 244.31 +83 -2.51 -14.53 0.00 0.20 499.92 +84 0.03 -15.70 0.00 0.16 573.30 +85 -0.59 -11.09 0.12 0.26 453.12 +86 -4.00 -15.90 0.00 0.18 503.90 +87 -2.18 -13.98 0.63 0.21 380.74 +88 -6.52 -12.29 0.80 0.24 222.23 +89 -3.92 -15.95 0.00 0.18 537.04 +90 1.30 -14.05 0.47 0.21 454.23 +91 -5.25 -9.90 0.76 0.29 191.83 +92 -6.20 -17.85 0.74 0.15 416.37 +93 -4.78 -14.89 0.44 0.19 382.41 +94 -1.89 -17.05 0.00 0.16 633.52 +95 4.71 -11.30 0.00 0.23 643.26 +96 5.55 -9.18 0.00 0.27 619.53 +97 1.75 -10.11 0.00 0.27 553.30 +98 -2.39 -13.20 0.32 0.22 395.94 +99 -0.65 -15.84 0.00 0.17 638.42 +100 4.96 -9.01 0.00 0.27 610.26 +101 0.59 -7.48 0.56 0.35 318.67 +102 -1.99 -8.69 1.15 0.32 275.89 +103 -3.12 -20.97 0.45 0.11 526.79 +104 -1.13 -20.03 0.00 0.12 715.07 +105 5.83 -11.08 0.00 0.22 684.63 +106 7.01 -7.52 0.00 0.29 635.65 +107 3.67 -7.28 0.00 0.33 548.54 +108 9.57 -10.53 0.00 0.21 730.03 +109 11.41 -5.58 0.00 0.30 689.78 +110 12.16 -4.29 0.00 0.32 680.45 +111 12.30 -2.62 0.00 0.38 651.22 +112 12.71 -1.08 0.00 0.43 618.53 +113 10.48 -1.81 0.00 0.43 579.14 +114 4.56 -1.05 2.42 0.57 230.59 +115 -2.92 -5.64 2.62 0.40 127.23 +116 0.25 -13.05 1.33 0.22 479.09 +117 1.56 -10.67 0.70 0.27 458.27 +118 6.14 -9.27 0.00 0.29 685.49 +119 9.08 -6.38 0.00 0.34 682.40 +120 9.69 -2.82 0.00 0.46 606.67 +121 1.71 -3.16 2.01 0.48 207.60 +122 1.97 -7.38 2.43 0.35 381.13 +123 5.11 -6.91 2.10 0.36 462.03 +124 8.67 -4.91 1.62 0.42 496.72 +125 8.89 -3.47 0.00 0.47 630.90 +126 6.97 -1.79 0.98 0.54 370.57 +127 8.40 -2.26 0.29 0.52 431.89 +128 7.01 -1.65 1.00 0.54 370.11 +129 4.44 -1.94 0.79 0.53 290.12 +130 7.68 -2.75 0.00 0.50 585.74 +131 8.40 -2.36 0.00 0.51 595.07 +132 4.42 -2.41 0.36 0.51 309.53 +133 1.01 -8.21 0.44 0.33 411.83 +134 5.89 -8.34 0.20 0.33 726.56 +135 4.51 -6.03 0.63 0.39 463.59 +136 0.67 -3.80 1.02 0.46 229.75 +137 0.97 -5.05 0.66 0.42 306.47 +138 -0.21 -4.98 0.81 0.42 258.21 +139 6.67 -8.87 0.00 0.31 788.15 +140 8.75 -4.38 0.00 0.44 738.41 +141 10.52 1.30 0.00 0.67 601.70 +142 15.82 -0.97 0.00 0.55 792.28 +143 16.81 1.87 0.40 0.70 563.92 +144 13.71 0.56 0.00 0.64 719.11 +145 11.87 -1.48 0.00 0.55 718.78 +146 8.69 -8.14 0.00 0.33 791.58 +147 9.18 -6.26 0.00 0.38 766.24 +148 12.47 -2.00 0.00 0.53 740.22 +149 12.66 -1.28 0.00 0.56 728.08 +150 10.74 -2.68 0.00 0.50 717.71 +151 12.57 -2.84 0.00 0.49 751.03 +152 14.94 -2.30 0.00 0.50 774.35 +153 11.77 -3.90 0.00 0.46 749.83 +154 12.61 -1.87 0.00 0.53 720.47 +155 16.23 1.22 0.00 0.65 721.77 +156 16.56 0.53 0.00 0.62 736.33 +157 16.32 3.33 0.00 0.78 655.81 +158 15.56 1.96 0.00 0.70 670.49 +159 12.75 -2.12 0.00 0.52 702.55 +160 15.04 1.20 0.00 0.66 666.23 +161 14.49 -0.25 0.00 0.59 687.65 +162 15.13 1.71 0.00 0.69 642.20 +163 18.71 2.91 0.00 0.72 690.37 +164 18.03 2.31 0.00 0.70 687.31 +165 18.27 3.64 0.00 0.78 654.04 +166 17.41 1.27 0.00 0.65 684.75 +167 15.04 -1.97 0.00 0.51 700.41 +168 14.68 -0.67 0.00 0.58 652.98 +169 18.07 0.97 0.00 0.63 685.36 +170 18.59 3.88 0.00 0.79 621.57 +171 16.75 3.51 0.00 0.79 577.21 +172 17.92 1.90 0.00 0.68 651.99 +173 16.49 2.94 0.00 0.75 586.24 +174 18.57 2.53 0.00 0.71 646.51 +175 22.55 3.98 0.00 0.76 685.87 +176 22.38 7.78 0.00 1.03 591.24 +177 22.05 5.77 0.00 0.88 633.79 +178 21.73 6.18 0.00 0.91 613.69 +179 19.12 7.58 0.00 1.04 496.67 +180 18.93 3.56 0.00 0.76 611.46 +181 21.24 5.36 0.00 0.85 616.26 +182 20.76 8.44 0.00 1.10 514.91 +183 18.36 6.05 0.87 0.94 389.32 +184 16.97 5.75 0.77 0.92 364.40 +185 18.07 3.13 0.00 0.74 598.98 +186 21.19 4.94 0.00 0.82 621.13 +187 21.81 5.27 0.00 0.84 621.26 +188 22.81 5.65 0.00 0.85 627.05 +189 20.40 6.51 0.39 0.97 410.21 +190 18.40 4.23 0.63 0.83 418.25 +191 21.28 5.28 0.00 0.86 597.42 +192 21.67 7.12 0.47 1.01 414.44 +193 17.90 6.66 1.08 0.98 348.09 +194 19.84 4.96 0.61 0.87 423.39 +195 17.63 4.56 0.73 0.85 390.26 +196 18.77 2.69 0.00 0.74 595.79 +197 19.79 4.22 0.00 0.82 580.58 +198 22.41 4.27 0.00 0.80 622.41 +199 20.86 6.23 0.00 0.95 549.69 +200 19.98 5.01 0.00 0.87 557.98 +201 20.82 7.28 0.00 1.02 515.35 +202 19.35 5.33 0.00 0.89 531.24 +203 20.36 4.76 0.00 0.86 563.05 +204 22.31 5.71 0.00 0.91 576.17 +205 19.82 5.42 0.24 0.90 397.92 +206 19.05 5.71 0.00 0.92 457.72 +207 18.42 2.39 0.62 0.73 385.27 +208 17.76 3.04 0.00 0.75 491.58 +209 20.06 4.93 0.00 0.84 493.05 +210 22.13 5.79 0.00 0.88 511.41 +211 22.43 7.31 0.00 0.99 486.22 +212 19.63 8.46 0.23 1.11 293.89 +213 21.18 5.79 0.27 0.92 366.67 +214 20.12 6.80 0.00 0.88 448.95 +215 20.00 5.83 0.00 0.77 470.62 +216 20.35 6.15 0.00 0.78 471.38 +217 19.01 2.83 0.00 0.58 514.60 +218 21.17 5.84 0.00 0.71 495.04 +219 23.51 7.63 0.00 0.74 500.71 +220 23.74 7.14 0.00 0.67 512.47 +221 20.62 6.64 0.87 0.85 343.69 +222 22.82 6.98 0.97 0.86 367.61 +223 22.14 7.01 0.00 0.77 479.91 +224 22.33 7.52 0.00 0.79 471.72 +225 22.32 6.87 0.00 0.74 482.80 +226 19.25 6.08 0.00 0.74 438.56 +227 17.68 6.87 1.07 0.93 281.40 +228 15.28 7.61 0.95 1.04 212.49 +229 14.62 4.29 0.00 0.72 376.02 +230 16.61 1.72 0.00 0.51 487.44 +231 17.03 3.82 0.00 0.62 449.42 +232 18.37 5.72 0.00 0.72 432.68 +233 14.77 0.92 0.00 0.51 465.47 +234 19.63 -0.83 0.00 0.37 556.54 +235 21.32 4.24 0.00 0.56 510.40 +236 17.24 7.23 0.00 0.88 355.19 +237 15.22 3.28 0.80 0.72 307.97 +238 13.70 3.32 0.77 0.77 277.80 +239 14.13 1.82 0.77 0.69 316.47 +240 16.38 2.53 0.00 0.63 456.81 +241 18.42 4.57 0.00 0.72 452.46 +242 17.38 4.16 0.00 0.71 437.26 +243 13.34 1.66 0.00 0.64 406.54 +244 14.64 0.10 0.00 0.53 466.12 +245 14.24 -1.12 0.00 0.49 478.22 +246 18.26 2.03 0.00 0.59 483.90 +247 18.46 4.49 0.00 0.73 442.57 +248 19.18 3.21 0.00 0.64 474.89 +249 19.29 3.98 0.00 0.69 461.57 +250 19.86 3.78 0.00 0.67 471.07 +251 16.78 3.43 0.00 0.70 424.25 +252 15.05 3.42 1.32 0.78 289.84 +253 6.76 2.47 0.60 0.73 126.47 +254 14.36 3.04 0.26 0.76 288.79 +255 13.04 0.20 0.00 0.61 421.13 +256 13.49 2.38 0.00 0.72 379.45 +257 15.05 2.78 0.00 0.74 401.45 +258 18.41 2.83 0.00 0.70 450.62 +259 17.05 2.52 0.00 0.70 431.11 +260 12.64 2.93 0.36 0.75 248.57 +261 15.13 2.63 0.00 0.74 392.98 +262 19.83 1.10 0.00 0.61 473.45 +263 19.62 7.49 0.47 1.04 278.29 +264 15.89 1.31 0.00 0.67 423.09 +265 15.17 1.21 0.00 0.67 413.10 +266 11.38 -1.62 0.00 0.54 396.65 +267 12.60 -3.04 0.00 0.49 432.71 +268 11.80 -3.34 0.00 0.48 421.70 +269 13.11 -3.04 0.00 0.49 429.46 +270 16.83 -1.66 0.00 0.53 446.31 +271 16.30 0.65 0.00 0.64 409.50 +272 16.71 0.96 0.00 0.65 406.54 +273 15.83 1.51 0.00 0.68 382.61 +274 18.56 1.11 0.00 0.65 416.99 +275 16.49 2.66 0.00 0.74 367.05 +276 12.20 -2.92 0.00 0.49 390.28 +277 14.10 -0.80 0.00 0.58 381.56 +278 15.18 -0.19 0.00 0.60 383.60 +279 13.73 -0.60 0.00 0.58 368.05 +280 17.52 -0.99 0.00 0.56 409.36 +281 17.94 0.52 0.00 0.62 393.94 +282 17.08 0.90 0.00 0.65 375.38 +283 15.34 0.63 0.00 0.64 350.85 +284 11.26 -2.62 0.00 0.50 339.10 +285 14.19 -2.56 0.00 0.49 370.84 +286 11.27 0.23 0.00 0.62 281.57 +287 8.30 -1.61 0.00 0.54 259.41 +288 11.31 -2.02 0.00 0.53 319.55 +289 6.25 -2.89 0.19 0.49 243.09 +290 -1.97 -9.27 0.00 0.30 202.67 +291 0.17 -7.87 0.00 0.34 219.84 +292 0.78 -9.09 0.00 0.31 262.18 +293 7.43 -7.75 0.00 0.34 340.51 +294 9.51 -8.62 0.00 0.32 364.11 +295 8.59 -8.46 0.00 0.32 351.31 +296 5.30 -6.26 0.00 0.38 278.96 +297 -2.82 -14.22 0.00 0.20 279.06 +298 3.79 -14.50 0.00 0.20 355.11 +299 10.12 -9.03 0.00 0.31 354.00 +300 2.43 -5.85 0.52 0.39 159.43 +301 -3.67 -10.65 0.35 0.27 155.57 +302 -3.75 -16.77 0.00 0.16 331.27 +303 3.81 -15.30 0.00 0.19 387.24 +304 9.81 -7.24 0.00 0.35 364.26 +305 9.68 -5.70 0.00 0.40 343.04 +306 12.20 -4.41 0.00 0.44 350.22 +307 8.47 -3.01 0.00 0.49 283.44 +308 7.09 -5.31 0.00 0.41 298.20 +309 6.36 -4.80 0.00 0.43 276.62 +310 11.36 -4.86 0.00 0.43 337.71 +311 10.32 -2.52 0.00 0.51 268.04 +312 10.51 0.30 0.00 0.62 229.34 +313 8.80 -1.15 0.00 0.56 226.22 +314 12.11 -1.45 0.00 0.55 271.85 +315 14.45 -3.18 0.00 0.47 302.27 +316 12.56 -2.26 0.00 0.52 278.41 +317 8.74 -2.54 0.42 0.51 180.06 +318 0.43 -8.48 0.41 0.32 171.58 +319 -7.58 -15.00 0.22 0.19 148.95 +320 -6.57 -21.93 0.00 0.11 313.12 +321 -10.52 -21.39 0.07 0.11 255.14 +322 -0.58 -20.91 0.00 0.12 335.56 +323 0.74 -15.79 0.00 0.18 309.74 +324 -0.33 -15.88 0.00 0.18 299.73 +325 1.92 -15.28 0.00 0.19 309.70 +326 3.66 -12.94 0.00 0.23 301.17 +327 -2.50 -13.69 0.00 0.21 241.66 +328 -2.79 -11.32 0.00 0.26 199.07 +329 -8.55 -13.50 0.36 0.22 97.12 +330 -2.62 -20.14 0.00 0.12 305.21 +331 -5.47 -16.64 0.00 0.17 240.04 +332 -0.86 -18.92 0.00 0.14 302.05 +333 1.06 -14.53 0.00 0.20 283.49 +334 5.19 -6.51 0.00 0.37 240.64 +335 4.62 -3.36 0.00 0.48 182.04 +336 1.05 -7.53 0.00 0.35 196.75 +337 8.05 -13.60 0.00 0.19 307.81 +338 6.35 -5.64 0.00 0.40 240.04 +339 5.93 -1.56 0.00 0.54 168.63 +340 0.87 -7.73 0.00 0.34 193.47 +341 -0.86 -9.77 0.00 0.29 200.14 +342 -2.61 -11.04 0.29 0.26 146.72 +343 -2.71 -16.66 0.28 0.17 202.77 +344 -5.32 -16.86 0.00 0.16 239.19 +345 0.42 -14.02 0.00 0.19 268.55 +346 3.58 -7.64 0.00 0.31 233.65 +347 6.91 -8.15 0.00 0.27 269.93 +348 4.95 -9.79 0.00 0.24 265.91 +349 5.01 -9.83 0.00 0.24 264.25 +350 5.73 -7.08 0.00 0.31 244.60 +351 6.57 -6.35 0.00 0.31 244.86 +352 8.86 -4.29 0.00 0.34 248.36 +353 4.91 -8.70 0.00 0.26 255.05 +354 1.25 -9.82 0.00 0.24 229.19 +355 5.08 -9.78 0.00 0.21 267.97 +356 0.44 -9.63 0.00 0.26 218.92 +357 1.56 -7.74 0.00 0.30 207.35 +358 -2.10 -10.18 0.00 0.27 187.68 +359 2.31 -10.79 0.00 0.21 254.05 +360 5.37 -5.93 0.00 0.30 235.22 +361 4.40 -5.17 0.00 0.34 211.93 +362 10.81 -4.53 0.00 0.28 275.20 +363 6.39 -5.22 0.00 0.31 243.28 +364 6.81 -10.64 0.00 0.18 289.69 +365 8.94 -8.32 0.00 0.21 287.19 +366 8.94 -8.32 0.00 0.21 287.19 diff --git a/inst/extdata/example1/Input/data_weather_daymet/weath.1981 b/inst/extdata/example1/Input/data_weather_daymet/weath.1981 new file mode 100644 index 00000000..e06ee2ff --- /dev/null +++ b/inst/extdata/example1/Input/data_weather_daymet/weath.1981 @@ -0,0 +1,367 @@ +# weather for site daymet example at -105.58 / 39.59 year = 1981 +# DOY, Tmax_C, Tmin_C, PPT_cm, vp_kPa, rsds_WPERm2 +1 5.81 -9.20 0.00 0.30 278.89 +2 1.59 -7.56 0.00 0.35 206.71 +3 3.08 -9.22 0.00 0.30 253.62 +4 1.88 -8.46 0.00 0.32 228.01 +5 -2.21 -10.00 0.13 0.29 185.62 +6 -0.11 -15.82 0.00 0.18 292.82 +7 5.26 -11.83 0.00 0.25 301.90 +8 4.33 -10.60 0.00 0.27 287.50 +9 3.09 -11.15 0.00 0.26 283.59 +10 1.49 -11.71 0.00 0.25 274.66 +11 1.30 -13.99 0.00 0.21 297.40 +12 4.83 -12.22 0.00 0.24 311.02 +13 2.62 -11.34 0.00 0.26 287.56 +14 0.69 -12.67 0.00 0.23 283.54 +15 -1.29 -13.72 0.00 0.21 274.71 +16 -4.58 -14.17 0.07 0.20 233.90 +17 1.12 -14.41 0.00 0.20 312.07 +18 -1.21 -12.53 0.00 0.23 264.96 +19 -2.53 -16.64 0.00 0.17 303.68 +20 -2.82 -14.06 0.00 0.21 268.07 +21 5.06 -14.92 0.00 0.19 348.38 +22 7.86 -10.78 0.00 0.27 343.57 +23 7.27 -8.10 0.00 0.33 321.96 +24 3.28 -9.00 0.00 0.31 290.18 +25 -6.18 -15.43 0.00 0.18 243.79 +26 -7.86 -17.79 0.00 0.15 259.69 +27 -2.46 -13.96 0.00 0.21 288.21 +28 1.10 -10.55 0.00 0.27 291.45 +29 0.24 -10.82 0.00 0.27 284.56 +30 -0.12 -11.20 0.00 0.26 287.31 +31 -11.37 -16.09 0.13 0.17 147.91 +32 -12.45 -18.35 0.03 0.14 183.89 +33 -5.96 -16.95 0.00 0.16 303.04 +34 -1.57 -16.96 0.00 0.16 362.88 +35 -1.51 -15.79 0.00 0.18 351.38 +36 -2.22 -14.65 0.00 0.20 331.13 +37 -5.59 -13.98 0.00 0.21 257.99 +38 -5.69 -14.89 0.00 0.19 282.54 +39 -5.46 -14.31 0.00 0.20 279.65 +40 -2.54 -13.96 0.76 0.21 257.04 +41 -7.93 -26.00 0.47 0.07 320.74 +42 0.00 -29.69 0.00 0.05 452.77 +43 -2.63 -10.25 0.00 0.28 254.73 +44 3.53 -8.57 0.00 0.32 357.60 +45 7.13 -7.34 0.00 0.33 394.24 +46 3.20 -7.91 0.00 0.34 343.19 +47 7.50 -8.28 0.00 0.30 416.27 +48 3.19 -5.87 0.00 0.39 303.11 +49 3.34 -8.68 0.00 0.31 373.45 +50 6.92 -5.68 0.00 0.37 384.48 +51 3.75 -5.25 0.00 0.41 315.69 +52 -5.77 -16.64 0.00 0.17 374.94 +53 -1.92 -16.22 0.00 0.17 437.01 +54 4.87 -9.90 0.00 0.26 442.57 +55 5.61 -7.74 0.00 0.30 423.41 +56 5.84 -9.16 0.00 0.26 449.42 +57 0.98 -9.57 0.00 0.29 374.60 +58 2.18 -11.65 0.00 0.23 441.17 +59 2.80 -12.19 0.00 0.21 459.97 +60 0.15 -11.29 0.25 0.26 303.72 +61 1.20 -10.54 0.18 0.26 407.94 +62 -4.52 -8.55 1.07 0.32 128.90 +63 -2.71 -11.97 0.48 0.24 270.80 +64 3.64 -15.40 0.00 0.17 526.38 +65 0.83 -11.19 0.63 0.26 329.09 +66 -4.81 -11.91 0.42 0.25 226.53 +67 -0.32 -14.40 0.00 0.20 486.32 +68 -0.64 -16.42 0.00 0.17 512.72 +69 0.67 -14.66 0.00 0.19 506.16 +70 -0.73 -14.73 0.00 0.19 486.33 +71 0.90 -13.03 0.46 0.22 371.21 +72 -0.49 -13.40 0.42 0.22 368.35 +73 3.19 -12.22 0.00 0.22 530.55 +74 2.64 -13.83 0.00 0.19 547.48 +75 5.29 -12.01 0.00 0.21 559.92 +76 -2.22 -10.38 0.00 0.28 355.73 +77 -2.25 -13.22 0.00 0.22 453.17 +78 5.04 -13.50 0.00 0.18 585.41 +79 3.72 -7.15 0.37 0.36 336.38 +80 -2.68 -9.27 0.56 0.30 230.68 +81 1.86 -14.92 0.00 0.16 581.04 +82 2.50 -9.37 0.00 0.26 486.75 +83 -0.76 -8.88 0.99 0.31 281.13 +84 5.37 -15.43 0.00 0.14 635.84 +85 8.35 -9.23 0.00 0.22 604.73 +86 1.12 -5.03 0.00 0.42 295.62 +87 -6.54 -11.07 1.46 0.26 175.19 +88 0.55 -11.68 0.00 0.22 533.24 +89 1.27 -10.06 0.00 0.25 513.50 +90 -0.70 -14.86 0.00 0.16 587.68 +91 8.84 -11.07 0.00 0.16 663.36 +92 7.44 -2.68 0.34 0.45 345.89 +93 -3.41 -7.27 0.00 0.35 204.34 +94 -5.04 -14.68 0.00 0.19 470.38 +95 5.09 -14.14 0.00 0.13 672.43 +96 5.96 -8.14 0.00 0.23 590.47 +97 4.21 -8.66 0.72 0.27 424.78 +98 2.37 -8.30 0.00 0.27 507.84 +99 9.98 -8.33 0.00 0.20 674.34 +100 12.50 -1.24 0.00 0.36 592.24 +101 10.14 -2.47 0.00 0.35 568.31 +102 9.01 -3.54 0.00 0.32 569.35 +103 9.69 -4.58 0.00 0.28 616.40 +104 8.68 -5.63 0.00 0.26 621.67 +105 10.15 -1.97 0.00 0.35 569.27 +106 9.53 -3.75 0.00 0.30 599.78 +107 13.28 -2.73 0.00 0.28 655.36 +108 10.54 -1.78 0.00 0.35 575.54 +109 6.22 -2.96 0.78 0.45 350.56 +110 9.12 -5.79 0.35 0.32 477.82 +111 8.86 -2.53 0.00 0.38 550.35 +112 4.19 -6.60 0.00 0.30 535.86 +113 10.23 -7.42 0.00 0.22 693.57 +114 12.99 -3.11 0.00 0.29 670.14 +115 16.12 -0.73 0.00 0.33 681.58 +116 16.54 -0.14 0.00 0.34 672.13 +117 13.75 0.06 0.00 0.39 602.83 +118 13.01 -1.81 0.00 0.33 631.00 +119 13.96 -1.92 0.00 0.32 650.76 +120 14.06 0.49 0.00 0.41 595.16 +121 15.64 -0.31 0.00 0.34 654.39 +122 12.95 2.16 1.02 0.61 378.34 +123 9.42 0.47 0.34 0.61 323.40 +124 7.38 -4.62 0.48 0.40 410.12 +125 11.14 -4.73 1.13 0.36 486.66 +126 7.85 -2.81 0.49 0.49 379.11 +127 5.84 -6.04 0.00 0.34 556.72 +128 1.16 -6.91 0.54 0.36 309.78 +129 0.24 -8.65 0.58 0.32 345.76 +130 8.21 -9.24 0.00 0.24 704.26 +131 8.94 -5.24 0.00 0.33 635.39 +132 5.46 -5.51 0.55 0.40 403.01 +133 5.19 -9.66 0.00 0.24 658.46 +134 12.16 -6.51 0.00 0.26 721.33 +135 8.88 -3.17 0.00 0.40 572.65 +136 1.61 -2.70 0.00 0.50 240.24 +137 3.25 -3.14 2.25 0.48 263.25 +138 2.40 -3.30 0.60 0.48 240.89 +139 10.64 -4.10 0.00 0.37 663.89 +140 10.60 -1.99 0.00 0.46 607.36 +141 7.57 -1.15 0.00 0.55 465.19 +142 7.55 -1.55 0.00 0.53 483.81 +143 7.19 -1.20 0.00 0.55 460.40 +144 11.63 -3.71 0.66 0.43 510.78 +145 11.66 -1.22 0.00 0.48 629.99 +146 13.77 -1.08 0.00 0.45 677.98 +147 14.56 1.62 0.00 0.57 628.12 +148 12.59 1.39 1.17 0.67 428.65 +149 7.41 0.04 0.30 0.61 318.67 +150 13.89 -0.75 1.06 0.55 501.99 +151 12.86 2.18 0.31 0.71 420.96 +152 13.44 -1.99 0.00 0.45 692.88 +153 15.45 0.59 0.90 0.60 498.63 +154 12.29 0.66 1.04 0.64 437.71 +155 11.73 0.92 0.00 0.61 565.36 +156 14.29 0.84 0.00 0.56 640.20 +157 18.19 2.44 0.00 0.58 679.74 +158 18.66 2.74 0.00 0.60 675.18 +159 19.60 7.85 0.00 0.92 560.27 +160 20.75 10.99 0.00 1.20 486.95 +161 19.86 6.06 0.00 0.78 621.25 +162 20.93 5.13 0.00 0.69 657.72 +163 20.48 6.26 0.00 0.76 623.30 +164 16.60 7.34 0.00 0.95 475.75 +165 9.00 -1.75 0.00 0.50 547.82 +166 7.87 -5.71 0.00 0.36 627.17 +167 17.18 -2.42 0.00 0.40 707.54 +168 18.29 5.42 0.00 0.76 571.62 +169 15.89 -0.42 0.00 0.48 654.41 +170 20.32 3.87 0.00 0.63 645.07 +171 20.17 4.73 0.00 0.67 618.87 +172 21.59 4.06 0.00 0.62 648.25 +173 22.95 5.23 0.00 0.67 640.73 +174 21.49 7.80 0.00 0.84 555.31 +175 20.88 6.53 0.00 0.77 570.35 +176 23.05 7.23 0.00 0.77 596.36 +177 22.71 7.96 0.38 1.01 377.59 +178 20.14 6.15 0.29 0.89 368.56 +179 15.36 4.24 0.44 0.83 315.90 +180 16.43 2.57 1.11 0.72 369.52 +181 18.32 3.40 0.00 0.68 515.88 +182 18.42 4.57 0.46 0.84 364.69 +183 11.77 7.85 1.10 1.06 126.47 +184 14.74 5.16 0.80 0.88 285.46 +185 15.47 4.32 0.00 0.82 431.36 +186 19.46 3.84 0.00 0.72 533.40 +187 22.86 7.94 0.00 0.95 512.21 +188 22.00 9.05 0.29 1.15 347.67 +189 14.76 5.82 0.62 0.92 270.35 +190 18.63 6.64 0.53 0.98 335.25 +191 19.37 6.79 0.00 0.94 465.73 +192 20.84 7.27 0.55 1.02 362.76 +193 18.52 6.75 0.46 0.98 333.30 +194 15.71 6.11 0.50 0.94 287.31 +195 19.29 7.39 0.38 1.03 333.63 +196 19.68 6.85 0.28 0.99 351.28 +197 14.93 6.94 0.51 1.00 250.73 +198 17.01 8.00 0.50 1.07 277.47 +199 16.46 3.84 0.29 0.80 362.08 +200 19.88 4.02 0.00 0.77 547.55 +201 22.02 4.89 0.00 0.80 561.20 +202 21.90 7.89 0.00 1.02 506.28 +203 21.24 7.03 0.00 0.96 514.14 +204 22.14 8.15 0.00 1.04 506.55 +205 18.34 5.50 0.27 0.90 364.72 +206 18.17 4.65 0.36 0.85 377.73 +207 15.38 5.18 0.90 0.88 317.45 +208 15.00 3.19 0.00 0.77 474.56 +209 19.51 2.91 0.00 0.73 558.61 +210 20.37 7.01 0.00 1.00 495.71 +211 20.89 8.13 0.00 1.08 481.01 +212 21.52 6.83 0.00 0.97 520.34 +213 18.42 8.24 0.00 1.09 408.61 +214 21.29 5.27 0.00 0.85 536.12 +215 21.25 5.81 0.00 0.88 522.96 +216 22.07 8.12 0.00 1.03 492.15 +217 22.69 6.85 0.00 0.91 526.54 +218 18.08 7.12 0.00 1.01 424.07 +219 15.88 3.82 0.00 0.80 456.01 +220 17.69 3.59 0.00 0.75 499.03 +221 8.51 3.41 0.43 0.78 168.10 +222 9.20 2.80 0.45 0.75 210.48 +223 12.21 2.68 0.53 0.74 295.33 +224 11.21 5.72 0.63 0.92 182.48 +225 13.76 2.91 0.44 0.75 325.50 +226 14.73 2.64 0.70 0.74 348.81 +227 14.03 5.50 0.95 0.90 267.66 +228 13.67 2.95 0.58 0.75 319.62 +229 15.75 2.07 0.00 0.71 494.49 +230 17.94 2.18 0.00 0.69 526.75 +231 19.31 3.47 0.00 0.75 524.67 +232 19.14 5.06 0.17 0.86 492.10 +233 20.14 5.44 0.40 0.90 373.26 +234 13.42 4.42 0.19 0.84 370.34 +235 17.03 2.44 0.00 0.72 502.81 +236 16.68 5.12 0.00 0.88 437.76 +237 18.12 3.32 0.00 0.77 498.96 +238 17.73 3.78 0.00 0.80 481.15 +239 16.70 2.73 0.00 0.74 483.74 +240 18.46 3.16 0.00 0.74 501.27 +241 18.16 4.59 0.00 0.82 468.11 +242 18.35 3.94 0.00 0.77 482.16 +243 14.30 4.12 0.27 0.82 291.55 +244 16.27 1.09 0.55 0.66 370.53 +245 19.28 4.34 0.00 0.78 484.62 +246 14.30 2.52 0.00 0.73 428.35 +247 16.61 5.06 0.00 0.87 419.96 +248 16.00 4.12 0.47 0.82 319.71 +249 12.00 2.85 0.00 0.75 358.57 +250 7.49 2.53 0.00 0.73 215.03 +251 12.89 1.92 0.48 0.70 305.77 +252 14.56 2.42 0.72 0.73 319.93 +253 13.33 1.49 0.29 0.68 313.79 +254 12.45 3.00 0.00 0.76 352.35 +255 13.91 2.20 0.00 0.72 407.01 +256 15.63 0.97 0.00 0.66 456.83 +257 15.79 2.59 0.21 0.74 320.19 +258 14.64 1.31 0.00 0.67 426.69 +259 10.86 2.09 0.00 0.71 320.94 +260 14.17 -0.81 0.00 0.58 452.56 +261 17.55 0.64 0.00 0.64 469.11 +262 17.21 1.50 0.00 0.68 451.55 +263 15.66 3.39 0.00 0.78 394.83 +264 16.06 3.11 0.00 0.76 402.57 +265 15.70 2.72 0.00 0.74 402.19 +266 16.44 2.83 0.12 0.75 408.72 +267 14.17 3.44 0.00 0.78 352.44 +268 14.52 2.33 0.00 0.72 382.82 +269 11.40 0.19 0.00 0.62 365.42 +270 17.02 -0.61 0.00 0.58 450.94 +271 17.52 3.82 0.00 0.80 396.99 +272 15.67 4.82 0.00 0.86 344.46 +273 12.66 3.06 0.00 0.76 316.60 +274 15.63 -0.28 0.00 0.60 423.44 +275 13.45 1.56 0.00 0.68 363.27 +276 6.40 1.99 0.00 0.70 163.27 +277 8.11 -1.33 0.00 0.55 315.44 +278 8.06 -2.91 0.00 0.49 347.99 +279 11.78 -3.84 0.00 0.46 410.80 +280 13.62 -0.22 0.00 0.60 379.00 +281 10.26 1.71 0.00 0.69 274.10 +282 6.33 -0.90 0.00 0.57 241.56 +283 11.02 -2.20 0.00 0.52 366.21 +284 12.32 1.29 0.00 0.67 322.74 +285 6.22 -1.70 0.00 0.54 255.42 +286 7.49 -1.82 0.34 0.53 219.08 +287 4.05 -1.40 0.56 0.55 141.20 +288 0.08 -2.01 1.20 0.53 64.36 +289 1.84 -4.04 0.00 0.45 205.44 +290 2.27 -6.88 0.00 0.36 295.45 +291 6.41 -8.75 0.00 0.32 382.65 +292 9.48 -7.53 0.00 0.35 390.48 +293 8.17 -5.58 0.00 0.40 358.88 +294 3.36 -6.76 0.00 0.37 305.80 +295 2.25 -6.11 0.00 0.39 268.35 +296 5.94 -8.29 0.00 0.33 358.93 +297 -1.16 -5.27 0.58 0.41 110.19 +298 0.09 -13.73 0.00 0.21 353.16 +299 10.49 -10.97 0.00 0.26 382.87 +300 11.09 -5.46 0.00 0.41 359.00 +301 9.75 -2.10 0.00 0.52 310.47 +302 7.66 -2.15 0.00 0.52 276.88 +303 -1.17 -9.43 1.09 0.30 210.85 +304 -2.36 -12.06 0.00 0.24 312.77 +305 4.31 -13.24 0.00 0.22 394.40 +306 6.11 -8.24 0.00 0.33 363.34 +307 6.76 -7.26 0.00 0.35 354.56 +308 9.66 -6.88 0.00 0.36 369.73 +309 6.40 -7.90 0.00 0.34 349.22 +310 8.47 -3.80 0.00 0.46 320.97 +311 5.37 -5.29 0.00 0.41 294.03 +312 1.24 -6.69 0.42 0.37 180.70 +313 2.92 -11.01 0.00 0.26 335.69 +314 6.11 -10.20 0.00 0.28 349.18 +315 6.97 -8.88 0.00 0.31 340.06 +316 7.16 -8.77 0.00 0.31 335.90 +317 8.81 -8.48 0.00 0.32 338.67 +318 8.40 -2.42 0.00 0.51 260.00 +319 8.79 -4.61 0.00 0.43 291.12 +320 10.07 -0.55 0.00 0.59 246.65 +321 10.87 -2.37 0.00 0.51 282.00 +322 -3.79 -9.38 0.00 0.30 151.55 +323 -2.40 -13.24 0.00 0.22 257.83 +324 2.58 -12.89 0.00 0.23 305.82 +325 3.25 -6.36 0.00 0.38 228.39 +326 3.09 -6.43 0.00 0.38 227.05 +327 3.99 -8.80 0.00 0.31 269.89 +328 9.01 -3.54 0.00 0.47 262.51 +329 4.39 -4.86 0.44 0.43 166.34 +330 -5.11 -16.21 0.00 0.17 252.33 +331 -0.15 -13.65 0.00 0.21 277.55 +332 -0.73 -15.76 0.00 0.18 288.37 +333 -2.64 -11.39 0.39 0.26 157.53 +334 -10.54 -15.54 0.00 0.18 130.99 +335 -7.61 -18.47 0.00 0.14 244.44 +336 -3.29 -14.86 0.00 0.19 252.78 +337 -1.42 -7.62 0.00 0.34 159.16 +338 5.04 -10.96 0.00 0.26 289.66 +339 3.42 -7.17 0.00 0.36 237.39 +340 5.66 -4.66 0.00 0.43 232.06 +341 7.81 -5.96 0.00 0.39 268.54 +342 8.01 -6.29 0.00 0.38 270.10 +343 9.24 -7.90 0.00 0.31 287.28 +344 4.70 -4.50 0.00 0.44 209.68 +345 4.30 -7.34 0.27 0.35 188.09 +346 -0.19 -9.60 0.00 0.30 218.77 +347 -1.10 -11.03 0.16 0.26 229.68 +348 -2.53 -10.62 0.00 0.27 200.11 +349 -0.28 -7.12 0.64 0.36 135.16 +350 -7.79 -13.47 0.51 0.22 118.68 +351 -8.25 -17.02 0.00 0.16 221.18 +352 -0.51 -14.70 0.00 0.20 278.60 +353 1.71 -8.25 0.00 0.33 233.07 +354 2.01 -5.83 0.50 0.40 152.75 +355 -5.49 -8.51 0.69 0.32 69.31 +356 -10.30 -14.80 0.59 0.19 101.61 +357 -14.37 -22.71 0.00 0.10 223.36 +358 -7.76 -23.50 0.00 0.09 297.45 +359 -10.09 -14.99 0.39 0.19 111.77 +360 -10.33 -21.03 0.73 0.11 200.76 +361 -12.47 -17.67 0.61 0.15 122.25 +362 -11.77 -21.53 0.00 0.11 257.72 +363 -2.98 -20.20 0.00 0.12 311.08 +364 -1.81 -12.51 0.82 0.23 202.83 +365 -2.95 -14.10 0.69 0.21 209.22 diff --git a/inst/extdata/example1/Input/data_weather_gridmet/weath.1980 b/inst/extdata/example1/Input/data_weather_gridmet/weath.1980 new file mode 100644 index 00000000..df390099 --- /dev/null +++ b/inst/extdata/example1/Input/data_weather_gridmet/weath.1980 @@ -0,0 +1,368 @@ +# weather for site gridmet example at -105.58 / 39.59 year = 1980 +# DOY, Tmax_C, Tmin_C, PPT_cm, sfcWind_mPERs, hursmax_pct, hursmin_pct, rsds_WPERm2 +1 -3.18 -12.32 0.75 3.16 74.17 31.42 93.43 +2 -7.47 -17.53 0.16 3.08 100.00 45.43 62.40 +3 -5.49 -19.73 0.09 5.08 83.53 38.31 97.25 +4 -4.09 -14.61 0.00 4.83 76.36 48.42 98.57 +5 -0.49 -12.20 0.00 5.93 75.18 37.81 99.56 +6 -4.01 -15.73 0.66 8.55 63.22 28.94 101.83 +7 -8.99 -18.31 0.29 4.77 94.24 48.81 83.69 +8 -6.56 -18.60 0.55 6.18 83.57 50.66 84.40 +9 -3.28 -14.32 0.19 5.05 75.06 53.04 101.27 +10 -2.58 -11.95 0.49 10.07 88.49 51.53 94.01 +11 -7.69 -19.43 0.07 5.44 79.21 33.63 102.55 +12 -0.66 -11.63 0.39 7.90 91.83 55.05 94.64 +13 -0.34 -6.65 0.09 5.76 84.86 53.88 102.87 +14 1.84 -7.11 0.00 4.16 84.82 49.71 101.95 +15 -1.47 -9.66 0.00 3.19 88.35 34.35 104.86 +16 -3.63 -12.83 0.00 2.49 86.95 37.00 91.15 +17 -3.64 -14.38 0.60 3.09 95.44 43.91 100.81 +18 -5.05 -14.03 0.96 3.79 98.84 47.13 89.72 +19 -10.02 -18.38 0.24 2.96 100.00 60.81 99.18 +20 -4.19 -16.38 0.04 2.97 91.31 42.67 114.47 +21 -4.76 -15.25 0.05 2.89 77.27 42.25 103.52 +22 -8.50 -22.42 0.00 4.27 89.88 34.86 119.05 +23 -3.60 -17.24 0.00 5.18 60.97 33.60 116.35 +24 -0.78 -11.33 0.08 6.76 63.83 39.22 117.15 +25 -4.70 -15.67 0.77 4.15 84.19 37.65 106.71 +26 -8.91 -20.27 0.40 3.00 99.57 47.62 106.83 +27 -4.93 -16.87 0.18 5.32 76.73 53.29 112.25 +28 -6.23 -14.42 0.51 2.80 98.13 51.16 101.26 +29 -4.05 -14.35 0.54 5.47 98.82 62.55 108.96 +30 -8.08 -18.67 0.02 3.90 89.93 46.95 127.95 +31 -3.79 -18.50 0.00 3.37 68.57 26.31 128.77 +32 -2.49 -12.90 0.00 5.06 62.46 24.41 130.80 +33 -2.37 -12.73 0.00 5.36 96.58 44.84 131.59 +34 2.40 -9.98 0.00 4.75 89.05 32.52 128.80 +35 -1.27 -10.03 0.00 5.71 86.31 33.75 130.29 +36 -0.61 -12.21 0.00 4.40 65.03 23.50 138.31 +37 1.91 -8.59 0.00 3.43 52.21 13.37 126.21 +38 -4.52 -18.49 1.88 6.56 100.00 36.54 118.06 +39 -10.17 -23.67 0.15 2.47 100.00 55.46 145.41 +40 -3.49 -20.98 0.00 3.79 89.15 9.98 146.30 +41 -2.89 -15.48 0.00 4.14 63.68 25.16 147.20 +42 -5.12 -17.45 0.00 2.74 72.97 26.97 145.36 +43 -3.78 -16.58 0.00 4.67 85.32 51.28 148.48 +44 -1.75 -13.73 0.00 4.85 80.28 50.62 148.80 +45 0.05 -11.08 0.37 3.82 86.85 49.06 142.58 +46 -1.45 -10.11 0.35 2.23 100.00 59.03 117.92 +47 -2.31 -10.87 0.08 2.85 100.00 60.20 143.15 +48 -1.16 -12.21 0.08 4.26 99.00 63.65 144.30 +49 2.20 -7.80 0.38 5.34 96.32 58.82 124.41 +50 -1.14 -9.63 0.32 4.85 100.00 54.18 144.18 +51 -1.44 -10.05 0.03 5.55 96.60 56.92 133.29 +52 -2.33 -11.37 0.13 4.96 95.97 52.45 161.09 +53 -3.14 -13.66 0.03 3.89 97.29 51.53 145.03 +54 -4.55 -14.93 0.36 3.36 99.36 47.35 153.70 +55 -6.17 -17.17 0.07 5.26 100.00 48.15 170.69 +56 2.02 -13.49 0.00 3.47 75.78 16.33 172.49 +57 1.43 -8.89 0.09 5.05 52.12 16.81 169.01 +58 5.86 -6.28 0.00 4.87 65.97 30.37 168.90 +59 6.66 -4.41 0.20 3.96 50.11 16.99 172.12 +60 -0.92 -13.90 0.29 4.06 92.38 21.80 139.78 +61 -5.09 -17.13 0.00 2.96 85.19 39.84 183.86 +62 -0.19 -14.01 0.00 4.08 75.93 24.28 177.34 +63 1.41 -8.83 0.26 4.04 74.69 40.87 168.01 +64 -2.72 -13.34 0.22 5.32 90.79 44.32 166.63 +65 -2.86 -13.92 0.00 5.04 79.72 47.75 186.75 +66 -1.59 -10.78 1.22 3.42 93.57 46.37 172.48 +67 -3.89 -13.75 0.33 3.42 99.71 48.86 158.09 +68 -4.59 -16.15 0.00 5.04 83.60 44.83 187.56 +69 -3.70 -13.28 0.00 8.32 71.16 32.58 193.26 +70 2.28 -9.96 0.00 5.53 59.05 32.43 192.94 +71 0.88 -9.43 0.09 2.95 60.81 16.03 184.41 +72 -2.62 -13.33 0.00 7.83 76.50 25.65 151.62 +73 1.38 -14.33 0.00 5.80 53.56 28.01 200.06 +74 3.80 -9.29 0.00 4.94 59.75 28.41 200.05 +75 3.81 -7.55 0.49 6.43 46.97 23.79 200.76 +76 -4.67 -16.70 0.43 3.81 95.92 20.36 182.52 +77 -2.34 -19.77 0.00 4.66 77.00 38.28 212.47 +78 2.31 -10.13 0.00 4.86 56.67 18.43 210.86 +79 -0.78 -12.05 0.00 4.89 61.92 24.48 178.78 +80 -2.22 -12.59 0.03 3.35 80.20 36.80 214.76 +81 0.15 -13.74 0.00 4.16 58.96 35.91 216.12 +82 -3.08 -11.31 0.52 4.59 98.57 37.34 184.55 +83 -3.71 -14.38 0.18 2.38 100.00 52.81 201.63 +84 -2.89 -16.94 0.00 3.38 90.33 55.87 214.32 +85 -3.19 -13.38 0.24 4.53 96.52 43.72 183.28 +86 -5.39 -17.97 0.34 3.35 86.35 38.14 193.47 +87 -3.92 -18.08 1.00 2.81 98.79 41.92 190.94 +88 -6.60 -14.47 0.41 5.50 100.00 61.95 193.69 +89 -5.34 -15.38 0.28 4.71 98.07 58.99 188.78 +90 -1.62 -16.86 0.79 3.98 99.31 39.29 220.88 +91 -4.97 -13.20 1.10 3.38 98.32 48.20 210.65 +92 -6.08 -16.35 0.23 3.40 98.66 50.78 193.54 +93 -6.44 -14.82 0.52 3.69 98.72 59.84 185.20 +94 -4.69 -16.38 0.00 3.24 82.65 50.36 204.12 +95 -0.36 -13.54 0.00 3.45 75.10 47.17 219.58 +96 2.85 -9.46 0.00 4.64 63.50 34.55 207.00 +97 -0.34 -9.11 0.44 6.86 72.94 33.26 182.93 +98 -5.15 -14.42 0.18 6.48 91.55 30.11 142.60 +99 -2.56 -16.73 0.00 5.38 59.36 33.26 230.03 +100 2.63 -10.73 0.08 4.45 60.34 32.50 208.68 +101 1.55 -9.52 0.00 4.58 60.35 28.48 201.34 +102 -5.24 -13.57 1.37 5.02 98.15 29.22 201.30 +103 -6.64 -19.40 0.02 4.09 97.22 49.39 234.90 +104 -3.71 -18.80 0.00 4.40 72.95 45.16 241.11 +105 1.78 -13.30 0.00 4.69 60.95 27.74 241.31 +106 3.39 -7.92 0.00 3.89 54.34 35.76 238.01 +107 0.18 -10.22 0.00 5.69 53.93 27.45 243.39 +108 3.69 -10.81 0.00 3.08 51.13 19.68 245.49 +109 7.39 -6.61 0.00 3.39 53.15 15.97 246.12 +110 8.59 -4.43 0.00 2.99 46.97 20.42 243.62 +111 9.18 -4.23 0.00 4.01 44.70 15.78 244.40 +112 9.59 -2.73 0.00 3.61 54.13 20.27 228.56 +113 9.47 -3.05 0.08 3.09 56.47 27.97 223.06 +114 5.16 -2.09 2.73 4.09 91.19 29.26 216.76 +115 0.23 -7.66 2.71 6.64 99.94 40.50 185.58 +116 -1.22 -12.02 0.50 3.88 94.26 48.84 239.64 +117 0.76 -13.38 0.08 2.38 82.13 48.60 244.22 +118 4.26 -11.17 0.04 1.70 80.08 43.79 248.04 +119 6.96 -6.73 0.07 2.56 72.67 33.25 248.32 +120 9.06 -3.33 0.61 2.70 58.13 33.15 213.05 +121 2.98 -4.09 3.28 5.19 99.05 29.71 185.18 +122 -1.19 -6.28 1.43 3.86 98.27 56.11 172.81 +123 2.22 -9.43 0.46 2.20 91.57 48.37 244.22 +124 5.99 -6.26 0.27 2.18 80.24 35.06 278.25 +125 6.48 -5.06 0.58 1.88 81.39 32.87 261.04 +126 5.88 -3.76 0.15 2.30 79.48 34.55 259.05 +127 6.77 -4.17 0.41 2.46 71.97 37.72 239.99 +128 4.68 -4.33 0.85 2.49 80.63 37.15 200.81 +129 4.36 -2.29 0.67 1.98 93.90 43.04 206.90 +130 6.69 -5.18 0.00 4.87 83.45 30.53 268.59 +131 5.21 -4.26 0.11 4.44 63.45 30.79 230.70 +132 4.08 -2.34 0.42 3.40 81.11 37.10 164.56 +133 -0.75 -8.88 0.24 5.85 73.08 40.26 239.64 +134 3.39 -11.23 0.13 2.38 65.99 35.25 274.53 +135 5.57 -6.90 1.23 2.60 65.74 35.18 262.67 +136 0.57 -4.40 1.03 4.11 98.55 33.30 239.24 +137 2.78 -5.68 1.56 3.30 97.94 56.46 242.22 +138 1.73 -5.38 0.61 2.16 94.09 44.07 236.48 +139 4.79 -7.78 0.11 2.99 71.50 41.08 294.09 +140 7.49 -5.06 0.00 3.87 61.32 35.06 287.17 +141 9.21 -2.86 0.00 3.59 60.76 32.63 296.41 +142 12.50 -1.19 0.00 2.49 57.76 28.49 300.21 +143 14.99 1.61 0.23 3.30 61.94 25.36 289.56 +144 10.48 1.47 0.00 4.16 63.14 26.04 301.78 +145 9.32 -2.58 0.00 6.76 44.54 23.41 299.10 +146 4.99 -7.41 0.00 6.86 45.66 21.81 311.50 +147 8.50 -6.69 0.00 5.06 42.91 21.34 304.56 +148 9.52 -2.01 0.00 5.40 41.01 22.61 269.86 +149 9.60 -2.28 0.00 4.86 47.84 23.68 308.92 +150 6.69 -2.99 0.00 4.86 41.99 25.58 289.47 +151 9.79 -3.13 0.00 3.76 56.83 29.00 308.01 +152 10.08 -2.49 0.00 5.76 37.77 21.12 310.27 +153 9.58 -3.41 0.00 4.95 47.43 17.85 291.03 +154 10.07 -3.89 0.00 4.66 49.07 17.48 292.42 +155 14.77 -1.79 0.00 4.67 40.10 16.03 300.45 +156 15.17 -0.67 0.00 5.65 33.56 15.63 299.94 +157 14.57 -0.27 0.00 5.35 34.96 14.84 300.24 +158 14.79 0.69 0.00 6.83 35.06 16.59 297.76 +159 13.45 -1.18 0.00 2.81 46.61 16.40 298.50 +160 15.34 -0.79 0.00 3.00 60.07 21.44 296.72 +161 15.36 -1.56 0.00 2.72 78.49 22.30 296.62 +162 16.98 0.20 0.00 3.52 73.38 24.15 293.44 +163 17.97 2.41 0.00 4.36 65.05 16.54 299.03 +164 16.27 1.62 0.00 5.15 33.29 16.24 300.13 +165 16.47 0.92 0.00 4.65 40.13 14.28 302.93 +166 16.67 1.51 0.00 5.64 30.28 13.47 303.55 +167 13.05 -1.67 0.00 3.06 33.39 13.08 298.37 +168 13.47 -2.19 0.00 2.24 51.86 17.81 299.44 +169 16.45 -1.06 0.00 2.65 41.29 18.97 296.13 +170 18.17 2.61 0.00 2.35 47.27 18.62 268.71 +171 16.65 3.32 0.00 2.73 39.76 16.76 285.82 +172 17.16 2.11 0.00 2.29 37.92 17.94 291.24 +173 16.88 2.51 0.00 4.27 53.56 15.96 268.45 +174 17.86 1.01 0.00 2.56 44.58 16.44 296.91 +175 20.38 2.62 0.00 5.16 42.62 13.79 301.75 +176 19.37 3.84 0.00 4.28 38.77 13.29 293.04 +177 20.87 3.63 0.00 3.56 36.94 16.04 297.93 +178 21.67 5.42 0.00 5.06 41.96 15.76 275.74 +179 17.65 5.52 0.00 6.53 38.21 15.36 296.96 +180 17.26 2.14 0.00 4.55 36.99 13.96 299.75 +181 19.67 3.82 0.00 3.86 35.87 14.76 278.86 +182 20.63 4.74 0.29 3.87 42.25 17.88 246.18 +183 17.02 4.12 0.79 2.79 68.01 20.71 248.38 +184 16.71 1.31 0.29 3.37 99.65 28.96 279.23 +185 16.92 1.03 0.00 3.08 72.51 27.95 263.98 +186 18.02 2.23 0.00 3.27 66.89 22.67 290.46 +187 19.22 1.74 0.00 4.25 52.97 18.71 291.26 +188 20.22 2.54 0.15 3.87 35.23 16.52 281.49 +189 19.32 4.44 0.36 3.31 58.51 17.00 252.48 +190 17.64 3.59 0.00 3.95 79.13 24.05 284.29 +191 19.62 2.74 0.11 2.68 62.57 27.72 277.48 +192 20.12 5.82 0.82 2.89 81.14 25.93 272.26 +193 19.53 5.81 0.56 2.29 68.22 23.75 274.72 +194 17.94 5.72 0.82 3.98 76.35 24.13 259.83 +195 16.83 3.52 0.14 3.59 74.90 26.43 248.06 +196 16.82 1.73 0.00 3.19 73.18 30.25 277.55 +197 17.22 2.52 0.00 4.69 60.42 21.25 287.18 +198 17.84 2.12 0.00 3.09 42.91 21.94 284.95 +199 19.32 3.63 0.00 3.57 54.57 21.46 281.75 +200 19.61 4.90 0.00 3.01 44.95 21.64 274.09 +201 18.92 5.22 0.00 5.37 54.99 20.63 276.02 +202 18.41 3.72 0.00 2.88 51.91 19.57 279.13 +203 18.02 3.80 0.04 1.90 68.83 22.47 279.13 +204 19.22 3.42 0.05 2.58 80.44 25.76 271.05 +205 19.12 4.73 0.37 2.47 62.29 22.28 258.30 +206 18.84 5.12 0.32 3.49 51.68 19.58 259.45 +207 18.11 3.44 0.13 2.16 68.42 20.75 248.87 +208 16.62 2.72 0.00 3.53 61.83 21.00 277.79 +209 17.34 2.12 0.00 3.17 47.85 19.78 278.04 +210 19.32 2.61 0.00 2.79 46.04 20.38 273.96 +211 20.54 4.63 0.00 4.59 38.47 21.04 259.63 +212 17.43 5.02 0.21 3.19 55.36 19.97 247.22 +213 17.55 4.67 0.00 3.49 67.35 22.65 271.59 +214 19.22 6.06 0.11 4.09 57.24 26.24 257.56 +215 18.23 5.58 0.00 3.67 60.85 27.13 267.05 +216 18.25 5.59 0.00 5.76 58.60 25.05 263.43 +217 16.52 2.76 0.00 4.61 62.32 22.09 270.68 +218 19.22 3.66 0.07 4.47 47.88 23.78 259.01 +219 20.44 5.08 0.03 3.81 55.81 22.89 259.87 +220 20.14 6.57 0.19 3.49 50.32 20.32 252.28 +221 19.12 8.31 0.58 2.82 56.20 23.29 249.06 +222 19.92 5.96 0.10 2.88 92.21 23.59 262.98 +223 19.22 4.97 0.00 3.59 55.52 22.59 253.62 +224 18.21 3.05 0.00 2.99 76.84 21.41 261.87 +225 19.12 4.85 0.06 2.79 64.53 20.39 247.85 +226 18.13 5.05 0.23 2.51 48.20 19.79 234.41 +227 16.62 4.09 1.27 3.09 91.48 27.91 227.74 +228 14.49 3.60 0.46 3.23 100.00 36.09 251.48 +229 13.53 1.28 0.00 4.87 62.22 28.72 247.44 +230 15.02 0.27 0.00 3.96 60.88 30.18 254.37 +231 16.45 2.18 0.00 5.67 60.70 24.75 253.27 +232 15.12 2.87 0.00 5.17 53.68 23.48 238.37 +233 10.81 -0.72 0.08 5.26 63.86 26.91 254.77 +234 14.02 -2.51 0.00 3.16 59.87 28.62 252.06 +235 16.53 0.57 0.00 3.89 52.18 21.79 250.67 +236 16.03 4.49 0.46 3.59 68.83 21.59 213.72 +237 13.72 2.48 0.91 3.27 83.10 32.36 167.84 +238 13.03 1.65 0.88 2.69 93.26 38.18 185.41 +239 13.23 0.75 0.71 2.95 99.87 33.66 242.61 +240 14.02 0.46 0.00 3.48 77.04 31.68 236.94 +241 15.34 1.46 0.00 4.77 65.05 24.16 241.47 +242 13.92 2.07 0.06 4.97 58.72 20.99 225.94 +243 13.14 1.49 0.11 4.76 59.76 25.54 214.67 +244 12.13 -0.09 0.19 4.45 67.72 27.04 220.19 +245 12.45 -1.09 0.00 3.93 58.00 25.23 251.37 +246 15.65 0.22 0.00 4.76 47.20 22.08 250.38 +247 15.95 2.01 0.00 5.26 45.22 21.87 246.77 +248 15.95 1.93 0.00 2.36 43.96 20.59 244.48 +249 17.55 2.99 0.00 2.68 43.76 21.49 242.69 +250 17.15 4.28 0.00 2.20 54.44 21.68 220.99 +251 16.42 3.28 0.52 2.89 63.52 25.53 220.64 +252 14.87 2.49 0.54 4.29 83.64 31.72 204.40 +253 7.42 2.18 0.98 3.48 100.00 32.16 103.24 +254 13.91 1.58 0.19 3.65 98.67 40.16 198.10 +255 12.14 -0.51 0.00 5.67 74.58 30.65 232.39 +256 11.32 -1.36 0.03 4.06 71.75 31.94 210.75 +257 14.15 0.47 0.00 3.89 75.69 29.58 223.98 +258 14.44 0.81 0.12 3.28 57.92 22.70 227.67 +259 14.76 1.59 0.00 4.96 62.82 23.15 226.09 +260 11.34 1.04 0.28 5.92 69.32 22.38 221.79 +261 13.35 -1.49 0.00 4.88 48.96 21.57 225.89 +262 16.36 -0.86 0.00 3.98 39.97 21.09 219.97 +263 15.65 3.61 0.13 6.45 48.14 19.79 217.76 +264 11.35 1.40 0.42 4.35 73.44 20.19 218.16 +265 11.74 -1.37 0.00 5.06 54.36 21.59 215.55 +266 8.12 -3.16 0.00 2.11 66.08 20.98 214.98 +267 10.04 -5.23 0.00 3.05 60.36 19.91 215.07 +268 10.03 -4.31 0.00 3.95 57.57 19.73 214.16 +269 10.80 -4.53 0.00 2.98 54.65 21.01 210.96 +270 13.46 -1.73 0.00 2.74 63.91 20.70 208.18 +271 12.75 -1.32 0.00 2.79 37.15 19.10 205.78 +272 13.65 -0.89 0.00 2.79 41.82 19.90 203.29 +273 13.54 0.11 0.00 3.21 42.68 19.81 201.67 +274 17.11 0.06 0.00 3.67 45.99 17.93 200.78 +275 13.11 0.65 0.00 4.06 36.62 18.66 206.22 +276 8.69 -3.86 0.00 2.26 64.50 19.66 207.12 +277 12.22 -2.16 0.00 3.48 41.53 23.92 203.82 +278 12.72 -0.94 0.00 3.97 43.17 19.29 204.13 +279 11.42 -1.62 0.00 3.81 44.65 19.97 197.13 +280 12.74 -2.44 0.00 2.00 59.12 21.09 198.91 +281 14.14 -0.15 0.00 3.30 44.47 23.03 194.12 +282 13.12 -0.93 0.00 1.99 43.10 20.47 194.34 +283 12.82 -1.26 0.00 3.69 41.91 18.91 193.52 +284 9.58 -4.35 0.00 2.29 61.89 20.66 188.93 +285 10.22 -3.84 0.00 3.53 59.59 21.57 189.33 +286 10.02 -2.44 0.00 4.36 58.57 23.34 160.09 +287 7.92 -1.27 0.00 4.37 69.32 27.72 167.62 +288 7.32 -3.63 0.71 4.58 72.61 28.51 175.41 +289 3.02 -6.93 0.70 6.34 86.42 22.77 161.80 +290 -1.71 -10.47 0.29 5.30 93.66 24.94 144.64 +291 -3.49 -10.98 0.00 6.93 79.88 37.19 155.32 +292 -1.08 -12.03 0.00 4.98 81.40 45.42 172.76 +293 3.63 -9.96 0.00 2.50 86.84 30.76 174.74 +294 5.32 -7.46 0.00 2.17 52.30 23.79 174.85 +295 5.32 -8.06 0.09 3.17 57.04 23.80 172.13 +296 4.24 -7.43 0.06 4.47 56.98 23.30 165.24 +297 -3.99 -13.34 0.00 2.88 70.43 23.60 140.86 +298 3.79 -13.79 0.00 5.04 70.83 15.26 166.54 +299 7.59 -7.58 0.23 3.36 25.34 14.01 164.45 +300 2.72 -7.56 0.45 3.14 70.59 14.58 139.93 +301 -5.90 -13.86 0.63 4.40 99.77 26.22 95.77 +302 -5.31 -16.45 0.00 2.68 97.96 62.30 154.31 +303 0.17 -14.47 0.00 4.09 97.11 44.25 156.05 +304 6.32 -7.28 0.00 2.96 64.15 27.95 154.43 +305 8.66 -5.19 0.00 3.96 47.00 16.84 155.34 +306 9.16 -4.49 0.00 2.87 37.03 17.27 148.87 +307 6.46 -3.96 0.00 5.19 34.29 16.06 144.26 +308 4.65 -7.06 0.00 4.06 59.17 18.76 142.19 +309 6.53 -6.36 0.00 3.97 81.60 26.95 140.67 +310 9.55 -4.29 0.00 3.27 80.96 26.06 141.38 +311 9.26 -2.19 0.00 5.86 45.76 20.65 138.17 +312 7.85 -1.61 0.00 6.43 55.01 22.23 135.87 +313 5.84 -4.05 0.00 8.03 60.44 26.46 135.99 +314 8.43 -5.07 0.00 3.89 56.19 21.78 134.69 +315 11.43 -3.19 0.00 3.55 40.17 13.30 136.07 +316 9.94 -2.56 0.00 3.16 26.44 12.49 133.59 +317 5.86 -3.17 0.08 3.86 59.38 15.67 112.77 +318 0.04 -12.64 1.22 2.08 100.00 35.36 95.14 +319 -6.10 -13.81 0.22 1.48 100.00 57.89 99.87 +320 -8.06 -19.19 0.03 1.69 98.79 58.61 130.73 +321 -10.46 -23.73 0.00 2.21 100.00 54.96 128.45 +322 -4.46 -23.15 0.00 3.29 100.00 32.30 129.60 +323 -2.54 -14.67 0.00 2.20 53.39 16.30 126.88 +324 -1.27 -12.49 0.00 2.77 51.66 27.55 123.59 +325 -1.64 -12.89 0.00 2.80 62.76 30.17 119.81 +326 0.95 -10.90 0.04 4.19 60.43 15.51 123.40 +327 -1.46 -10.36 0.00 4.16 42.39 18.86 110.00 +328 -5.60 -14.24 0.04 1.79 100.00 31.79 116.99 +329 -7.76 -15.29 0.58 3.36 100.00 42.30 99.88 +330 -6.27 -17.78 0.13 2.99 100.00 54.26 118.19 +331 -6.67 -17.25 0.00 4.37 85.10 26.45 116.35 +332 -5.40 -19.73 0.00 6.33 88.58 48.40 102.88 +333 0.54 -8.99 0.00 5.84 79.65 35.73 112.20 +334 3.42 -8.68 0.00 6.13 77.07 30.53 111.69 +335 3.96 -6.00 0.00 6.82 50.36 19.98 112.09 +336 -1.59 -12.59 0.10 4.88 52.15 17.90 89.59 +337 1.69 -12.87 0.00 5.11 73.93 38.81 105.97 +338 4.73 -6.31 0.00 4.86 70.35 32.69 103.77 +339 3.63 -6.50 0.00 5.85 54.56 21.50 104.38 +340 0.74 -8.45 0.00 4.34 87.39 31.83 100.72 +341 -0.77 -10.55 0.29 3.53 100.00 36.03 83.84 +342 -3.42 -12.07 0.39 1.99 100.00 49.81 64.59 +343 -5.88 -15.13 0.00 1.79 100.00 56.64 102.70 +344 -7.09 -16.40 0.00 3.97 95.94 49.86 95.71 +345 -1.31 -15.11 0.00 5.48 85.46 37.39 104.07 +346 1.74 -10.18 0.00 4.89 59.27 30.74 100.79 +347 3.95 -7.10 0.00 2.68 62.77 28.65 101.10 +348 0.59 -9.71 0.00 2.60 56.79 26.88 104.08 +349 3.22 -9.40 0.00 4.29 61.90 23.55 103.87 +350 3.07 -8.38 0.00 5.28 81.00 23.07 98.89 +351 6.03 -5.04 0.00 4.98 79.19 33.55 99.69 +352 8.73 -3.12 0.00 5.17 57.95 18.46 101.39 +353 4.72 -7.08 0.00 3.65 43.94 17.36 100.49 +354 0.11 -11.11 0.00 1.85 79.72 22.30 98.16 +355 -0.19 -11.97 0.00 3.18 79.87 38.47 100.29 +356 -0.97 -11.52 0.00 4.09 86.56 45.42 97.28 +357 0.24 -8.41 0.06 6.32 80.52 47.96 99.19 +358 -3.36 -11.92 0.11 5.28 93.06 35.04 99.37 +359 0.23 -12.02 0.00 5.19 76.27 22.31 100.27 +360 3.61 -5.19 0.00 9.60 59.22 18.22 97.70 +361 5.71 -5.56 0.00 5.88 87.32 32.98 99.19 +362 9.82 -3.42 0.00 3.89 77.26 30.36 100.09 +363 4.62 -5.91 0.00 3.10 55.35 27.79 95.48 +364 2.02 -9.06 0.00 2.69 82.81 22.67 104.86 +365 6.54 -4.84 0.00 4.98 36.53 8.57 103.98 +366 0.84 -7.48 0.00 3.06 73.51 10.85 102.39 diff --git a/inst/extdata/example1/Input/data_weather_gridmet/weath.1981 b/inst/extdata/example1/Input/data_weather_gridmet/weath.1981 new file mode 100644 index 00000000..1184a629 --- /dev/null +++ b/inst/extdata/example1/Input/data_weather_gridmet/weath.1981 @@ -0,0 +1,367 @@ +# weather for site gridmet example at -105.58 / 39.59 year = 1981 +# DOY, Tmax_C, Tmin_C, PPT_cm, sfcWind_mPERs, hursmax_pct, hursmin_pct, rsds_WPERm2 +1 2.71 -10.11 0.00 2.36 99.40 28.41 99.27 +2 2.80 -8.72 0.00 3.97 63.93 25.73 96.38 +3 1.79 -10.50 0.00 2.68 100.00 28.94 98.07 +4 0.12 -9.22 0.09 3.06 95.93 36.06 81.88 +5 -1.52 -11.45 0.06 2.40 100.00 47.65 69.44 +6 -1.72 -15.41 0.00 3.29 100.00 33.13 102.36 +7 4.18 -10.14 0.00 2.77 58.44 20.25 101.18 +8 3.50 -10.83 0.00 3.17 46.22 15.02 102.48 +9 0.96 -11.21 0.00 2.27 45.06 14.44 102.26 +10 1.08 -11.45 0.00 2.60 66.43 27.06 103.27 +11 -0.93 -13.84 0.00 2.37 87.25 22.67 106.95 +12 3.21 -12.43 0.00 3.79 45.98 7.46 107.78 +13 1.79 -11.71 0.00 3.70 21.38 9.27 108.26 +14 1.66 -12.33 0.00 2.38 58.78 13.32 107.17 +15 -2.03 -14.32 0.04 2.59 59.25 20.52 94.57 +16 -7.31 -17.90 0.26 2.08 100.00 32.22 102.40 +17 -3.03 -16.90 0.00 2.56 100.00 67.60 109.84 +18 -3.59 -15.30 0.00 3.39 100.00 60.90 110.76 +19 -2.62 -15.88 0.09 3.79 100.00 40.86 112.96 +20 -3.71 -15.29 0.00 4.59 100.00 35.51 114.25 +21 2.31 -14.50 0.00 3.88 66.32 13.46 113.68 +22 5.21 -9.73 0.00 3.19 60.01 21.41 116.26 +23 6.12 -8.21 0.00 3.19 43.76 16.41 118.05 +24 1.79 -11.01 0.05 5.06 49.84 12.65 118.08 +25 -6.10 -16.03 0.00 6.16 88.70 24.23 120.18 +26 -7.92 -19.11 0.00 4.55 92.77 34.91 121.38 +27 -3.92 -16.81 0.03 4.81 98.18 40.73 121.27 +28 1.26 -13.13 0.00 2.96 100.00 44.68 115.35 +29 -3.00 -13.83 0.00 3.76 99.95 39.29 116.40 +30 -1.89 -14.12 0.10 5.93 87.97 28.81 115.10 +31 -8.68 -17.63 0.20 4.58 100.00 28.04 96.87 +32 -13.04 -20.77 0.17 6.00 95.34 46.09 87.84 +33 -7.56 -21.39 0.00 7.31 80.95 54.69 134.00 +34 -3.54 -16.12 0.00 3.39 65.71 33.80 134.91 +35 -4.49 -16.24 0.00 2.66 74.25 36.71 126.66 +36 -5.84 -17.14 0.00 2.85 76.31 41.83 139.51 +37 -5.05 -15.16 0.00 5.88 70.17 35.64 111.03 +38 -8.17 -16.91 0.00 6.58 82.99 35.31 128.49 +39 -5.47 -14.79 0.00 8.37 68.67 40.39 135.44 +40 -4.64 -15.04 0.39 4.64 94.93 38.55 124.58 +41 -11.12 -25.86 1.30 4.96 100.00 52.03 88.37 +42 -5.66 -25.05 0.00 7.00 74.05 43.67 147.92 +43 -4.45 -15.90 0.00 4.48 89.49 45.32 147.60 +44 -0.01 -13.34 0.00 3.59 83.48 41.91 149.31 +45 4.78 -8.85 0.00 4.95 66.64 14.31 144.39 +46 0.46 -7.74 0.00 4.17 62.75 16.74 152.01 +47 4.16 -9.62 0.00 3.58 60.12 31.71 152.02 +48 4.17 -7.16 0.00 4.19 71.50 32.84 132.05 +49 3.06 -9.20 0.00 5.33 75.22 17.86 156.21 +50 6.17 -6.46 0.00 4.67 64.85 21.93 155.92 +51 3.36 -8.75 0.69 5.24 55.12 25.67 139.03 +52 -6.64 -14.23 0.43 5.81 100.00 30.51 142.81 +53 -2.58 -14.81 0.00 6.24 91.24 47.18 164.22 +54 4.45 -9.55 0.00 3.47 67.27 18.01 166.29 +55 5.78 -8.06 0.00 3.35 47.32 17.44 170.22 +56 5.09 -7.74 0.00 3.58 46.65 13.61 170.02 +57 1.29 -7.55 0.00 6.06 51.88 15.62 135.31 +58 -0.46 -11.36 0.00 3.77 72.94 21.88 174.20 +59 2.28 -11.03 0.07 2.28 51.48 23.03 174.92 +60 0.91 -11.13 0.19 2.50 95.29 20.65 139.69 +61 2.09 -12.22 0.68 4.56 100.00 34.70 160.63 +62 -1.88 -12.42 0.94 4.51 100.00 32.90 152.01 +63 -5.22 -17.51 0.52 6.19 100.00 51.75 144.42 +64 -1.42 -17.72 0.19 2.88 92.51 27.07 187.29 +65 -2.31 -14.30 0.44 2.68 99.30 47.09 164.73 +66 -6.00 -15.13 0.69 3.48 100.00 47.11 160.08 +67 -3.53 -17.33 0.06 2.98 100.00 53.74 180.90 +68 -2.30 -15.61 0.06 2.39 97.84 44.57 189.66 +69 -2.11 -13.59 0.14 2.18 99.48 41.05 145.58 +70 -1.69 -14.19 0.28 3.08 97.91 45.16 183.90 +71 0.09 -13.23 0.47 2.98 100.00 39.80 179.68 +72 -2.18 -12.43 0.00 2.89 99.96 39.08 100.21 +73 0.80 -12.32 0.00 3.10 87.66 32.86 188.64 +74 1.81 -11.33 0.00 3.46 84.93 27.85 195.66 +75 3.89 -10.62 0.07 4.18 75.85 24.74 196.58 +76 -2.67 -11.80 0.03 6.29 83.56 21.59 158.65 +77 -3.93 -13.14 0.09 1.98 100.00 26.57 132.58 +78 0.67 -15.48 0.11 2.84 96.26 42.40 189.99 +79 1.82 -9.71 0.33 4.42 85.73 38.07 161.22 +80 -3.07 -12.38 0.31 7.49 100.00 33.41 162.84 +81 -1.09 -13.82 0.00 2.55 100.00 46.44 191.11 +82 0.33 -12.18 0.73 3.59 86.62 36.45 174.08 +83 1.20 -10.39 0.39 3.18 100.00 34.45 190.50 +84 3.58 -13.02 0.00 3.58 99.33 20.41 209.21 +85 6.22 -7.21 0.00 4.86 58.50 23.13 185.08 +86 2.53 -7.39 0.54 7.73 69.41 19.30 174.26 +87 -1.39 -13.99 1.05 5.21 99.27 23.37 194.00 +88 0.68 -15.24 0.06 5.88 100.00 39.26 213.70 +89 2.39 -11.51 0.05 7.05 89.60 20.81 202.53 +90 -3.64 -15.33 0.00 9.05 74.51 22.66 230.29 +91 4.96 -10.70 0.04 5.53 54.51 18.32 216.65 +92 5.89 -7.32 0.00 5.46 56.81 21.06 199.70 +93 -1.01 -10.83 1.01 4.27 89.12 23.51 189.98 +94 -6.35 -13.61 0.06 6.36 82.00 27.06 142.55 +95 1.94 -14.84 0.00 4.73 59.01 23.72 224.52 +96 4.66 -7.33 0.13 5.73 43.75 18.22 219.39 +97 4.77 -6.11 0.10 5.80 54.54 23.92 217.14 +98 0.45 -7.74 0.46 4.22 96.84 23.50 200.95 +99 7.06 -7.11 0.00 5.13 64.73 29.66 225.62 +100 8.56 -4.09 0.00 4.75 46.88 19.02 227.82 +101 8.47 -3.91 0.00 4.35 47.70 17.82 208.10 +102 8.46 -4.57 0.00 4.26 47.33 21.16 228.82 +103 6.47 -4.98 0.00 2.59 52.39 21.87 171.19 +104 8.07 -5.86 0.00 4.49 76.00 27.21 229.73 +105 9.37 -3.43 0.00 3.86 74.99 27.53 202.21 +106 9.77 -4.28 0.00 5.37 70.52 22.97 234.64 +107 12.39 -3.08 0.10 3.09 63.27 19.72 232.21 +108 9.88 -2.51 0.33 3.09 52.22 18.52 225.24 +109 6.06 -3.78 1.57 3.30 98.78 30.78 191.72 +110 7.55 -6.53 0.43 3.26 99.42 33.03 231.77 +111 6.46 -5.70 0.11 5.23 67.16 27.71 221.69 +112 2.76 -6.61 0.03 4.47 71.88 30.52 216.14 +113 8.97 -6.22 0.00 2.49 62.37 28.61 242.44 +114 11.07 -3.70 0.00 2.76 61.10 25.22 244.45 +115 14.18 -1.69 0.00 3.08 56.01 21.67 236.71 +116 13.17 -1.22 0.00 4.16 49.86 17.72 247.52 +117 11.19 -2.78 0.00 2.40 45.56 15.55 203.64 +118 10.37 -1.64 0.00 3.07 73.38 22.13 250.81 +119 12.15 -2.33 0.00 3.66 53.49 26.69 249.02 +120 9.79 -1.47 0.00 3.09 57.29 25.34 241.29 +121 10.19 -2.11 0.12 3.00 68.93 36.51 269.34 +122 10.42 1.10 0.48 4.28 71.10 32.29 256.94 +123 7.14 -0.41 0.97 3.04 90.06 31.12 251.35 +124 4.28 -5.93 0.74 2.69 70.50 40.10 284.31 +125 6.99 -6.50 0.71 3.89 98.80 35.46 264.57 +126 5.10 -2.72 0.36 4.26 91.97 31.65 277.31 +127 1.89 -5.56 0.17 4.93 57.80 26.46 273.04 +128 0.78 -8.58 0.68 4.45 54.75 24.26 254.74 +129 -2.40 -10.72 0.19 4.49 89.06 28.69 254.58 +130 4.58 -8.73 0.00 2.76 75.16 33.65 269.86 +131 5.69 -3.60 0.33 5.66 68.49 27.49 245.06 +132 3.91 -7.36 0.35 4.13 62.05 23.05 210.90 +133 0.67 -8.39 0.17 2.98 92.24 35.15 289.80 +134 8.57 -6.26 0.00 3.24 74.43 30.14 289.96 +135 8.08 -1.34 0.20 5.46 53.43 23.06 262.64 +136 3.46 -3.91 1.08 2.18 76.04 23.76 235.65 +137 0.77 -5.81 0.93 4.89 88.13 44.95 229.58 +138 2.44 -5.74 0.17 4.61 95.88 58.59 274.83 +139 9.33 -5.38 0.04 3.10 94.52 35.34 288.01 +140 8.09 -1.56 0.05 6.45 64.47 26.74 231.83 +141 1.78 -2.64 0.08 7.65 57.05 30.90 254.72 +142 4.88 -4.41 0.24 5.46 71.96 39.13 271.60 +143 7.38 -3.71 0.30 3.10 82.65 38.88 294.47 +144 8.99 -2.42 0.16 2.16 77.53 35.20 288.30 +145 8.80 -1.28 0.09 2.67 64.84 32.16 246.32 +146 10.67 -0.88 0.09 2.76 71.04 36.86 243.96 +147 10.79 -0.11 0.11 2.38 68.76 35.04 280.64 +148 11.28 1.99 1.35 2.40 85.08 32.70 275.50 +149 7.22 -0.72 1.72 3.19 93.26 36.62 239.54 +150 9.79 -2.12 0.60 2.60 97.28 45.37 284.08 +151 11.54 -0.34 0.10 2.96 69.63 34.76 278.25 +152 11.94 -1.23 0.17 2.27 61.72 24.77 274.53 +153 13.32 -1.32 0.71 2.31 50.13 21.61 289.14 +154 10.66 1.24 1.06 2.40 76.84 21.71 247.46 +155 12.35 -1.34 0.18 2.11 76.30 33.06 290.10 +156 13.23 -1.14 0.00 2.61 58.07 33.66 284.34 +157 16.55 0.67 0.00 2.87 69.02 24.22 294.53 +158 17.45 4.06 0.00 5.45 44.38 20.15 284.42 +159 17.55 4.98 0.00 6.25 38.84 19.56 288.84 +160 17.65 4.68 0.00 5.13 41.39 19.38 287.11 +161 18.01 3.67 0.00 2.74 50.18 19.84 277.25 +162 17.54 4.54 0.05 3.32 42.55 17.99 295.17 +163 17.45 3.54 0.00 5.04 51.53 14.47 299.03 +164 15.52 2.84 0.00 5.83 35.05 13.37 300.13 +165 8.59 -2.49 0.00 4.52 41.40 13.65 268.69 +166 5.92 -8.16 0.00 4.58 55.69 17.49 303.28 +167 13.02 -5.44 0.00 3.96 45.15 16.65 303.45 +168 15.03 1.20 0.00 6.43 27.61 14.05 302.16 +169 13.77 0.45 0.00 2.89 33.57 13.75 269.39 +170 15.94 1.84 0.00 4.85 33.12 18.28 295.64 +171 18.14 3.65 0.00 4.55 38.55 17.99 294.64 +172 18.03 5.69 0.00 4.62 38.14 16.91 295.73 +173 18.24 3.76 0.05 2.87 46.05 15.63 300.14 +174 20.03 4.96 0.00 3.67 42.61 14.62 295.35 +175 20.12 6.33 0.04 2.14 34.94 12.95 286.70 +176 19.42 4.62 0.25 3.50 53.02 17.16 288.46 +177 19.85 6.05 0.30 3.16 58.47 17.69 274.10 +178 18.65 5.87 0.20 2.69 57.95 17.11 258.35 +179 16.73 5.86 0.40 3.07 61.42 20.16 260.67 +180 15.66 3.45 0.63 3.09 67.39 22.11 272.71 +181 17.02 4.14 0.29 3.00 72.93 26.67 282.81 +182 14.93 4.83 1.03 3.21 82.93 31.89 230.63 +183 12.16 4.26 0.56 3.30 95.31 41.64 164.31 +184 15.40 3.15 0.21 2.38 96.70 38.56 273.17 +185 14.22 3.56 0.19 3.90 71.49 32.28 271.26 +186 17.34 3.56 0.00 2.98 65.52 26.45 290.34 +187 19.82 4.25 0.03 2.58 49.12 21.50 289.95 +188 19.82 7.36 0.64 2.27 49.36 21.42 273.76 +189 16.01 7.33 0.23 4.12 63.01 24.37 258.81 +190 17.52 4.24 0.38 3.30 58.54 31.18 263.24 +191 17.90 4.65 0.20 2.67 83.86 31.36 268.72 +192 18.21 4.86 0.45 2.70 65.00 33.76 246.60 +193 17.03 6.16 0.51 2.79 85.61 33.06 264.85 +194 15.62 5.79 0.25 2.66 80.89 32.45 238.31 +195 16.22 4.47 0.03 3.30 69.47 34.95 256.73 +196 17.52 4.55 0.71 2.78 67.92 33.73 259.61 +197 16.12 4.54 0.26 2.88 81.08 30.41 243.01 +198 14.41 3.46 0.38 1.69 88.00 31.17 206.70 +199 14.91 3.16 0.21 1.99 87.18 35.66 264.15 +200 17.61 4.13 0.00 4.56 67.93 24.40 280.85 +201 18.62 4.25 0.00 3.37 35.88 19.53 282.27 +202 18.91 5.98 0.04 4.69 37.81 16.47 282.27 +203 19.11 6.07 0.07 3.36 38.44 17.24 269.44 +204 18.52 5.54 0.11 2.79 45.27 19.83 265.98 +205 17.21 5.84 0.15 3.10 48.71 21.30 262.27 +206 15.73 4.06 0.40 3.08 72.85 25.06 224.74 +207 13.27 2.75 0.55 3.29 94.34 30.15 208.82 +208 14.99 2.07 0.08 2.67 90.04 31.38 272.19 +209 15.82 1.62 0.03 2.55 74.03 24.60 276.24 +210 17.11 3.54 0.00 2.90 48.52 20.62 273.03 +211 18.63 4.35 0.12 2.89 43.69 21.31 268.03 +212 17.14 5.04 0.00 2.79 50.79 20.42 265.00 +213 16.52 5.64 0.09 2.59 67.78 27.21 235.40 +214 17.12 4.44 0.42 3.10 68.77 30.89 258.36 +215 18.02 5.06 0.05 3.40 84.09 31.29 258.23 +216 18.82 5.95 0.00 2.49 75.82 32.40 263.85 +217 18.39 5.75 0.07 3.10 45.12 23.01 263.51 +218 16.59 5.43 0.00 3.30 73.99 26.38 267.45 +219 14.02 1.77 0.00 2.70 99.49 30.40 264.69 +220 13.92 0.75 0.32 2.29 83.75 36.73 257.39 +221 10.71 1.96 0.76 3.17 99.42 36.51 207.48 +222 10.60 -1.06 0.43 2.28 100.00 44.96 230.30 +223 9.52 -1.56 0.66 2.60 100.00 45.78 223.21 +224 8.62 2.71 0.70 2.30 100.00 57.54 155.38 +225 12.52 0.61 0.67 3.27 100.00 43.33 248.38 +226 14.00 1.27 0.40 2.99 87.54 40.04 248.38 +227 13.62 3.04 0.71 1.88 96.87 39.69 216.97 +228 12.12 2.54 0.81 2.80 93.67 41.26 223.09 +229 12.62 0.35 0.22 1.80 100.00 44.36 245.55 +230 13.52 1.33 0.09 2.98 98.48 34.51 254.96 +231 15.12 1.68 0.00 2.79 64.88 28.98 254.25 +232 16.41 2.45 0.00 2.08 65.79 29.94 245.37 +233 17.03 5.22 0.72 2.48 72.96 29.04 242.97 +234 13.52 4.15 0.35 3.28 83.70 28.14 228.13 +235 15.12 1.94 0.14 2.58 64.86 34.77 238.16 +236 15.05 3.84 0.07 3.09 60.23 28.91 215.46 +237 15.43 3.67 0.26 3.19 72.84 30.83 225.18 +238 15.21 4.06 0.14 2.50 58.54 30.16 237.15 +239 13.60 1.84 0.11 2.20 83.91 33.31 226.52 +240 14.92 1.93 0.04 2.47 90.24 35.00 232.30 +241 15.33 4.05 0.07 3.87 62.04 32.97 225.34 +242 15.64 3.97 0.18 3.97 69.78 32.83 220.34 +243 14.55 4.41 0.50 2.38 79.48 29.99 204.64 +244 13.85 2.20 0.36 3.45 79.26 28.72 233.71 +245 16.25 2.42 0.30 3.08 54.71 30.55 229.00 +246 13.09 3.32 0.30 2.98 81.12 25.01 207.71 +247 15.66 1.67 0.00 3.48 81.41 29.08 239.59 +248 13.34 3.38 0.27 3.19 68.48 27.40 193.89 +249 10.30 0.60 0.56 3.59 82.05 34.70 190.96 +250 6.19 0.61 0.60 1.68 100.00 46.54 115.70 +251 13.15 -1.26 0.55 2.29 92.15 39.61 233.69 +252 12.87 0.50 0.43 2.47 86.03 32.77 224.97 +253 11.06 1.71 0.33 2.90 79.17 33.11 199.91 +254 11.85 0.22 0.00 3.48 72.68 33.90 205.47 +255 12.46 0.51 0.00 2.59 65.27 34.48 218.19 +256 13.56 2.21 0.05 3.20 63.58 29.17 226.28 +257 13.56 2.48 0.09 1.81 50.65 25.10 221.61 +258 12.65 0.67 0.04 2.92 75.25 24.31 219.34 +259 10.62 -1.79 0.00 2.20 86.64 34.96 222.93 +260 10.74 -3.01 0.00 2.66 85.87 24.16 227.26 +261 14.37 -2.12 0.00 2.89 37.70 14.85 226.09 +262 13.76 0.51 0.00 4.59 28.11 14.65 221.87 +263 14.05 1.81 0.00 3.87 48.56 17.09 209.27 +264 12.55 1.42 0.00 4.17 60.58 25.39 197.06 +265 14.46 1.91 0.00 4.30 62.26 27.67 205.31 +266 12.15 0.89 0.05 2.90 57.56 25.92 159.31 +267 11.46 0.41 0.10 2.29 69.77 27.87 194.24 +268 10.77 -0.71 0.00 5.86 74.36 25.60 200.77 +269 9.34 -2.72 0.00 4.43 67.18 17.80 209.88 +270 12.17 -2.57 0.00 3.78 44.48 20.66 205.17 +271 13.76 0.89 0.00 4.66 41.26 20.45 202.99 +272 13.36 1.41 0.00 4.86 56.62 20.56 191.94 +273 10.95 1.18 0.00 3.69 56.65 22.92 177.60 +274 10.93 -1.65 0.00 2.58 88.97 29.42 202.83 +275 10.94 0.84 0.07 3.86 75.87 34.97 171.22 +276 5.63 -1.54 0.06 5.06 82.78 46.24 173.66 +277 8.11 -3.80 0.14 4.16 93.87 45.23 180.53 +278 5.82 -2.13 0.09 4.53 88.47 33.46 197.41 +279 8.82 -3.73 0.00 3.08 85.04 35.92 199.02 +280 9.62 -3.35 0.00 3.76 71.56 30.82 197.83 +281 7.04 -1.72 0.03 5.35 69.91 31.12 153.41 +282 4.53 -2.34 0.00 2.91 84.56 34.94 185.94 +283 7.94 -5.41 0.00 4.06 79.67 40.82 188.42 +284 8.65 -0.55 0.03 7.53 68.11 31.09 182.08 +285 5.02 -4.22 0.00 5.64 80.35 29.83 159.39 +286 4.22 -1.57 0.19 3.93 72.08 37.25 116.29 +287 4.34 -3.67 0.83 3.44 99.30 36.34 165.91 +288 -0.75 -4.53 1.72 4.15 100.00 36.34 127.80 +289 -1.25 -8.33 0.25 4.86 100.00 54.53 134.67 +290 0.13 -9.21 0.00 5.08 90.87 58.46 168.39 +291 3.81 -8.63 0.00 3.06 96.17 34.70 178.12 +292 6.82 -5.76 0.00 4.27 56.71 18.44 179.84 +293 6.44 -5.14 0.00 3.77 34.23 17.93 176.62 +294 3.12 -7.19 0.00 2.07 77.81 20.68 171.62 +295 0.69 -8.19 0.00 2.73 74.43 28.92 170.22 +296 2.99 -8.69 0.00 3.83 74.00 32.52 167.94 +297 -0.27 -8.17 0.60 3.15 76.89 31.63 131.26 +298 -4.56 -11.06 0.10 3.26 100.00 45.65 163.11 +299 8.01 -8.55 0.03 4.15 87.27 24.54 160.04 +300 7.73 -4.05 0.00 4.14 48.27 24.46 153.13 +301 6.53 -4.16 0.00 4.84 56.53 26.50 143.11 +302 4.22 -3.26 0.32 7.64 76.47 34.03 136.53 +303 -4.16 -9.43 0.85 3.70 94.71 34.62 133.34 +304 -3.39 -11.28 0.43 3.79 100.00 65.71 155.62 +305 3.20 -9.87 0.00 5.89 91.13 39.28 148.56 +306 3.74 -6.89 0.00 4.90 88.57 39.67 144.27 +307 5.79 -6.79 0.00 2.76 79.11 30.82 146.34 +308 7.49 -5.79 0.00 3.47 72.67 19.40 145.85 +309 5.39 -6.66 0.00 2.26 48.95 19.46 141.06 +310 7.00 -4.63 0.00 3.25 56.71 25.95 125.78 +311 4.31 -4.79 0.49 3.89 81.26 28.43 120.71 +312 0.40 -7.55 0.08 2.80 95.14 33.01 106.21 +313 1.48 -11.47 0.00 3.07 79.63 39.89 138.46 +314 3.53 -8.59 0.00 2.10 71.00 24.38 138.38 +315 3.41 -9.29 0.00 2.06 54.09 22.47 135.46 +316 5.49 -8.01 0.00 3.47 51.50 23.15 132.78 +317 7.30 -5.58 0.00 3.97 45.59 24.05 127.58 +318 6.81 -3.97 0.00 5.83 62.68 26.15 126.58 +319 5.10 -5.02 0.00 5.12 70.34 29.19 118.54 +320 8.80 -3.75 0.00 3.46 73.04 29.63 124.40 +321 9.71 -3.67 0.00 4.58 52.09 14.07 125.89 +322 -0.19 -11.46 0.28 7.57 85.61 13.18 92.24 +323 -5.52 -14.99 0.00 4.06 90.85 37.40 122.49 +324 2.01 -13.99 0.00 3.94 81.89 21.70 121.30 +325 2.08 -10.66 0.00 5.04 79.01 24.84 115.97 +326 2.90 -7.77 0.00 5.96 76.56 30.12 115.27 +327 2.36 -8.96 0.51 5.11 97.95 32.26 104.27 +328 6.48 -5.19 0.00 5.93 73.26 21.48 117.69 +329 2.01 -11.26 0.76 4.56 54.85 20.99 105.10 +330 -6.43 -16.56 0.11 2.46 100.00 26.82 115.50 +331 -3.73 -14.84 0.18 3.04 90.12 42.00 110.72 +332 -3.62 -13.81 0.08 2.96 92.94 49.85 110.61 +333 -1.90 -12.81 0.77 2.45 97.16 54.14 95.37 +334 -8.95 -15.61 0.07 8.73 100.00 43.87 108.60 +335 -7.99 -18.67 0.07 7.93 77.06 65.76 105.67 +336 -3.66 -13.83 0.00 8.99 70.78 61.10 106.37 +337 -3.18 -9.69 0.00 6.40 75.58 54.21 107.38 +338 1.07 -9.91 0.00 3.66 62.63 28.75 106.67 +339 1.22 -6.58 0.00 4.97 48.77 30.35 105.77 +340 4.64 -5.28 0.00 5.36 50.21 26.46 104.18 +341 5.05 -4.66 0.00 3.46 46.66 23.10 102.77 +342 4.63 -5.48 0.00 3.56 52.09 25.35 102.39 +343 7.11 -4.09 0.00 4.38 43.30 16.42 100.27 +344 4.74 -4.84 0.00 4.39 36.70 19.85 99.09 +345 -0.63 -6.98 0.36 3.28 77.00 25.27 70.58 +346 -1.58 -9.41 0.00 3.23 81.93 33.78 102.77 +347 -3.79 -11.57 0.28 3.46 81.31 34.75 93.12 +348 -3.21 -12.90 0.14 6.13 97.40 54.06 90.01 +349 -1.79 -10.58 0.34 6.80 80.08 52.20 96.26 +350 -5.27 -13.96 0.25 6.03 90.71 49.65 97.05 +351 -10.99 -17.07 0.25 3.65 94.98 53.46 103.87 +352 -2.92 -15.68 0.00 4.48 67.16 39.11 101.39 +353 -0.68 -8.41 0.03 5.23 69.96 33.94 86.34 +354 0.34 -3.94 0.31 8.60 79.44 58.12 88.88 +355 -3.50 -10.79 1.35 2.56 98.55 55.58 46.35 +356 -10.31 -17.88 0.87 2.78 99.91 55.28 82.27 +357 -14.81 -23.36 0.00 3.86 80.44 49.50 103.48 +358 -10.79 -23.39 0.00 4.66 68.63 38.01 104.29 +359 -9.27 -17.27 0.23 4.55 76.66 44.12 97.88 +360 -13.79 -20.56 0.18 4.66 87.05 51.14 101.67 +361 -10.05 -19.28 1.43 2.96 99.58 59.20 68.52 +362 -13.88 -22.27 0.00 4.23 80.12 49.11 93.80 +363 -7.10 -20.25 0.00 5.12 73.70 60.02 103.29 +364 -3.16 -9.97 0.65 5.44 90.23 60.83 91.79 +365 -6.69 -12.42 0.57 3.72 90.42 53.39 95.28 diff --git a/inst/extdata/example1/Input/data_weather_maca/weath.1980 b/inst/extdata/example1/Input/data_weather_maca/weath.1980 new file mode 100644 index 00000000..19a661b0 --- /dev/null +++ b/inst/extdata/example1/Input/data_weather_maca/weath.1980 @@ -0,0 +1,368 @@ +# weather for site maca example at -105.58 / 39.59 year = 1980 +# DOY, Tmax_C, Tmin_C, PPT_cm, uas_mPERs, vas_mPERs, hursmax_pct, hursmin_pct, rsds_WPERm2 +1 -0.01 -11.99 0.00 3.31 -0.85 83.82 33.27 107.19 +2 1.27 -10.98 0.00 4.20 0.16 87.07 33.74 103.02 +3 1.92 -8.39 0.00 4.43 -0.39 92.60 44.30 98.53 +4 -0.30 -12.19 0.00 3.55 -1.13 99.95 47.18 104.83 +5 2.59 -9.32 0.05 5.20 0.67 88.96 38.51 94.22 +6 2.36 -5.47 0.17 4.33 1.44 91.39 53.32 84.92 +7 1.31 -12.42 0.04 2.48 -2.06 95.81 50.51 101.75 +8 -1.29 -15.72 0.00 4.68 -1.43 73.09 46.72 100.37 +9 -2.03 -12.36 0.00 5.14 -1.80 71.72 34.23 100.46 +10 -7.37 -17.86 0.00 3.19 -3.01 56.63 37.96 101.56 +11 -2.26 -13.70 0.00 4.01 -2.66 87.06 32.75 98.21 +12 1.45 -8.76 0.04 3.86 -2.18 94.92 42.37 97.27 +13 -0.45 -11.69 0.00 2.20 1.27 71.93 51.41 88.14 +14 -1.86 -12.80 0.08 1.74 -2.15 78.19 48.84 99.31 +15 -4.31 -17.34 0.00 2.82 -0.40 80.55 32.28 110.65 +16 -3.82 -14.63 0.00 3.86 0.28 68.77 30.43 113.33 +17 -4.41 -13.59 0.00 3.84 0.27 71.64 24.64 114.64 +18 -4.50 -15.44 0.29 1.91 -1.95 99.88 36.41 112.11 +19 -5.80 -16.78 0.00 3.72 -1.73 94.95 33.64 114.54 +20 -2.88 -14.31 0.04 3.80 -2.31 71.88 37.54 118.84 +21 -3.49 -14.30 0.00 2.86 -3.47 55.24 13.55 128.65 +22 3.97 -13.27 0.00 4.47 -1.21 51.60 11.65 130.84 +23 5.25 -8.02 0.00 4.77 -0.21 50.84 10.07 123.71 +24 5.25 -7.08 0.00 4.30 -0.61 62.34 28.04 112.36 +25 2.88 -5.61 0.00 4.81 -0.06 70.15 43.75 96.92 +26 6.18 -3.81 0.29 4.29 1.89 99.07 49.79 99.92 +27 4.90 -7.22 0.25 3.99 0.66 94.92 43.74 111.12 +28 -1.29 -12.68 0.00 3.91 -0.54 99.94 38.58 134.32 +29 -2.04 -10.49 0.03 5.41 0.25 60.06 26.82 106.29 +30 -3.91 -14.06 0.00 4.54 0.59 43.69 22.55 110.88 +31 -2.46 -10.47 0.33 4.68 3.05 58.61 36.49 118.97 +32 -2.62 -23.24 0.68 2.88 -2.45 100.00 40.54 143.27 +33 -11.72 -29.23 0.00 4.43 -0.86 99.97 36.37 151.17 +34 -11.07 -17.25 0.37 2.03 0.38 99.65 46.57 115.73 +35 -11.53 -22.21 0.10 2.64 -2.40 93.27 52.70 131.28 +36 -13.15 -23.32 0.00 2.47 -4.48 96.67 46.23 130.91 +37 -9.55 -19.67 0.00 3.05 -2.56 75.23 44.16 135.24 +38 -3.85 -20.32 0.00 2.81 -0.25 88.25 29.08 157.53 +39 -6.22 -17.65 0.03 1.51 -0.45 75.62 48.17 116.59 +40 -8.05 -16.28 0.00 1.81 0.33 89.77 41.52 135.56 +41 -6.60 -17.63 0.00 2.52 -1.15 99.96 47.30 140.08 +42 -3.13 -16.05 0.00 3.27 -1.47 84.17 43.49 146.14 +43 0.76 -16.86 0.00 3.81 -1.37 75.50 33.91 158.94 +44 2.59 -9.04 0.00 5.89 -2.59 82.05 35.03 153.32 +45 2.25 -9.35 0.00 5.63 -3.66 65.35 33.35 147.54 +46 2.78 -8.99 0.17 7.78 -1.58 59.51 29.14 154.36 +47 1.04 -9.79 0.00 8.10 -2.28 48.27 23.34 147.47 +48 8.07 -6.99 0.10 10.05 -0.14 48.75 22.84 169.41 +49 5.85 -6.87 0.00 9.81 0.50 50.55 23.94 164.50 +50 5.74 -4.76 0.00 9.48 1.56 50.58 25.19 154.78 +51 4.82 -3.81 0.63 10.06 0.36 57.11 24.43 178.37 +52 7.51 -4.73 0.00 7.64 2.38 49.94 24.60 168.90 +53 8.68 -1.79 0.00 7.19 5.75 46.51 22.26 167.14 +54 8.41 -9.35 0.15 7.49 -1.00 26.91 14.34 161.69 +55 -0.12 -12.41 0.25 9.27 -0.28 43.16 18.88 165.76 +56 -2.23 -15.39 0.00 4.50 -4.24 44.79 20.82 173.74 +57 -3.58 -20.16 0.00 3.83 -1.24 44.38 21.69 182.45 +58 4.74 -9.91 0.10 4.71 -0.81 53.52 22.37 170.36 +59 9.52 -5.62 0.00 6.42 -1.04 60.10 20.80 178.84 +60 8.48 -6.21 0.00 5.58 -0.49 63.97 17.88 177.17 +61 7.43 -6.81 0.00 4.75 0.07 67.84 14.96 175.51 +62 7.62 -7.71 0.00 2.28 -0.41 65.15 24.34 192.41 +63 9.59 -8.10 0.00 2.98 1.50 56.65 24.18 203.34 +64 9.92 -5.46 0.00 4.07 1.32 61.91 20.73 198.57 +65 10.06 -3.88 0.03 4.62 1.03 67.65 22.95 170.20 +66 9.57 -2.67 0.00 3.20 0.54 99.08 27.12 192.33 +67 10.14 -5.28 0.00 2.84 4.40 99.97 21.35 199.85 +68 9.48 -6.87 0.00 5.18 1.40 51.56 21.11 199.73 +69 4.57 -10.47 0.00 3.41 1.40 50.78 19.70 212.08 +70 5.22 -9.16 0.06 3.58 -0.11 62.54 24.76 198.11 +71 7.39 -8.48 0.03 2.99 4.11 56.46 27.86 167.23 +72 6.48 -3.21 0.16 4.07 2.39 55.45 29.73 165.11 +73 3.12 -9.67 0.06 -0.63 -0.55 58.45 28.90 175.34 +74 3.92 -6.35 0.11 2.49 2.04 85.63 35.62 162.68 +75 6.94 -7.89 0.13 3.61 0.33 59.56 26.78 203.53 +76 7.35 -5.13 0.06 4.40 1.21 57.92 23.27 167.30 +77 5.98 -8.28 0.04 2.38 -0.82 61.29 30.03 193.87 +78 1.13 -9.60 1.06 -2.00 -3.47 67.48 33.88 174.78 +79 -0.92 -11.74 0.30 2.16 -4.93 71.89 34.30 194.58 +80 2.36 -10.42 0.00 4.93 -4.23 57.62 28.11 209.74 +81 2.44 -9.07 0.00 4.61 -5.36 44.03 23.28 187.04 +82 0.96 -10.67 0.05 3.76 -6.25 46.55 25.42 173.95 +83 0.87 -6.18 0.00 2.80 -6.42 67.41 33.55 180.27 +84 7.67 -5.31 0.00 2.45 -6.05 65.81 26.63 206.31 +85 10.43 -7.58 0.00 3.58 -2.47 56.89 17.48 229.14 +86 10.99 -6.15 0.00 3.00 -2.60 51.15 14.40 201.77 +87 7.31 -9.39 0.00 1.35 -0.07 47.07 23.82 211.64 +88 10.00 -7.26 0.00 2.97 -2.37 50.80 17.49 229.08 +89 11.87 -8.34 0.00 3.80 -1.68 34.97 11.90 232.16 +90 15.72 -4.49 0.00 4.62 -1.18 36.07 9.78 230.35 +91 14.84 0.13 0.00 4.75 -0.58 47.73 14.57 217.67 +92 11.92 0.12 0.06 3.88 1.93 70.53 22.95 229.55 +93 9.46 -8.27 0.00 3.96 -0.35 51.91 18.66 230.83 +94 7.31 -2.76 0.00 -0.75 1.57 57.73 17.58 171.16 +95 2.61 -4.19 0.09 -0.68 -3.81 96.20 47.36 172.95 +96 5.89 -8.29 0.06 3.28 0.50 83.58 35.84 216.06 +97 6.59 -3.89 0.00 3.96 2.03 67.42 34.88 178.43 +98 5.25 -6.96 0.00 3.60 0.24 60.27 30.46 217.21 +99 3.75 -9.55 0.00 2.08 -2.39 63.89 28.45 212.61 +100 2.20 -9.97 0.11 2.41 -0.07 57.22 29.54 207.41 +101 4.93 -12.22 0.03 2.73 -2.73 54.11 17.53 241.60 +102 12.76 -7.10 0.00 3.94 1.99 31.45 14.46 233.00 +103 12.77 2.66 0.00 5.72 4.04 38.16 12.33 191.67 +104 6.37 -2.56 0.53 4.41 -1.21 64.63 33.17 199.06 +105 5.24 -3.39 0.86 -4.18 2.20 99.97 44.78 113.21 +106 -0.03 -8.04 1.19 -3.90 0.86 79.25 61.79 143.25 +107 1.18 -12.90 0.24 -0.53 -3.43 93.69 41.35 247.94 +108 1.44 -7.06 0.04 2.05 -3.11 84.52 42.26 217.92 +109 2.82 -5.99 0.00 2.44 -3.06 98.89 42.97 216.47 +110 11.87 -5.29 0.00 4.67 -1.38 96.70 25.80 258.27 +111 12.48 -0.71 0.20 6.19 0.00 52.74 21.77 248.47 +112 11.66 -1.69 0.00 5.32 0.87 54.59 20.18 225.29 +113 10.68 0.69 0.00 6.53 3.01 40.86 20.16 248.25 +114 9.99 -4.63 0.00 4.86 1.71 53.65 20.29 222.17 +115 3.53 -7.79 0.35 3.84 -3.10 71.14 26.96 244.71 +116 5.89 -11.60 0.00 2.28 1.43 58.43 23.47 240.95 +117 7.28 0.30 0.00 3.62 1.10 59.27 29.57 230.00 +118 8.62 -7.46 0.00 3.12 -2.49 67.76 25.90 277.74 +119 12.04 -1.58 0.04 2.41 4.74 40.06 24.67 207.54 +120 11.78 0.86 0.00 4.67 1.65 70.42 26.82 225.43 +121 10.02 -4.20 0.00 4.07 -0.17 63.08 26.63 239.21 +122 10.41 -5.36 0.00 3.63 1.90 53.58 23.60 270.55 +123 11.01 -4.05 0.00 3.45 -1.37 44.76 21.55 294.79 +124 14.12 -1.29 0.06 -0.93 2.93 39.87 18.94 256.98 +125 13.92 1.50 0.00 2.53 -0.29 48.16 20.77 206.56 +126 6.96 -2.40 0.90 -1.36 1.75 71.83 36.54 202.81 +127 6.18 -1.60 1.09 2.62 -1.59 63.64 39.81 231.55 +128 2.42 -7.54 0.13 3.12 -3.19 99.97 29.86 248.95 +129 8.31 -4.07 0.00 4.71 -0.39 48.14 27.78 238.26 +130 11.59 -1.47 0.00 5.07 0.55 57.59 24.81 266.50 +131 11.22 -1.16 0.06 1.26 -0.59 50.53 25.91 240.28 +132 8.98 1.81 0.50 -2.48 3.09 60.43 28.09 200.77 +133 10.72 -1.81 0.32 3.12 1.66 54.90 26.28 292.55 +134 10.98 -1.62 0.11 -2.01 -4.19 62.71 26.74 255.87 +135 5.19 -4.44 0.83 -4.71 -0.41 76.75 33.35 221.26 +136 -0.24 -7.45 1.10 -5.54 1.90 61.54 46.22 183.91 +137 3.49 -4.55 0.42 -0.42 5.80 87.00 45.90 200.66 +138 12.26 -1.49 0.00 2.70 3.45 82.01 36.98 274.30 +139 12.82 1.88 0.00 3.40 1.84 77.13 35.10 236.68 +140 12.93 0.60 0.15 1.93 -1.68 69.41 34.83 275.95 +141 11.31 1.21 0.58 -1.47 0.22 83.30 39.40 247.80 +142 12.33 0.98 1.32 -1.46 3.27 77.58 43.03 241.73 +143 13.80 2.72 0.30 1.72 2.86 85.75 30.98 281.69 +144 15.13 1.30 0.48 1.66 2.80 60.95 26.98 289.54 +145 14.93 1.86 0.56 1.24 3.54 71.21 32.12 289.86 +146 14.90 1.45 0.44 1.67 2.34 87.28 28.96 297.24 +147 14.71 2.69 0.26 2.34 0.68 91.37 35.66 296.27 +148 15.06 4.52 0.11 1.63 -2.27 80.32 32.79 274.73 +149 14.16 3.79 1.27 0.80 -1.12 84.45 37.36 274.76 +150 10.48 1.03 0.86 2.85 -1.22 87.65 36.69 275.50 +151 17.50 2.38 0.00 3.14 3.13 71.77 23.68 292.94 +152 16.20 0.13 0.00 3.84 1.36 50.13 20.91 300.32 +153 16.60 1.67 0.00 3.82 2.63 47.36 16.35 297.57 +154 16.36 3.64 0.00 5.51 2.00 43.35 16.76 301.60 +155 15.14 -0.98 0.00 2.18 -1.84 52.70 20.27 302.33 +156 14.60 0.91 0.03 -2.25 -0.15 68.32 23.01 280.84 +157 14.77 4.14 0.17 -2.61 3.26 89.31 34.39 262.81 +158 20.08 4.20 0.00 2.32 4.23 50.53 19.17 297.52 +159 20.17 3.22 0.00 2.29 3.12 41.35 19.26 290.48 +160 21.53 5.79 0.00 4.09 4.60 33.51 14.49 302.90 +161 21.39 3.60 0.00 3.62 -0.72 37.76 13.34 305.32 +162 17.18 2.93 0.21 -2.25 1.78 48.73 17.70 288.03 +163 14.15 0.83 2.83 -3.75 -2.53 74.59 32.75 240.87 +164 13.75 -0.32 0.00 -0.72 -1.41 94.01 27.45 300.72 +165 16.82 -0.26 0.05 2.25 2.74 62.33 20.74 305.96 +166 21.31 3.94 0.00 3.21 2.37 40.07 17.50 302.26 +167 20.95 4.50 0.00 1.92 1.32 52.19 18.61 288.10 +168 20.96 4.27 0.00 2.51 0.97 47.27 16.48 298.06 +169 20.70 4.15 0.00 1.84 -2.85 44.04 17.24 298.61 +170 20.85 6.52 0.00 0.71 2.23 49.40 19.01 279.59 +171 20.04 5.98 0.19 -1.06 1.41 56.45 26.70 278.99 +172 20.42 7.57 0.00 0.72 3.27 68.80 25.17 289.00 +173 23.63 8.49 0.04 3.33 2.59 46.36 15.45 286.01 +174 23.20 7.17 0.00 4.08 2.05 43.16 13.81 286.75 +175 23.18 5.62 0.00 4.07 0.74 31.77 13.01 299.18 +176 22.75 5.27 0.00 4.01 -0.49 36.78 14.20 303.47 +177 21.91 4.24 0.00 2.97 -0.20 50.02 16.97 305.43 +178 21.85 7.13 0.00 4.25 4.13 27.25 13.36 303.61 +179 21.22 4.95 0.03 3.05 1.84 36.03 14.24 298.84 +180 20.55 6.31 0.17 1.28 2.71 50.10 19.91 273.64 +181 19.57 5.95 0.11 2.70 2.35 70.70 22.54 279.16 +182 20.55 7.11 0.08 3.26 -0.14 59.18 22.05 282.12 +183 21.25 6.87 0.00 2.91 -1.31 43.82 16.79 288.43 +184 22.50 4.83 0.00 1.61 1.12 43.45 16.70 294.69 +185 23.78 4.62 0.04 1.58 0.72 41.29 14.37 291.33 +186 25.39 7.57 0.00 2.09 1.74 43.98 15.42 292.71 +187 26.02 8.85 0.00 2.66 2.00 35.27 14.83 286.91 +188 25.60 8.96 0.12 2.78 0.91 39.13 16.60 277.59 +189 25.53 9.42 0.00 2.55 1.71 44.46 16.76 299.76 +190 25.30 9.14 0.08 1.96 2.78 38.10 18.23 295.12 +191 23.38 8.19 0.10 1.16 3.63 36.72 18.70 286.02 +192 22.54 10.08 0.31 3.44 4.82 48.48 20.68 281.61 +193 20.00 8.46 1.33 3.56 3.54 74.09 25.76 270.26 +194 18.57 8.33 0.72 2.63 0.61 75.44 31.67 271.64 +195 19.93 7.37 0.94 2.50 3.12 74.82 28.64 281.95 +196 18.03 7.29 1.14 2.38 3.39 84.72 31.82 250.04 +197 20.81 7.00 0.81 3.59 0.84 99.91 26.07 280.92 +198 21.91 5.81 0.00 5.34 0.79 42.11 14.58 291.94 +199 21.29 3.70 0.05 3.44 -1.45 37.95 14.87 291.79 +200 20.38 4.42 0.25 0.94 -0.89 48.25 18.92 279.13 +201 20.55 6.38 0.72 2.12 -1.01 47.84 21.37 266.10 +202 19.97 7.06 0.86 3.46 -0.19 46.50 23.25 252.43 +203 18.98 6.53 0.61 3.52 -0.74 55.31 25.50 263.29 +204 18.09 6.36 1.18 2.28 -1.22 75.10 39.47 263.61 +205 17.18 6.65 1.05 2.24 0.92 79.06 34.53 255.76 +206 16.73 5.70 0.66 2.38 3.54 92.04 32.52 255.20 +207 15.57 3.17 0.86 1.57 4.15 92.63 35.27 172.37 +208 13.60 3.82 1.07 2.21 3.46 99.98 49.06 212.20 +209 15.98 4.51 0.72 3.08 1.97 99.96 40.37 244.73 +210 17.08 3.17 0.00 3.45 0.51 91.65 34.52 251.73 +211 17.58 3.86 0.11 3.46 -0.13 76.21 32.65 249.90 +212 17.33 5.14 0.17 3.16 -1.42 83.64 35.76 238.46 +213 17.56 5.22 0.55 2.74 -1.66 99.95 37.30 262.74 +214 17.68 6.17 1.12 2.08 -0.09 95.89 38.87 229.10 +215 16.75 7.55 0.50 2.25 2.34 94.19 43.92 228.92 +216 17.67 7.19 0.46 2.66 2.75 99.95 36.81 225.18 +217 18.39 5.29 0.07 2.95 1.77 83.75 34.85 234.15 +218 19.07 4.74 0.18 3.19 0.75 77.60 32.33 255.75 +219 19.52 3.56 0.53 2.10 -1.19 70.06 28.54 265.60 +220 19.17 4.26 0.00 -1.47 -0.68 81.61 31.23 251.55 +221 18.62 5.77 0.31 0.13 2.83 99.94 35.45 266.45 +222 21.72 5.85 0.00 2.24 1.22 64.48 21.81 277.95 +223 23.11 4.63 0.00 2.91 -0.51 42.25 14.90 279.35 +224 22.79 5.22 0.00 2.56 -0.71 29.59 13.26 260.86 +225 21.51 8.10 0.00 -1.48 -0.52 50.93 19.65 235.06 +226 21.61 7.35 0.00 0.54 3.81 77.47 27.83 252.65 +227 22.36 7.29 0.09 2.93 1.33 59.84 22.50 265.12 +228 21.83 5.30 0.00 2.00 -0.12 63.47 23.75 256.03 +229 21.71 5.50 0.28 1.51 2.60 80.32 24.64 252.98 +230 21.95 7.36 0.07 2.83 2.53 64.62 25.93 255.10 +231 20.24 7.53 0.35 2.81 2.20 74.08 30.19 245.86 +232 19.96 7.37 0.83 3.54 1.89 73.67 30.39 260.17 +233 19.69 7.88 0.59 2.81 -0.32 72.34 32.92 238.86 +234 17.96 7.73 0.63 0.94 -2.85 93.64 37.41 235.31 +235 14.70 6.62 1.31 -1.99 -0.62 89.60 43.15 215.83 +236 18.89 6.36 0.77 1.93 -0.28 84.40 27.56 235.41 +237 19.56 3.48 0.04 3.71 0.27 57.03 23.88 247.45 +238 18.73 2.62 0.00 3.03 -1.47 61.25 23.28 241.69 +239 19.62 2.81 0.00 2.65 0.30 50.86 21.52 263.11 +240 20.03 3.22 0.00 3.34 -0.46 48.23 21.21 262.55 +241 19.16 7.30 0.00 3.78 4.16 39.22 20.85 236.62 +242 19.54 6.98 0.00 3.15 5.15 60.16 21.24 229.18 +243 18.10 3.86 0.00 3.78 4.44 52.90 22.89 242.80 +244 14.91 -0.23 0.09 2.45 -1.13 57.06 24.91 248.03 +245 14.49 0.20 0.21 -1.73 -1.18 61.37 30.32 241.79 +246 15.19 0.37 0.85 0.08 0.25 67.63 33.24 224.70 +247 15.23 4.20 2.02 0.36 -1.34 69.84 31.75 218.28 +248 15.68 2.91 0.00 7.02 -1.11 63.49 28.14 236.00 +249 14.37 -0.36 0.00 2.42 -1.64 68.15 30.65 189.86 +250 15.99 0.22 0.00 2.11 0.05 93.76 28.23 247.63 +251 19.10 3.57 0.00 3.02 3.25 58.91 24.86 244.03 +252 18.99 1.84 0.00 3.35 -1.14 50.05 24.31 246.89 +253 19.25 2.35 0.00 1.37 2.45 53.63 22.52 245.86 +254 19.59 5.91 0.00 2.30 3.38 56.80 24.20 227.63 +255 20.05 4.82 0.00 2.84 1.68 61.43 25.05 242.81 +256 19.91 5.21 0.06 3.09 2.17 57.56 24.19 240.92 +257 19.20 5.99 0.09 4.18 2.88 56.53 22.96 226.35 +258 15.44 0.90 0.35 2.32 0.71 66.47 28.35 203.15 +259 8.77 -4.05 0.27 1.52 -4.87 63.81 29.14 211.29 +260 12.44 -5.14 0.00 2.39 1.88 79.19 25.45 240.99 +261 12.74 0.52 0.00 3.24 2.87 67.88 28.35 193.59 +262 15.04 1.65 0.00 3.95 -1.60 76.94 26.72 231.36 +263 17.08 1.55 0.04 2.96 0.94 60.12 26.84 223.20 +264 17.24 3.69 0.00 3.97 0.20 62.36 26.62 205.51 +265 17.60 4.83 0.00 3.74 0.88 73.63 25.93 190.80 +266 13.82 3.49 0.24 3.82 0.00 84.67 33.21 198.75 +267 10.51 -3.05 0.00 0.84 -1.21 70.69 32.72 208.02 +268 11.87 -0.08 0.22 0.96 1.68 71.86 32.19 204.14 +269 14.00 0.50 0.06 1.69 2.20 98.21 31.31 211.54 +270 14.51 3.69 0.33 2.42 2.46 83.81 30.97 194.78 +271 16.67 3.76 0.10 3.12 3.10 69.11 27.08 208.06 +272 16.57 3.75 0.00 4.32 1.49 56.14 24.53 195.78 +273 13.47 -1.93 0.31 2.90 -0.87 78.28 27.43 158.74 +274 1.11 -10.34 1.34 -3.02 -4.31 77.82 38.39 203.05 +275 1.88 -10.70 0.00 2.17 2.36 76.76 34.25 200.86 +276 3.78 -3.82 0.57 2.57 5.59 78.20 34.05 131.38 +277 6.19 -1.97 0.26 3.98 5.50 99.95 50.16 165.34 +278 5.65 -6.05 0.10 5.47 -0.05 84.45 33.33 205.43 +279 5.92 -1.87 1.32 3.31 2.81 77.75 34.72 170.81 +280 6.79 -4.77 0.00 5.49 0.05 78.51 35.12 209.40 +281 10.24 -2.44 0.00 4.31 2.65 99.90 35.66 203.87 +282 10.51 -0.31 0.00 3.58 3.09 77.66 31.06 191.61 +283 10.50 0.22 0.00 5.56 1.15 68.42 28.16 199.32 +284 8.93 -0.02 0.52 3.10 5.04 99.88 30.35 125.12 +285 7.56 -4.97 0.17 9.97 2.09 82.29 30.10 187.20 +286 5.08 -6.74 0.04 7.44 0.18 64.87 32.80 169.79 +287 5.73 -2.59 1.02 5.01 0.28 99.93 38.47 150.71 +288 1.17 -12.14 0.34 2.51 -4.76 73.25 40.21 160.58 +289 -4.53 -14.71 0.06 3.24 -3.62 56.15 31.91 178.39 +290 0.64 -10.37 0.00 4.35 -0.95 66.80 34.62 132.68 +291 0.85 -6.05 0.00 4.39 -2.35 99.95 40.25 152.46 +292 2.45 -4.41 0.00 4.68 -1.49 99.95 44.11 135.46 +293 3.95 -4.45 0.00 4.31 -1.46 82.59 47.86 144.83 +294 5.13 -3.68 0.00 3.26 -0.92 79.62 47.52 145.86 +295 8.73 -4.12 0.00 3.99 -0.37 88.70 38.90 167.97 +296 7.66 -0.98 0.03 4.52 -2.29 89.73 31.08 170.80 +297 9.01 -3.16 0.00 5.70 -2.07 73.59 30.34 166.00 +298 9.11 -2.95 0.35 5.25 -0.92 74.36 33.64 144.77 +299 7.70 -1.85 0.53 8.05 0.55 60.61 31.34 154.72 +300 4.13 -8.76 0.04 1.58 -0.21 62.88 31.88 145.58 +301 -0.49 -11.01 0.53 2.15 0.44 74.56 31.20 171.71 +302 -2.82 -11.27 0.18 -1.44 4.15 50.51 32.61 114.87 +303 -2.54 -15.24 1.26 -4.61 -2.15 92.82 40.60 113.98 +304 -8.61 -20.93 0.28 2.51 -2.92 92.73 43.36 146.68 +305 -5.15 -17.46 0.00 2.59 -2.11 93.63 43.35 154.19 +306 -3.39 -13.66 0.05 2.51 -1.21 95.97 48.13 136.35 +307 2.16 -11.03 0.00 4.02 -2.36 92.15 48.80 151.39 +308 2.90 -8.20 0.00 3.65 -3.57 94.87 40.11 154.84 +309 6.76 -6.73 0.00 3.96 -0.98 99.93 35.19 155.93 +310 6.54 -2.24 0.03 4.92 1.10 99.94 45.35 125.77 +311 6.17 -3.40 0.15 5.70 -1.70 71.79 39.48 133.79 +312 1.96 -5.40 0.00 3.54 -1.30 71.78 38.24 130.67 +313 1.67 -5.04 0.05 4.51 -1.95 69.47 41.11 129.80 +314 1.59 -6.45 0.00 4.65 -2.34 69.20 36.66 122.47 +315 3.51 -3.75 0.00 7.33 -0.87 82.02 43.12 126.14 +316 2.20 -11.53 0.00 2.54 -3.05 81.56 27.32 130.49 +317 1.13 -13.66 0.00 3.78 0.26 50.53 20.45 143.31 +318 4.62 -8.35 0.00 3.92 0.55 49.05 18.20 127.42 +319 1.48 -10.90 0.05 2.40 -0.06 97.06 24.77 118.19 +320 1.37 -12.88 0.00 4.69 -0.82 53.15 19.92 140.39 +321 0.73 -9.23 0.00 7.28 -0.68 52.10 20.16 119.02 +322 -1.53 -12.73 0.04 3.47 3.68 67.75 20.09 95.61 +323 -2.95 -16.72 0.15 4.56 1.68 70.14 28.74 118.75 +324 -9.60 -19.83 0.10 2.89 2.88 52.61 26.38 124.83 +325 -6.69 -16.65 2.19 -4.02 -1.18 85.33 31.24 83.99 +326 -5.23 -22.59 0.00 3.34 0.11 95.97 32.41 136.64 +327 2.12 -14.27 0.00 7.58 -1.34 68.10 40.37 123.78 +328 4.32 -5.05 0.00 8.41 0.04 80.10 50.45 116.83 +329 4.04 -3.98 0.06 8.92 0.28 95.44 50.87 112.90 +330 2.04 -15.27 0.19 4.14 -4.04 64.80 37.93 111.99 +331 -6.79 -17.15 0.05 2.34 -2.04 58.06 31.37 128.19 +332 5.53 -12.00 0.52 4.97 -0.16 76.69 27.60 107.99 +333 4.68 -9.62 0.00 4.77 -6.75 69.96 44.49 101.29 +334 2.68 -7.32 0.00 4.59 -4.04 99.96 49.90 102.05 +335 6.33 -7.37 0.09 5.37 -2.84 91.36 33.50 122.83 +336 5.47 -4.72 0.00 5.53 -1.77 100.00 41.15 113.01 +337 4.78 -8.22 0.12 3.75 -2.08 68.59 46.11 101.73 +338 0.22 -13.33 0.00 3.02 -0.15 70.82 44.38 121.16 +339 -1.37 -10.98 0.00 4.22 -0.69 79.76 46.30 100.77 +340 -4.10 -11.58 0.00 2.45 -1.01 76.00 38.84 102.91 +341 -0.87 -8.93 0.40 4.79 -1.13 99.94 36.64 107.22 +342 -7.80 -18.97 0.00 2.87 -3.26 57.40 29.87 119.57 +343 -5.97 -15.37 0.00 3.92 -1.19 67.04 34.75 116.91 +344 -4.40 -13.50 0.00 3.87 -0.26 62.28 29.82 109.39 +345 -5.17 -12.14 0.05 2.66 1.44 78.87 36.12 98.29 +346 -6.15 -14.34 0.05 0.87 -0.77 99.98 49.12 84.88 +347 -7.68 -16.15 0.11 -0.02 0.41 99.95 43.92 81.65 +348 -6.25 -11.53 0.09 0.97 0.95 99.97 55.85 67.86 +349 -1.69 -15.38 0.03 3.39 0.48 90.24 52.18 98.56 +350 -0.27 -10.50 0.15 5.64 2.54 88.10 34.30 102.62 +351 1.75 -5.46 0.00 4.79 5.35 99.95 39.92 103.33 +352 -0.58 -9.89 0.11 3.19 2.87 94.12 53.09 95.10 +353 -6.38 -18.08 0.15 3.71 0.36 79.46 36.87 104.17 +354 -9.20 -21.47 0.00 4.14 0.44 96.44 34.29 103.84 +355 -3.06 -16.68 0.00 6.15 0.23 66.53 30.14 104.52 +356 2.13 -11.09 0.18 7.12 2.67 62.62 46.70 98.43 +357 3.06 -6.76 0.67 5.84 2.13 68.85 54.56 85.75 +358 -3.86 -14.60 0.00 3.38 0.14 86.90 53.28 98.67 +359 -11.69 -19.89 0.00 4.90 -0.87 63.48 39.97 103.73 +360 -6.92 -18.86 0.07 4.37 1.39 96.78 43.39 75.57 +361 2.65 -10.15 0.29 4.14 2.82 83.35 45.77 103.53 +362 2.34 -7.83 1.74 3.97 1.60 86.71 39.07 103.28 +363 -3.74 -17.65 0.05 3.52 -0.07 87.66 41.68 101.19 +364 2.77 -9.81 0.25 4.51 3.99 99.94 57.96 93.45 +365 -2.36 -8.74 0.58 4.01 2.44 99.99 59.92 69.89 +366 4.79 -2.78 0.30 4.88 1.74 99.99 47.89 95.32 diff --git a/inst/extdata/example1/Input/data_weather_maca/weath.1981 b/inst/extdata/example1/Input/data_weather_maca/weath.1981 new file mode 100644 index 00000000..f6e32d99 --- /dev/null +++ b/inst/extdata/example1/Input/data_weather_maca/weath.1981 @@ -0,0 +1,367 @@ +# weather for site maca example at -105.58 / 39.59 year = 1981 +# DOY, Tmax_C, Tmin_C, PPT_cm, uas_mPERs, vas_mPERs, hursmax_pct, hursmin_pct, rsds_WPERm2 +1 2.90 -12.88 0.17 4.07 -3.74 88.60 32.34 104.99 +2 -6.43 -16.16 0.00 2.59 -3.29 63.83 32.60 109.03 +3 2.30 -12.13 0.00 4.66 -1.15 65.00 33.60 111.17 +4 1.95 -8.65 0.00 4.40 -1.64 99.99 41.51 101.51 +5 0.98 -8.11 0.12 4.70 -0.19 99.97 49.00 98.79 +6 1.62 -14.39 0.21 1.22 -3.08 99.94 54.40 99.31 +7 -4.83 -18.65 0.00 1.76 -0.54 65.20 33.42 113.70 +8 -0.32 -13.61 0.00 3.95 0.21 44.81 30.79 107.55 +9 -0.42 -10.01 0.00 3.80 -2.00 74.80 34.04 92.42 +10 1.53 -9.85 0.00 3.74 -1.49 74.50 47.42 103.25 +11 2.58 -6.74 0.06 4.80 0.48 89.98 51.25 97.47 +12 0.37 -9.88 0.16 1.96 -0.25 81.39 53.99 83.66 +13 -5.22 -14.55 0.00 1.30 -1.94 95.15 46.71 82.04 +14 -6.54 -14.96 0.21 -2.16 -1.05 99.91 57.94 60.66 +15 -6.70 -11.84 0.76 -4.51 2.89 79.44 61.15 60.21 +16 -5.76 -13.43 0.19 1.91 -0.18 73.35 54.25 98.41 +17 -4.17 -16.20 0.06 3.54 -0.50 78.86 54.93 109.54 +18 -1.60 -10.32 0.07 3.92 0.00 85.08 62.21 97.12 +19 -1.56 -10.35 0.00 2.89 0.00 73.25 62.06 99.38 +20 -2.43 -12.25 0.00 3.39 -1.07 99.97 56.13 101.14 +21 -4.03 -14.94 0.05 2.32 -2.07 76.63 55.38 103.79 +22 -4.94 -19.71 0.00 4.52 -1.17 84.26 42.61 131.63 +23 -5.94 -16.07 0.00 2.37 0.08 92.20 48.92 102.61 +24 -7.95 -20.08 0.21 -0.15 -2.80 99.93 39.81 133.23 +25 -5.35 -18.43 0.00 5.11 -1.83 99.89 51.35 101.46 +26 -4.70 -11.85 0.06 4.68 -1.41 80.42 47.29 104.60 +27 -4.72 -14.74 0.13 4.17 0.12 99.98 54.47 98.46 +28 -6.21 -13.98 0.15 -1.49 2.08 99.98 85.69 89.02 +29 -5.81 -14.60 0.50 -0.90 2.25 99.98 68.79 84.89 +30 -5.27 -13.77 0.00 2.54 0.96 98.46 56.65 106.18 +31 -9.36 -20.87 0.18 2.43 -1.27 87.29 50.49 134.22 +32 -11.09 -25.22 0.21 3.07 -0.18 83.73 39.95 149.11 +33 -10.14 -25.62 0.11 3.42 -0.16 86.70 47.54 143.34 +34 -8.91 -19.27 0.00 3.64 -2.19 77.51 53.03 131.14 +35 -2.64 -18.55 0.00 4.56 -1.83 78.78 32.63 153.88 +36 0.26 -12.87 0.00 5.63 -2.18 99.96 41.71 138.21 +37 0.36 -11.11 0.00 4.44 -2.23 73.60 52.51 133.10 +38 0.09 -12.22 0.00 3.72 -2.06 99.99 55.10 157.37 +39 0.29 -7.92 0.00 4.34 -2.20 93.95 58.76 129.11 +40 1.17 -7.93 0.03 3.98 -0.80 82.75 56.89 135.44 +41 2.27 -8.60 0.00 3.75 0.59 96.06 52.77 134.98 +42 1.40 -6.41 0.23 2.72 3.23 99.98 68.53 108.44 +43 -0.17 -9.80 0.25 1.65 0.13 99.99 54.09 114.70 +44 -2.27 -17.11 0.44 1.36 -1.94 88.64 35.22 156.53 +45 -1.58 -15.77 0.12 2.63 -0.53 90.13 39.08 150.79 +46 -0.26 -15.45 0.00 3.21 -1.88 65.77 35.94 170.87 +47 2.45 -12.47 0.00 3.50 -1.20 65.08 36.39 164.91 +48 4.16 -11.12 0.00 3.11 -1.17 77.01 41.61 179.35 +49 5.43 -9.77 0.00 3.38 0.86 70.36 32.71 179.58 +50 6.05 -9.40 0.03 2.50 2.09 99.99 33.85 183.91 +51 4.49 -8.35 0.00 -1.06 1.53 73.63 44.41 151.69 +52 1.99 -7.02 0.18 0.12 3.20 77.69 55.04 133.84 +53 1.62 -7.59 0.19 2.24 0.54 90.89 52.30 143.58 +54 0.85 -7.87 0.08 1.72 1.49 95.84 54.82 133.50 +55 0.55 -6.98 0.49 1.81 -0.18 83.03 78.07 129.79 +56 0.48 -10.66 0.00 1.15 1.38 82.24 53.50 151.23 +57 0.14 -7.63 0.22 0.37 2.90 99.98 55.33 115.48 +58 0.13 -6.99 1.52 -1.84 4.56 100.00 85.69 114.19 +59 -0.74 -11.35 0.20 3.98 1.10 77.41 48.67 147.77 +60 -1.68 -11.54 0.24 3.39 -2.07 99.98 46.72 160.69 +61 -0.83 -10.92 0.25 -2.21 2.17 99.99 48.90 145.82 +62 1.69 -8.51 0.71 1.81 2.53 100.00 57.51 151.62 +63 2.57 -6.08 0.22 3.67 0.15 98.03 56.28 164.52 +64 2.75 -5.82 0.00 2.12 -2.94 81.34 50.59 165.42 +65 1.61 -10.95 0.06 1.93 -4.37 99.99 43.36 180.53 +66 5.35 -9.59 0.06 3.44 -0.32 69.98 36.89 207.11 +67 4.60 -4.23 0.04 4.43 0.63 75.43 45.40 162.41 +68 5.83 -3.61 0.00 4.31 -0.54 92.95 44.51 175.52 +69 5.61 -3.38 0.00 3.88 1.49 87.00 51.25 167.17 +70 4.42 -5.81 1.05 1.24 -2.23 78.67 55.13 133.28 +71 0.51 -9.94 0.32 0.36 -4.87 99.14 45.83 167.32 +72 1.85 -11.86 0.07 2.04 -2.46 75.46 31.94 197.06 +73 3.87 -8.39 0.00 2.75 1.95 82.26 31.98 191.94 +74 5.55 -4.03 0.00 4.11 3.35 70.50 44.84 168.95 +75 5.46 -4.45 0.09 3.47 2.97 89.16 43.74 190.09 +76 4.11 -7.66 0.83 -0.99 -2.34 96.31 47.29 177.58 +77 0.57 -9.01 0.31 -3.58 -4.36 100.00 51.87 169.33 +78 3.83 -9.44 0.25 -1.27 -2.26 99.98 30.81 223.03 +79 7.95 -8.10 0.00 1.31 -0.97 99.97 25.33 228.57 +80 7.93 -6.43 0.00 2.43 -0.06 64.64 30.25 202.61 +81 3.69 -5.95 1.06 -2.65 0.22 99.47 45.89 103.77 +82 0.30 -7.73 1.81 -4.24 -4.21 99.98 61.45 101.88 +83 1.25 -11.37 0.15 -0.35 -4.03 99.95 39.06 220.58 +84 5.44 -11.04 0.00 3.21 0.54 72.21 31.94 220.39 +85 7.20 -5.17 0.03 4.92 -0.97 77.22 32.17 225.37 +86 9.69 -3.85 0.00 4.23 0.92 76.91 35.11 198.88 +87 10.96 -3.32 0.00 3.85 1.38 83.90 31.54 212.84 +88 9.48 -0.96 0.00 4.04 4.38 99.21 31.99 193.17 +89 7.34 -8.20 0.00 4.70 -2.35 99.95 28.85 206.45 +90 5.32 -9.09 0.00 3.87 1.40 55.86 22.73 201.77 +91 2.66 -9.25 0.16 3.38 -2.74 71.78 29.38 221.25 +92 2.20 -13.17 0.17 1.59 -2.89 64.61 21.35 237.62 +93 10.52 -10.45 0.00 2.94 2.28 40.98 17.37 237.39 +94 11.58 -2.86 0.00 4.39 2.34 43.53 20.49 219.36 +95 11.10 -5.32 0.00 2.95 2.27 56.64 21.38 217.78 +96 10.57 -3.91 0.00 3.04 0.11 52.50 23.26 222.01 +97 6.12 -9.47 0.29 1.53 -6.34 67.48 22.46 213.73 +98 7.27 -10.87 0.00 -2.01 -5.02 36.89 17.97 240.94 +99 11.72 -8.85 0.00 1.68 -0.31 36.07 12.98 239.67 +100 13.91 -1.75 0.06 5.03 0.40 31.61 13.25 243.65 +101 12.60 -4.39 0.05 1.02 0.24 39.88 13.69 204.56 +102 9.56 -1.44 0.25 -1.78 3.13 56.94 23.16 200.78 +103 8.53 -2.66 0.94 2.05 1.38 99.95 37.69 195.46 +104 7.10 -2.09 0.04 2.83 -2.20 90.15 39.93 222.33 +105 7.76 -6.15 0.00 1.39 0.24 86.07 37.82 207.58 +106 11.12 0.79 0.00 3.70 2.38 80.58 31.34 223.34 +107 10.02 -0.51 0.86 1.75 4.01 59.05 33.61 216.43 +108 7.89 -5.14 3.96 -0.99 3.09 91.52 47.62 195.66 +109 3.50 -6.19 2.49 -4.42 -4.81 93.45 56.34 155.51 +110 -1.40 -10.51 1.25 -1.25 -4.40 83.90 57.10 179.36 +111 -3.85 -12.27 0.87 -1.43 0.06 93.41 54.48 180.48 +112 -2.83 -9.97 1.17 -4.24 0.64 90.17 60.03 150.89 +113 -1.22 -9.57 2.02 -3.43 -1.12 99.99 57.68 183.64 +114 0.57 -7.34 0.12 0.28 2.35 90.27 48.02 193.39 +115 2.45 -6.83 0.62 2.57 4.29 81.14 46.99 186.16 +116 4.00 -1.62 0.49 2.69 1.10 79.73 54.03 206.17 +117 3.92 -6.69 0.87 -1.75 -0.94 99.97 51.16 180.44 +118 1.90 -5.09 0.44 -1.31 0.91 74.26 40.45 201.88 +119 4.44 -7.18 0.05 -0.88 1.92 81.94 33.37 234.72 +120 7.56 -5.28 0.20 2.39 0.19 79.35 32.05 236.87 +121 7.00 -5.76 0.04 2.94 1.24 77.87 29.40 274.05 +122 6.32 -2.16 0.10 2.79 2.06 76.41 29.72 200.65 +123 11.50 -2.97 0.00 2.44 2.25 75.98 30.52 241.68 +124 12.42 -2.38 0.00 3.40 1.04 77.47 26.48 265.14 +125 12.05 0.74 0.05 4.54 1.85 60.01 24.79 263.77 +126 9.08 -4.97 0.00 3.12 -4.82 70.54 25.52 289.76 +127 6.11 -8.32 0.00 1.67 -3.14 53.72 20.10 300.58 +128 12.56 -0.93 0.00 2.00 5.18 38.99 19.73 246.11 +129 13.90 -1.31 0.00 2.84 -0.94 45.69 20.29 297.98 +130 15.69 -0.98 0.00 0.64 3.70 45.39 17.89 288.32 +131 14.98 0.95 0.04 3.83 -0.25 41.80 17.61 269.97 +132 11.31 -3.90 0.07 1.83 -4.06 56.67 20.91 301.79 +133 15.82 -0.71 0.00 1.91 4.03 40.95 18.85 296.48 +134 18.91 4.95 0.07 5.06 6.90 41.96 18.63 292.57 +135 16.50 4.35 0.05 4.51 6.00 47.35 19.09 251.39 +136 15.00 2.36 0.00 4.11 6.10 42.39 17.72 292.02 +137 13.21 -1.02 0.39 2.78 -0.60 67.61 23.48 268.24 +138 8.81 -1.92 0.75 1.84 -4.17 86.84 28.96 275.06 +139 13.80 -2.11 0.00 2.54 3.52 55.95 22.77 295.07 +140 14.32 2.94 0.17 3.45 8.65 43.46 21.97 285.40 +141 16.75 1.12 0.05 2.91 5.20 46.79 14.45 299.76 +142 16.16 2.22 0.00 2.85 6.12 30.58 14.27 283.07 +143 14.32 -0.87 0.06 4.64 2.17 37.16 15.43 297.72 +144 12.75 -1.08 0.00 5.87 -1.46 49.88 17.41 276.55 +145 9.86 -1.50 0.00 -0.33 0.18 65.05 28.13 239.92 +146 8.94 0.53 0.21 -1.75 4.83 70.38 35.28 235.95 +147 12.83 -1.17 0.27 2.62 2.21 72.24 30.40 290.73 +148 15.49 2.23 0.00 3.04 5.12 54.62 17.63 298.27 +149 16.48 -1.91 0.00 4.49 2.54 43.54 15.94 301.62 +150 16.33 0.63 0.00 3.84 -0.93 47.06 16.79 292.77 +151 14.16 0.97 0.00 1.41 -1.93 39.48 17.54 299.03 +152 15.95 -0.21 0.00 -0.09 2.49 51.64 17.52 296.49 +153 19.04 0.92 0.00 3.04 1.58 38.59 12.16 305.13 +154 19.36 6.92 0.00 5.51 -1.22 28.65 12.80 301.75 +155 16.98 0.68 0.00 1.97 -1.58 41.01 17.77 288.90 +156 15.08 4.76 0.00 0.51 2.27 54.22 20.03 244.20 +157 11.57 1.15 0.92 -1.19 -0.46 88.18 32.79 285.28 +158 10.98 -0.66 0.30 -1.07 2.09 75.93 28.24 287.79 +159 14.15 -1.14 0.16 2.64 2.66 67.73 25.37 293.53 +160 16.31 4.69 1.68 2.92 3.16 69.57 23.91 280.07 +161 18.76 3.35 0.00 2.63 0.30 57.16 22.82 300.21 +162 18.89 3.98 0.00 1.66 -1.02 56.01 25.24 299.63 +163 21.40 4.46 0.00 1.82 2.41 51.39 18.11 302.53 +164 22.15 4.33 0.00 4.01 1.61 41.14 14.63 303.55 +165 21.91 3.73 0.00 1.80 -1.86 36.99 15.47 301.13 +166 23.47 5.79 0.00 -1.98 2.01 40.40 15.78 299.99 +167 22.94 5.13 0.00 0.73 1.99 47.61 16.10 299.03 +168 22.58 5.04 0.00 1.27 -1.67 49.15 19.23 300.31 +169 19.46 5.35 0.22 -1.79 -0.55 76.22 25.20 284.14 +170 18.77 4.41 0.07 1.16 4.20 69.86 24.39 293.74 +171 21.64 7.21 0.04 2.59 4.98 66.53 18.87 291.92 +172 24.43 7.34 0.00 3.48 4.50 39.16 12.04 305.69 +173 23.85 4.91 0.00 4.44 1.21 30.64 11.81 304.19 +174 23.74 5.83 0.00 3.69 2.22 29.65 11.99 305.82 +175 24.63 4.80 0.00 4.43 0.99 28.57 10.12 306.28 +176 24.02 6.36 0.00 4.67 1.48 20.96 9.92 303.15 +177 23.90 6.64 0.00 3.61 2.60 28.23 11.74 301.29 +178 23.64 8.66 0.08 3.18 3.05 39.22 14.57 292.22 +179 21.59 8.62 0.00 3.45 2.74 56.86 20.91 297.59 +180 20.53 8.26 0.03 3.63 -0.10 58.00 23.23 273.07 +181 20.43 7.35 0.14 2.31 -2.88 66.37 24.24 257.92 +182 20.06 5.14 0.22 0.90 -1.28 64.22 21.70 277.20 +183 19.38 6.13 0.15 1.65 2.03 67.22 23.33 271.60 +184 21.12 5.58 0.81 0.56 1.27 73.75 22.31 289.26 +185 23.69 5.92 0.08 1.55 0.50 50.05 15.05 292.78 +186 24.07 8.08 0.00 1.20 2.48 40.75 15.00 280.41 +187 23.64 8.11 0.00 2.86 0.12 45.14 19.23 299.63 +188 26.29 7.37 0.00 1.86 0.53 50.73 13.02 300.39 +189 25.82 8.41 0.00 3.51 -1.22 28.68 12.50 300.32 +190 19.93 4.31 0.08 -1.16 -3.46 46.21 13.68 282.24 +191 19.76 5.26 0.15 -2.45 0.04 76.10 28.41 263.14 +192 21.61 6.34 0.00 1.33 0.89 60.06 21.45 291.95 +193 21.92 6.77 0.28 0.84 -3.65 63.03 22.61 257.41 +194 15.45 -0.75 0.46 -1.94 -0.94 87.81 28.43 277.17 +195 14.77 2.57 0.17 0.82 4.88 99.99 30.99 233.42 +196 21.26 5.14 0.00 2.21 2.13 71.05 22.48 285.15 +197 21.25 5.29 0.00 4.46 -0.89 41.99 18.01 288.23 +198 21.17 5.44 0.00 4.19 -0.42 35.36 17.73 292.19 +199 21.11 4.36 0.00 2.20 -0.31 45.02 16.79 266.96 +200 21.46 8.47 0.00 2.29 1.99 44.03 20.01 256.22 +201 21.37 9.55 0.00 3.07 0.67 49.56 23.90 262.61 +202 21.46 8.54 0.35 2.74 0.36 58.98 25.32 258.91 +203 22.04 8.94 0.06 3.10 1.36 63.21 24.64 275.95 +204 22.49 9.42 0.41 3.14 1.83 54.60 21.86 269.86 +205 22.02 9.64 0.06 4.81 1.77 37.71 19.62 286.15 +206 21.52 5.11 0.09 3.51 0.28 39.33 18.98 285.67 +207 21.15 4.29 0.06 2.11 2.05 44.31 19.57 264.61 +208 21.65 8.78 0.14 3.53 2.12 54.17 23.93 272.28 +209 20.93 8.01 0.06 2.67 -0.03 53.34 26.21 269.15 +210 20.12 8.58 0.25 2.55 1.32 78.53 31.11 264.52 +211 18.91 9.01 0.79 1.88 -0.19 88.60 36.38 248.69 +212 19.12 7.51 1.11 -0.18 2.65 85.61 39.60 248.94 +213 19.60 8.19 0.67 2.51 1.53 85.33 38.89 259.98 +214 18.98 8.37 1.13 2.29 1.56 79.18 35.76 247.00 +215 18.97 6.92 0.55 1.93 -0.13 85.38 36.10 257.48 +216 19.53 6.72 0.64 2.93 0.89 83.98 33.20 263.95 +217 19.53 6.85 1.16 2.19 -2.23 85.09 39.34 211.57 +218 12.65 3.05 0.82 -1.72 -3.82 99.99 54.63 156.85 +219 12.40 1.67 0.50 1.10 -1.88 96.23 45.37 242.89 +220 17.08 2.84 0.00 1.81 1.24 96.85 35.63 263.87 +221 20.12 4.31 0.08 2.64 1.19 94.96 32.00 277.19 +222 19.62 6.95 0.03 2.08 0.39 85.75 33.11 237.05 +223 20.31 7.02 0.08 2.39 0.38 80.45 30.14 256.75 +224 20.87 5.54 0.00 2.50 -1.69 68.70 27.66 262.90 +225 19.91 5.28 0.34 -1.17 -2.12 80.81 31.05 261.04 +226 18.47 8.55 0.29 -2.74 1.19 95.50 36.82 215.52 +227 16.88 7.49 0.22 -1.34 3.23 100.00 44.80 207.37 +228 19.12 9.70 0.04 1.72 3.62 93.28 35.51 234.60 +229 19.72 8.66 0.12 3.73 0.34 99.97 28.87 244.62 +230 19.86 6.71 0.09 2.31 -2.47 62.81 28.58 229.04 +231 19.47 5.53 0.23 1.79 -0.06 78.30 28.84 255.19 +232 18.89 4.15 0.13 1.94 -2.66 63.99 26.75 269.99 +233 17.93 3.75 0.09 -2.04 -0.20 99.99 27.70 244.95 +234 17.35 5.00 0.73 -2.26 2.44 86.27 35.50 220.04 +235 17.68 6.26 0.55 0.21 3.21 83.75 35.15 232.77 +236 17.91 6.49 0.20 1.48 1.88 55.17 34.74 232.88 +237 17.94 6.76 0.50 -0.11 2.21 75.79 34.03 236.46 +238 19.43 7.50 0.04 1.75 1.87 81.15 28.36 246.53 +239 19.31 4.13 0.00 1.81 -1.31 58.74 26.01 255.34 +240 19.47 6.60 0.00 2.58 0.39 52.72 25.65 244.82 +241 20.08 3.27 0.00 0.84 -2.50 52.86 23.09 246.38 +242 18.41 3.49 0.00 -1.95 0.55 69.98 30.94 222.98 +243 20.34 7.03 0.00 2.39 3.36 58.81 24.31 231.88 +244 19.49 5.98 0.00 2.90 2.53 64.09 27.28 234.13 +245 18.02 4.98 0.10 2.74 2.72 68.39 31.88 208.81 +246 14.69 7.00 0.48 2.35 2.97 87.22 40.84 192.12 +247 16.73 6.14 0.33 2.13 3.08 99.98 35.38 217.60 +248 17.05 5.24 0.15 2.03 3.20 68.17 34.60 222.22 +249 16.96 5.11 1.08 2.54 1.23 64.38 33.33 218.46 +250 16.39 6.04 1.23 1.67 1.14 68.32 36.93 207.52 +251 16.56 4.97 0.25 2.08 0.20 80.10 33.58 218.22 +252 18.46 3.67 0.00 3.92 -2.05 82.67 24.94 238.94 +253 18.05 2.80 0.00 4.71 -1.48 56.31 24.39 247.08 +254 17.43 3.58 0.00 4.67 -2.08 53.93 25.51 232.79 +255 16.39 1.36 0.00 1.40 -2.20 62.29 24.33 239.77 +256 16.92 2.60 0.00 -0.03 4.04 54.76 24.30 210.76 +257 16.02 4.74 0.00 1.87 3.06 47.11 24.73 194.80 +258 14.37 3.23 0.00 1.78 2.42 54.51 27.38 203.15 +259 13.95 2.21 0.37 1.93 2.65 59.53 27.90 209.29 +260 16.16 2.21 0.33 3.32 2.39 66.13 29.25 213.42 +261 14.99 5.17 0.61 3.86 0.39 64.59 31.20 186.78 +262 12.38 2.71 0.33 3.48 -2.52 91.85 37.34 207.89 +263 14.02 -0.64 0.00 2.50 -1.25 81.93 29.76 229.11 +264 14.24 0.48 0.00 2.27 -0.07 64.08 30.24 205.30 +265 15.53 2.87 0.00 3.67 2.59 59.65 28.46 203.74 +266 15.36 3.50 0.15 2.90 -0.16 73.52 29.64 201.96 +267 13.40 -1.12 0.52 -2.38 2.25 90.63 41.10 160.39 +268 11.53 -0.50 0.89 -0.17 4.18 100.00 43.11 175.43 +269 14.17 3.78 0.00 3.01 2.92 99.99 36.46 200.85 +270 13.33 2.15 0.19 3.21 -0.17 76.23 34.48 214.45 +271 15.19 1.77 0.00 2.06 1.02 80.02 28.99 194.61 +272 15.98 2.12 0.00 3.18 0.37 82.65 26.13 204.25 +273 15.70 3.77 0.00 2.58 1.67 85.20 28.49 165.68 +274 15.21 3.08 0.00 3.79 0.09 84.85 30.13 198.52 +275 15.52 1.82 0.08 4.29 0.29 68.43 26.04 180.33 +276 15.10 -0.10 0.00 3.97 0.00 60.45 21.45 207.83 +277 15.24 0.73 0.00 5.13 -0.58 42.72 19.79 211.79 +278 14.79 -0.64 0.00 2.01 0.53 45.33 19.32 181.43 +279 15.80 4.01 0.00 3.60 2.25 38.46 19.82 174.00 +280 15.22 2.70 0.00 2.57 0.77 61.80 20.51 151.39 +281 11.33 0.24 0.05 1.73 2.86 87.44 31.11 201.55 +282 10.86 -3.04 0.35 1.78 -2.90 73.73 36.04 170.60 +283 6.11 -6.26 0.06 1.61 -1.97 78.18 26.84 202.93 +284 10.37 -6.39 0.00 2.24 1.45 61.26 24.98 205.30 +285 13.01 -2.20 0.00 3.77 0.12 48.14 20.87 182.27 +286 13.83 -0.23 0.00 5.40 -0.25 39.66 18.73 178.74 +287 12.73 -2.99 0.00 4.32 -0.51 54.87 20.81 191.94 +288 12.91 -2.98 0.00 3.69 -0.21 48.56 20.26 184.29 +289 11.90 -1.05 0.00 0.80 0.31 43.13 21.10 145.93 +290 11.44 -1.35 0.00 -1.48 1.23 46.86 23.31 178.52 +291 11.70 -1.68 0.22 0.46 2.25 74.91 26.39 175.79 +292 13.27 -1.04 0.00 2.40 1.92 99.98 30.98 180.63 +293 14.44 0.73 0.00 3.53 0.58 100.00 28.97 174.79 +294 13.68 1.18 0.00 3.51 0.66 97.77 32.71 188.27 +295 12.34 0.53 0.47 2.21 -0.24 71.28 32.43 135.98 +296 9.52 -0.21 0.00 0.12 2.39 89.08 37.83 143.78 +297 10.68 -1.06 0.00 3.03 1.60 92.30 33.79 175.29 +298 10.46 -0.73 0.15 1.86 0.51 71.00 30.34 159.45 +299 9.40 -0.00 0.16 1.40 2.65 69.02 40.55 139.50 +300 10.45 0.32 0.12 2.87 2.46 74.77 48.20 149.57 +301 10.57 1.74 0.19 3.09 1.90 90.97 47.75 118.51 +302 6.74 -2.71 1.40 2.21 -1.06 84.26 57.13 110.94 +303 4.21 -4.23 0.30 4.07 -3.10 74.41 43.15 123.37 +304 3.79 -6.39 0.08 4.07 -0.25 76.93 41.19 129.44 +305 1.95 -11.95 0.00 7.22 -3.96 57.72 18.33 163.44 +306 -1.59 -13.65 0.00 3.78 -1.80 39.19 12.60 169.01 +307 0.84 -7.32 0.00 4.01 0.22 57.37 13.35 129.79 +308 -0.07 -12.01 0.07 3.03 -4.45 50.13 19.09 166.57 +309 1.75 -9.86 0.00 4.05 -0.28 45.54 22.00 121.89 +310 1.38 -11.99 0.22 3.48 -5.11 60.12 26.29 140.13 +311 -5.61 -12.84 0.38 3.43 -5.70 43.74 27.48 121.37 +312 -9.23 -15.54 0.16 3.38 -4.82 60.35 33.48 122.35 +313 -7.41 -15.77 0.18 1.24 -4.02 74.99 33.35 140.09 +314 -4.11 -16.93 0.00 2.18 -1.51 68.35 29.41 156.42 +315 -1.82 -14.14 0.00 3.32 -1.63 62.35 33.67 146.70 +316 1.18 -13.01 0.00 3.16 -1.35 63.74 32.34 142.58 +317 -0.76 -9.96 0.00 1.24 1.91 57.15 34.64 104.33 +318 4.64 -6.59 0.00 3.05 2.61 92.44 42.69 113.97 +319 3.34 -6.30 0.00 4.18 0.78 99.52 50.30 121.88 +320 5.73 -3.12 0.00 3.35 1.67 99.98 55.98 114.10 +321 7.67 -2.05 0.11 3.13 2.86 83.48 53.98 103.68 +322 6.82 -2.00 0.00 3.64 1.43 78.98 56.55 96.01 +323 3.81 -6.05 0.00 4.45 0.22 90.18 50.77 126.78 +324 2.54 -5.70 0.00 3.83 1.93 96.12 59.45 106.75 +325 5.60 -3.70 0.14 2.37 5.64 85.35 84.87 90.76 +326 5.80 -6.89 0.28 4.99 1.74 99.93 34.69 121.39 +327 -1.72 -13.58 0.00 4.00 0.14 99.93 33.38 133.24 +328 5.23 -9.19 0.00 5.15 0.33 64.35 33.48 121.20 +329 5.81 -5.51 0.00 4.54 1.06 69.13 24.81 123.39 +330 2.69 -6.41 0.00 4.28 1.19 99.94 37.53 110.84 +331 1.64 -10.98 0.00 2.92 0.73 89.48 28.75 123.58 +332 1.25 -9.21 0.06 3.37 0.54 67.09 32.62 114.55 +333 1.32 -8.59 0.00 4.06 -0.41 87.07 28.42 104.34 +334 3.56 -7.44 0.00 6.81 -0.64 59.30 26.61 104.60 +335 6.45 -4.58 0.00 7.14 -0.55 70.67 30.84 100.34 +336 5.64 -3.70 0.00 8.39 -1.10 68.87 35.25 113.98 +337 4.90 -4.86 0.05 4.22 1.68 77.40 44.41 90.80 +338 8.48 -3.61 0.22 5.59 2.51 81.83 46.83 93.89 +339 7.92 -4.83 0.58 5.26 2.42 67.14 45.08 100.28 +340 -2.54 -15.34 0.00 4.25 -0.07 63.86 23.75 119.00 +341 -7.07 -12.77 0.00 4.99 1.29 45.49 19.78 101.18 +342 -3.74 -13.03 0.18 7.88 1.49 48.21 24.68 103.06 +343 -3.68 -13.48 0.00 6.09 -1.76 51.62 32.40 89.50 +344 1.34 -9.80 0.32 4.53 0.68 81.00 31.70 100.11 +345 0.34 -10.40 0.00 5.40 -2.20 58.93 29.26 99.64 +346 2.26 -11.13 0.06 5.02 -0.85 65.80 39.97 89.44 +347 2.51 -6.72 0.00 4.48 -1.28 79.79 42.49 101.05 +348 4.71 -6.40 0.00 4.35 -0.74 77.04 36.09 101.64 +349 4.52 -4.40 0.00 4.23 0.30 98.02 45.73 102.40 +350 -0.83 -9.18 0.19 3.14 0.40 92.36 49.42 84.88 +351 -4.14 -12.76 0.57 2.79 -1.00 99.96 28.77 99.87 +352 -5.36 -13.72 0.39 2.26 3.27 68.64 32.82 82.04 +353 -6.03 -19.58 0.11 2.07 -2.03 81.39 43.80 97.57 +354 -11.32 -23.77 0.13 2.43 -0.76 78.76 35.02 103.97 +355 -1.80 -17.88 0.00 4.28 1.33 81.96 48.02 89.21 +356 -3.38 -12.73 0.00 4.69 -1.58 78.41 43.07 98.89 +357 -2.25 -12.88 0.41 5.13 -0.16 99.95 52.57 88.40 +358 3.73 -4.98 0.35 8.56 0.26 99.98 37.84 102.32 +359 1.47 -5.76 0.06 6.64 -0.28 99.99 44.58 97.92 +360 4.23 -4.64 0.00 6.60 -1.25 68.40 45.88 104.11 +361 4.33 -4.08 0.05 6.04 -0.92 92.00 50.68 102.54 +362 3.23 -6.83 0.18 4.67 -0.34 90.38 38.17 100.36 +363 -4.03 -13.57 0.34 5.26 -1.34 63.48 28.97 102.21 +364 -10.55 -20.44 0.21 3.67 -1.81 54.00 27.03 100.21 +365 -12.35 -22.83 0.00 2.39 -1.04 55.75 28.49 106.85 diff --git a/inst/extdata/example1/Input/outsetup.in b/inst/extdata/example1/Input/outsetup.in index f84afe5a..beb94c5c 100755 --- a/inst/extdata/example1/Input/outsetup.in +++ b/inst/extdata/example1/Input/outsetup.in @@ -72,3 +72,4 @@ TIMESTEP dy wk mo yr # must be lowercase ESTABL OFF YR 1 end estabs /* yearly establishment results */ CO2EFFECTS AVG DY 1 end co2effects /* vegetation CO2-effect (multiplier) for trees, shrubs, forbs, grasses; WUE CO2-effect (multiplier) for trees, shrubs, forbs, grasses */ BIOMASS AVG DY 1 end vegetation /* vegetation: cover (%) for trees, shrubs, forbs, grasses; biomass (g/m2 as component of total) for total, trees, shrubs, forbs, grasses, and litter; live biomass (g/m2 as component of total) total, trees, shrubs, forbs, grasses; leaf area index LAI (m2/m2) */ + diff --git a/inst/extdata/example1/Input/weathsetup.in b/inst/extdata/example1/Input/weathsetup.in index c463e31e..74e611c9 100755 --- a/inst/extdata/example1/Input/weathsetup.in +++ b/inst/extdata/example1/Input/weathsetup.in @@ -15,6 +15,43 @@ 7 # Seed random number generator for weather generator (only used if SOILWAT2) # (seed with 0 to use current time) +#--- Flags describing mean monthly climate input usage: +# 0 = Don't use mean monthly input +# 1 = Use mean monthly input (climate.in) and override respective flag for daily input, if flags conflict +1 # Sky cover +1 # Wind speed +1 # Relative humidity + + +#--- Flags describing daily weather input files "weath.YYYY": +# 0 = Variable is absent +# 1 = Daily variable present +# Note: The order of input values within input files must match the order of flags below (e.g., cloud cover cannot precede minimum temperature) +# Note: If maximum/minimum temperature or precipitation is set to 0 or a flag is set to 1, and the input data is not complete, the program will crash +1 # Maximum daily temperature [C] +1 # Minimum daily temperature [C] +1 # Precipitation [cm] +0 # Cloud cover [%] +0 # Wind speed [m/s] +0 # Wind speed eastward component [m/s] +0 # Wind speed northward component [m/s] +0 # Relative humidity [%] +0 # Maximum relative humidity [%] +0 # Minimum relative humidity [%] +0 # Specific humidity [%] +0 # Dew point temperature [C] +0 # Actual vapor pressure [kPa] +0 # Downward surface shortwave radiation (see `Daily weather input descriptions`) + + +#--- Daily weather input descriptions +0 # Description of downward surface shortwave radiation + # * 0: `rsds` represents daily global horizontal irradiation [MJ / m2] + # * 1: `rsds` represents flux density [W / m2] for a + # (hypothetical) flat horizon averaged over an entire day (24 hour period) + # * 2: `rsds` represents flux density [W / m2] for a + # (hypothetical) flat horizon averaged over the daylight period of the day + #--- Monthly scaling parameters: # Month 1 = January, Month 2 = February, etc. @@ -24,16 +61,18 @@ # SkyCover = additive for mean monthly sky cover [%]; min(100, max(0, scale + sky cover)) # Wind = multiplicative for mean monthly wind speed; max(0, scale * wind speed) # rH = additive for mean monthly relative humidity [%]; min(100, max(0, scale + rel. Humidity)) -#Mon PPT MaxT MinT SkyCover Wind rH -1 1.000 0.00 0.00 0.0 1.0 0.0 -2 1.000 0.00 0.00 0.0 1.0 0.0 -3 1.000 0.00 0.00 0.0 1.0 0.0 -4 1.000 0.00 0.00 0.0 1.0 0.0 -5 1.000 0.00 0.00 0.0 1.0 0.0 -6 1.000 0.00 0.00 0.0 1.0 0.0 -7 1.000 0.00 0.00 0.0 1.0 0.0 -8 1.000 0.00 0.00 0.0 1.0 0.0 -9 1.000 0.00 0.00 0.0 1.0 0.0 -10 1.000 0.00 0.00 0.0 1.0 0.0 -11 1.000 0.00 0.00 0.0 1.0 0.0 -12 1.000 0.00 0.00 0.0 1.0 0.0 +# ActVP = multiplicative for actual vapor pressure [kPa]; max(0, scale * actual vapor pressure) +# ShortWR = multiplicative for shortwave radiation [W/m2]; max(0, scale * shortwave radiation) +#Mon PPT MaxT MinT SkyCover Wind rH ActVP ShortWR +1 1.000 0.00 0.00 0.0 1.0 0.0 1.0 1.0 +2 1.000 0.00 0.00 0.0 1.0 0.0 1.0 1.0 +3 1.000 0.00 0.00 0.0 1.0 0.0 1.0 1.0 +4 1.000 0.00 0.00 0.0 1.0 0.0 1.0 1.0 +5 1.000 0.00 0.00 0.0 1.0 0.0 1.0 1.0 +6 1.000 0.00 0.00 0.0 1.0 0.0 1.0 1.0 +7 1.000 0.00 0.00 0.0 1.0 0.0 1.0 1.0 +8 1.000 0.00 0.00 0.0 1.0 0.0 1.0 1.0 +9 1.000 0.00 0.00 0.0 1.0 0.0 1.0 1.0 +10 1.000 0.00 0.00 0.0 1.0 0.0 1.0 1.0 +11 1.000 0.00 0.00 0.0 1.0 0.0 1.0 1.0 +12 1.000 0.00 0.00 0.0 1.0 0.0 1.0 1.0 diff --git a/man/calc_dailyInputFlags.Rd b/man/calc_dailyInputFlags.Rd new file mode 100644 index 00000000..44077af0 --- /dev/null +++ b/man/calc_dailyInputFlags.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sw_dbW_WeatherDatabase.R +\name{calc_dailyInputFlags} +\alias{calc_dailyInputFlags} +\title{Determine used weather variables based on values} +\usage{ +calc_dailyInputFlags(x, name_data = weather_dataColumns()) +} +\arguments{ +\item{x}{Weather data, i.e., +a list where each element is of class \code{\link{swWeatherData}}, or +a data frame with appropriate columns (see \code{\link[=dbW_weatherData_to_dataframe]{dbW_weatherData_to_dataframe()}}).} + +\item{name_data}{A vector of character strings. The column names of \code{x} +with weather variables.} +} +\value{ +A logical vector for each of the possible input variables with +\code{TRUE} if at least one value is not missing. +} +\description{ +Determine used weather variables based on values +} +\examples{ +calc_dailyInputFlags(rSOILWAT2::weatherData) +calc_dailyInputFlags(dbW_weatherData_to_dataframe(rSOILWAT2::weatherData)) + + +} diff --git a/man/dbW_check_weatherData.Rd b/man/dbW_check_weatherData.Rd index dcee2413..59909cd8 100644 --- a/man/dbW_check_weatherData.Rd +++ b/man/dbW_check_weatherData.Rd @@ -4,10 +4,12 @@ \alias{dbW_check_weatherData} \title{Check that weather data is well-formed} \usage{ -dbW_check_weatherData(x) +dbW_check_weatherData(x, check_all = TRUE) } \arguments{ \item{x}{An object.} + +\item{check_all}{A logical value} } \value{ A logical value. @@ -17,3 +19,10 @@ Check that weather data is organized in a list where each element is of class \code{\linkS4class{swWeatherData}}, and represents daily data for one Gregorian year } +\examples{ +dbW_check_weatherData(rSOILWAT2::weatherData) +dbW_check_weatherData(weatherHistory()) +dbW_check_weatherData(weatherHistory(), check_all = FALSE) + + +} diff --git a/man/dbW_convert_to_GregorianYears.Rd b/man/dbW_convert_to_GregorianYears.Rd index 3a3e0474..85215f34 100644 --- a/man/dbW_convert_to_GregorianYears.Rd +++ b/man/dbW_convert_to_GregorianYears.Rd @@ -11,7 +11,7 @@ dbW_convert_to_GregorianYears( type = c("asis", "sequential"), name_year = "Year", name_DOY = "DOY", - name_data = c("Tmax_C", "Tmin_C", "PPT_cm"), + name_data = weather_dataColumns(), valNA = NULL ) } diff --git a/man/dbW_dataframe_to_weatherData.Rd b/man/dbW_dataframe_to_weatherData.Rd index 49656b60..ef63b7ee 100644 --- a/man/dbW_dataframe_to_weatherData.Rd +++ b/man/dbW_dataframe_to_weatherData.Rd @@ -7,7 +7,7 @@ dbW_dataframe_to_weatherData( weatherDF, years = NULL, - weatherDF_dataColumns = c("DOY", "Tmax_C", "Tmin_C", "PPT_cm"), + weatherDF_dataColumns = c("DOY", weather_dataColumns()), round = 2 ) } @@ -19,10 +19,9 @@ days and columns represent the weather variables \item{years}{A numeric vector. The calendar years.} \item{weatherDF_dataColumns}{A vector of character strings. The column -names of \code{weatherDF} in the correct order for \code{SOILWAT2} that are -representing calendar year \code{year} (optional), day of year \code{DOY}, -daily maximum air temperature \code{Tmax_C}, daily minimum air temperature -\code{Tmin_C}, and daily precipitation amount \code{PPT_cm}.} +names of \code{weatherDF} in the correct order for \code{SOILWAT2} including +calendar year \code{year} (optional) and day of year \code{DOY}, see +\code{\link[=weather_dataColumns]{weather_dataColumns()}}.} \item{round}{An integer value. The number of decimal places for rounding weather values.} diff --git a/man/dbW_generateWeather.Rd b/man/dbW_generateWeather.Rd index d6ac8509..0af0fca6 100644 --- a/man/dbW_generateWeather.Rd +++ b/man/dbW_generateWeather.Rd @@ -54,6 +54,16 @@ A list of elements of class \code{\linkS4class{swWeatherData}}. This function is a convenience wrapper for \code{\link{dbW_estimate_WGen_coefs}}. } +\section{Details}{ + +The current implementation of the weather generator produces values +only for variables in \code{\link[=weatherGenerator_dataColumns]{weatherGenerator_dataColumns()}}. +Values are generated for those days where at least one of the implemented +variables is missing; if any value is missing, then values for that day of +all implemented variables will be replaced by those produced +by the weather generator. +} + \examples{ # Load data for 1949-2010 wdata <- data.frame(dbW_weatherData_to_dataframe(rSOILWAT2::weatherData)) diff --git a/man/dbW_temporal_summaries.Rd b/man/dbW_temporal_summaries.Rd index ca466135..32133245 100644 --- a/man/dbW_temporal_summaries.Rd +++ b/man/dbW_temporal_summaries.Rd @@ -7,12 +7,18 @@ \alias{dbW_dataframe_to_monthly} \title{Summarize daily weather to weekly, monthly, or yearly values} \usage{ -dbW_weatherData_to_monthly(dailySW, na.rm = FALSE, valNA = NULL) +dbW_weatherData_to_monthly( + dailySW, + na.rm = FALSE, + valNA = NULL, + funs = weather_dataAggFun() +) dbW_dataframe_aggregate( dailySW, time_step = c("Year", "Month", "Week", "Day"), - na.rm = FALSE + na.rm = FALSE, + funs = weather_dataAggFun() ) dbW_dataframe_to_monthly(dailySW, na.rm = FALSE) @@ -27,6 +33,9 @@ calculating monthly temperature and precipitation.} \item{valNA}{The (numerical) value of missing weather data. If \code{NULL}, then default values are interpreted as missing.} +\item{funs}{A named vector of functions. The names must match column names +in \code{dailySW} and the function are used to summarize daily weather values.} + \item{time_step}{A character string.} } \description{ diff --git a/man/dbW_weatherData_round.Rd b/man/dbW_weatherData_round.Rd index 06f84a8b..7751263c 100644 --- a/man/dbW_weatherData_round.Rd +++ b/man/dbW_weatherData_round.Rd @@ -7,7 +7,7 @@ dbW_weatherData_round( weatherData, digits = 4L, - weatherDF_dataColumns = c("Tmax_C", "Tmin_C", "PPT_cm") + weatherDF_dataColumns = weather_dataColumns() ) } \arguments{ @@ -18,10 +18,9 @@ that each hold daily weather data for one calendar year.} weather values.} \item{weatherDF_dataColumns}{A vector of character strings. The column -names of \code{weatherDF} in the correct order for \code{SOILWAT2} that are -representing calendar year \code{year} (optional), day of year \code{DOY}, -daily maximum air temperature \code{Tmax_C}, daily minimum air temperature -\code{Tmin_C}, and daily precipitation amount \code{PPT_cm}.} +names of \code{weatherDF} in the correct order for \code{SOILWAT2} including +calendar year \code{year} (optional) and day of year \code{DOY}, see +\code{\link[=weather_dataColumns]{weather_dataColumns()}}.} } \value{ A list with \code{\linkS4class{swWeatherData}} elements. diff --git a/man/dbW_weather_to_SOILWATfiles.Rd b/man/dbW_weather_to_SOILWATfiles.Rd index 1f6b28b1..74802547 100644 --- a/man/dbW_weather_to_SOILWATfiles.Rd +++ b/man/dbW_weather_to_SOILWATfiles.Rd @@ -11,7 +11,8 @@ dbW_weather_to_SOILWATfiles( weatherData = NULL, weatherDF = NULL, years = NULL, - weatherDF_dataColumns = c("DOY", "Tmax_C", "Tmin_C", "PPT_cm") + weatherDF_dataColumns = c("DOY", weather_dataColumns()), + digits = 4L ) } \arguments{ @@ -28,10 +29,12 @@ that each hold daily weather data for one calendar year.} \item{years}{A numeric vector. The calendar years.} \item{weatherDF_dataColumns}{A vector of character strings. The column -names of \code{weatherDF} in the correct order for \code{SOILWAT2} that are -representing calendar year \code{year} (optional), day of year \code{DOY}, -daily maximum air temperature \code{Tmax_C}, daily minimum air temperature -\code{Tmin_C}, and daily precipitation amount \code{PPT_cm}.} +names of \code{weatherDF} in the correct order for \code{SOILWAT2} including +calendar year \code{year} (optional) and day of year \code{DOY}, see +\code{\link[=weather_dataColumns]{weather_dataColumns()}}.} + +\item{digits}{An integer value. The number of decimal places for rounding +weather values.} } \description{ Conversion: object of class \code{\linkS4class{swWeatherData}} or diff --git a/man/getWeatherData_folders.Rd b/man/getWeatherData_folders.Rd index ce648de2..48aa201d 100644 --- a/man/getWeatherData_folders.Rd +++ b/man/getWeatherData_folders.Rd @@ -9,7 +9,9 @@ getWeatherData_folders( weatherDirName = NULL, filebasename = "weath", startYear = NULL, - endYear = NULL + endYear = NULL, + dailyInputFlags = c(rep(TRUE, 3L), rep(FALSE, 11L)), + method = c("R", "C") ) } \arguments{ @@ -25,6 +27,12 @@ files.} \item{startYear}{Numeric. Extracted weather data will start with this year.} \item{endYear}{Numeric. Extracted weather data will end with this year.} + +\item{dailyInputFlags}{A logical vector of length \code{MAX_INPUT_COLUMNS}, +see \code{"weathsetup.in"}.} + +\item{method}{A character string. \code{"R"} uses code in \code{R} to read files as-is +whereas \code{"C"} uses \code{"SOILWAT2"} code to read and process files.} } \value{ A list of elements of class \code{\linkS4class{swWeatherData}}. @@ -45,21 +53,48 @@ writing weather data to disk files. path_demo <- system.file("extdata", "example1", package = "rSOILWAT2") ## ------ Simulation with data prepared beforehand and separate weather data -## Read inputs from files on disk +## Read inputs from files on disk (via SOILWAT2) sw_in3 <- sw_inputDataFromFiles(dir = path_demo, files.in = "files.in") -## Read forcing weather data from files on disk (there are also functions -## to set up a SQLite database for the weather data) -sw_weath3 <- getWeatherData_folders( - LookupWeatherFolder = file.path(path_demo, "Input"), - weatherDirName = "data_weather", filebasename = "weath", - startYear = 1979, endYear = 2010) +## Read forcing weather data from files on disk (via SOILWAT2) +sw_weath3c <- getWeatherData_folders( + LookupWeatherFolder = file.path(path_demo, "Input"), + weatherDirName = "data_weather", + filebasename = "weath", + startYear = 1979, + endYear = 2010, + method = "C" +) + +## Read forcing weather data from files on disk (via R) +sw_weath3r <- getWeatherData_folders( + LookupWeatherFolder = file.path(path_demo, "Input"), + weatherDirName = "data_weather", + filebasename = "weath", + startYear = 1979, + endYear = 2010, + method = "R" +) + +## Weather data (for the non-calculated variables) should be identical +identical( + sw_weath3c[[1L]]@data[, 1:4], + rSOILWAT2::get_WeatherHistory(sw_in3)[[1L]]@data[, 1:4] +) +identical( + sw_weath3r[[1L]]@data[, 1:4], + rSOILWAT2::get_WeatherHistory(sw_in3)[[1L]]@data[, 1:4] +) ## List of the slots of the input objects of class 'swWeatherData' -utils::str(sw_weath3, max.level=1) +utils::str(sw_weath3c, max.level = 1) +utils::str(sw_weath3r, max.level = 1) ## Execute the simulation run -sw_out3 <- sw_exec(inputData = sw_in3, weatherList = sw_weath3) +sw_out3c <- sw_exec(inputData = sw_in3, weatherList = sw_weath3c) +sw_out3r <- sw_exec(inputData = sw_in3, weatherList = sw_weath3r) + +all.equal(sw_out3c, sw_out3r) } \seealso{ diff --git a/man/get_version.Rd b/man/get_version.Rd index 4e946953..fca37857 100644 --- a/man/get_version.Rd +++ b/man/get_version.Rd @@ -22,6 +22,8 @@ Retrieve version of \pkg{rSOILWAT2} that was used to create object \examples{ get_version(rSOILWAT2::sw_exampleData) get_version(sw_exec(rSOILWAT2::sw_exampleData)) +get_version(as.numeric_version("4.1.3")) +get_version(packageVersion("rSOILWAT2")) } \seealso{ diff --git a/man/get_years_from_weatherDF.Rd b/man/get_years_from_weatherDF.Rd index 9513fbd0..5c74f6bb 100644 --- a/man/get_years_from_weatherDF.Rd +++ b/man/get_years_from_weatherDF.Rd @@ -16,10 +16,9 @@ where length is equal to either the number of years in the weather data.frame or the number of rows in the data.frame.} \item{weatherDF_dataColumns}{A vector of character strings. The column -names of \code{weatherDF} in the correct order for \code{SOILWAT2} that are -representing calendar year \code{year} (optional), day of year \code{DOY}, -daily maximum air temperature \code{Tmax_C}, daily minimum air temperature -\code{Tmin_C}, and daily precipitation amount \code{PPT_cm}.} +names of \code{weatherDF} in the correct order for \code{SOILWAT2} including +calendar year \code{year} (optional) and day of year \code{DOY}, see +\code{\link[=weather_dataColumns]{weather_dataColumns()}}.} } \value{ A named list of length 2. diff --git a/man/is_missing_weather.Rd b/man/is_missing_weather.Rd new file mode 100644 index 00000000..a1d62b6a --- /dev/null +++ b/man/is_missing_weather.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sw_dbW_WeatherDatabase.R +\name{is_missing_weather} +\alias{is_missing_weather} +\title{Check which weather values are missing} +\usage{ +is_missing_weather(x) +} +\arguments{ +\item{x}{A two-dimensional numeric object.} +} +\value{ +A logical object with same dimensions as \code{x} +} +\description{ +Check which weather values are missing +} +\examples{ +x <- data.frame( + Tmax = c(-1.5, 2, NA, 999), + Tmin = c(-5, NaN, 999, -5) +) + +is_missing_weather(x) + +} diff --git a/man/swWeatherData-class.Rd b/man/swWeatherData-class.Rd index cac380ed..881ed3a1 100644 --- a/man/swWeatherData-class.Rd +++ b/man/swWeatherData-class.Rd @@ -42,9 +42,17 @@ The methods listed below work on this class and the proper slot of the class \item{\code{year}}{An integer value. The calendar year of the weather \code{data} object.} -\item{\code{data}}{A 365 x 4 or 366 x 4 matrix representing daily weather data for -one calendar \code{year} with columns \var{DOY}, \var{Tmax_C}, -\var{Tmin_C}, and \var{PPT_cm}.} +\item{\code{data}}{A 365 x 15 or 366 x 15 matrix representing daily weather data for +one calendar \code{year} with columns +\var{DOY}, +\var{Tmax_C}, \var{Tmin_C}, \var{PPT_cm}, +\var{cloudCov_pct}, +\var{windSpeed_mPERs}, +\var{windSpeed_east_mPERs}, \var{windSpeed_north_mPERs}, +\var{rHavg_pct}, \var{rHmax_pct}, \var{rHmin_pct}, +\var{specHavg_pct}, \var{Tdewpoint_C}, +\var{actVP_kPa}, and +\var{shortWR}.} }} \examples{ diff --git a/man/sw_exec.Rd b/man/sw_exec.Rd index 60eafc89..0997a2b2 100644 --- a/man/sw_exec.Rd +++ b/man/sw_exec.Rd @@ -62,7 +62,8 @@ If you have missing weather data, then you have to impute yourself or use the built-in Markov weather generator (see examples section). If you use the weather generator, then you have to provide appropriate values for the input (files) \var{mkv_covar.in} and \var{mkv_prob.in} for your simulation run - -currently, \pkg{rSOILWAT2} does not contain code to estimate these values. +see \code{\link{dbW_estimate_WGen_coefs}} or +\code{\link{dbW_generateWeather}}. } \examples{ diff --git a/man/sw_upgrade.Rd b/man/sw_upgrade.Rd index ea34eac0..feb4de2a 100644 --- a/man/sw_upgrade.Rd +++ b/man/sw_upgrade.Rd @@ -1,11 +1,14 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/A_swGenericMethods.R, R/B_swFiles.R, -% R/E_swProd.R, R/F_swSite.R, R/F_swSoils.R, R/G_swOut.R, R/I_swEstab.R, -% R/K_swContainer.R +% R/D_swWeather.R, R/D_swWeatherData.R, R/E_swProd.R, R/F_swSite.R, +% R/F_swSoils.R, R/G_swOut.R, R/I_swEstab.R, R/K_swContainer.R \name{sw_upgrade} \alias{sw_upgrade} \alias{sw_upgrade,ANY-method} \alias{sw_upgrade,swFiles-method} +\alias{sw_upgrade,swMonthlyScalingParams-method} +\alias{sw_upgrade,swWeather-method} +\alias{upgrade_weatherHistory} \alias{sw_upgrade,swProd-method} \alias{sw_upgrade,swSite-method} \alias{sw_upgrade,swSoils-method} @@ -21,6 +24,12 @@ sw_upgrade(object, verbose = FALSE) \S4method{sw_upgrade}{swFiles}(object, verbose = FALSE) +\S4method{sw_upgrade}{swMonthlyScalingParams}(object, verbose = FALSE) + +\S4method{sw_upgrade}{swWeather}(object, verbose = FALSE) + +upgrade_weatherHistory(object, verbose = FALSE) + \S4method{sw_upgrade}{swProd}(object, verbose = FALSE) \S4method{sw_upgrade}{swSite}(object, verbose = FALSE) diff --git a/man/sw_weather_data.Rd b/man/sw_weather_data.Rd index 3312ec4f..73a323d5 100644 --- a/man/sw_weather_data.Rd +++ b/man/sw_weather_data.Rd @@ -18,10 +18,9 @@ days and columns represent the weather variables (see \code{weatherDF_dataColumns}).} \item{weatherDF_dataColumns}{A vector of character strings. The column -names of \code{weatherDF} in the correct order for \code{SOILWAT2} that are -representing calendar year \code{year} (optional), day of year \code{DOY}, -daily maximum air temperature \code{Tmax_C}, daily minimum air temperature -\code{Tmin_C}, and daily precipitation amount \code{PPT_cm}.} +names of \code{weatherDF} in the correct order for \code{SOILWAT2} including +calendar year \code{year} (optional) and day of year \code{DOY}, see +\code{\link[=weather_dataColumns]{weather_dataColumns()}}.} \item{years}{A numeric vector. The calendar years.} diff --git a/man/weatherGenerator_dataColumns.Rd b/man/weatherGenerator_dataColumns.Rd new file mode 100644 index 00000000..dfa50e67 --- /dev/null +++ b/man/weatherGenerator_dataColumns.Rd @@ -0,0 +1,11 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/swWeatherGenerator.R +\name{weatherGenerator_dataColumns} +\alias{weatherGenerator_dataColumns} +\title{List daily weather variables incorporated in the weather generator} +\usage{ +weatherGenerator_dataColumns() +} +\description{ +List daily weather variables incorporated in the weather generator +} diff --git a/man/weather_dataAggFun.Rd b/man/weather_dataAggFun.Rd new file mode 100644 index 00000000..4e7d2c46 --- /dev/null +++ b/man/weather_dataAggFun.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/D_swWeatherData.R +\name{weather_dataAggFun} +\alias{weather_dataAggFun} +\title{Functions to summarize currently implemented daily weather variables} +\usage{ +weather_dataAggFun() +} +\value{ +A named vector of functions that summarize +daily weather variables across time. +} +\description{ +Functions to summarize currently implemented daily weather variables +} diff --git a/man/weather_dataColumns.Rd b/man/weather_dataColumns.Rd new file mode 100644 index 00000000..731d499f --- /dev/null +++ b/man/weather_dataColumns.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/D_swWeatherData.R +\name{weather_dataColumns} +\alias{weather_dataColumns} +\title{List names of currently implemented daily weather variables} +\usage{ +weather_dataColumns() +} +\value{ +A vector of daily weather variable names. +} +\description{ +List names of currently implemented daily weather variables +} diff --git a/src/SOILWAT2 b/src/SOILWAT2 index 522bc470..62521583 160000 --- a/src/SOILWAT2 +++ b/src/SOILWAT2 @@ -1 +1 @@ -Subproject commit 522bc470034a2c38c0c8c416c80fe1b73f0bbcde +Subproject commit 62521583f21b8bd829b3b868fef20da7a7973eda diff --git a/src/SW_R_init.c b/src/SW_R_init.c index 213b0537..6e311255 100644 --- a/src/SW_R_init.c +++ b/src/SW_R_init.c @@ -10,6 +10,7 @@ extern SEXP tempError(void); extern SEXP onGetInputDataFromFiles(SEXP, SEXP); extern SEXP onGetOutput(SEXP); extern SEXP rSW2_processAllWeather(SEXP, SEXP); +extern SEXP rSW2_readAllWeatherFromDisk(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP sw_consts(void); extern SEXP sw_quiet(SEXP); extern SEXP rSW2_SWRC_PTF_estimate_parameters(SEXP, SEXP, SEXP, SEXP, SEXP); @@ -27,6 +28,7 @@ static const R_CallMethodDef CallEntries[] = { {"onGetInputDataFromFiles", (DL_FUNC) &onGetInputDataFromFiles, 2}, {"onGetOutput", (DL_FUNC) &onGetOutput, 1}, {"rSW2_processAllWeather", (DL_FUNC) &rSW2_processAllWeather, 2}, + {"rSW2_readAllWeatherFromDisk",(DL_FUNC) &rSW2_readAllWeatherFromDisk,5}, {"sw_consts", (DL_FUNC) &sw_consts, 0}, {"sw_quiet", (DL_FUNC) &sw_quiet, 1}, {"rSW2_SWRC_PTF_estimate_parameters", (DL_FUNC) &rSW2_SWRC_PTF_estimate_parameters, 5}, diff --git a/src/SW_R_lib.c b/src/SW_R_lib.c index 9d2a8f1e..af1e1a23 100644 --- a/src/SW_R_lib.c +++ b/src/SW_R_lib.c @@ -13,6 +13,9 @@ #include "SOILWAT2/include/SW_Files.h" #include "SOILWAT2/include/SW_Carbon.h" // externs `SW_Carbon` +#include "SOILWAT2/include/SW_Model.h" // externs `SW_Model` +#include "SOILWAT2/include/SW_Weather.h" // externs `SW_Weather` +#include "SOILWAT2/include/SW_Sky.h" // externs `SW_Sky` #include "SOILWAT2/include/SW_SoilWater.h" // externs `SW_Soilwat` #include "SOILWAT2/include/SW_VegEstab.h" // externs `SW_VegEstab` #include "SOILWAT2/include/SW_Output.h" @@ -473,6 +476,116 @@ SEXP rSW2_processAllWeather(SEXP weatherList, SEXP inputData) { + +/** + @brief Read daily driving (weather) variables from disk using SOILWAT2 code + + Applies additive/multiplicative scaling parameters and + uses imputation/weather generator to fill missing values +*/ +SEXP rSW2_readAllWeatherFromDisk( + SEXP path, + SEXP name_prefix, + SEXP startYear, + SEXP endYear, + SEXP dailyInputFlags +) { + SEXP res; + int i; + + #ifdef RSWDEBUG + int debug = 0; + #endif + + /* Convert inputs to correct type */ + path = PROTECT(AS_CHARACTER(path)); + name_prefix = PROTECT(AS_CHARACTER(name_prefix)); + startYear = PROTECT(coerceVector(startYear, INTSXP)); + endYear = PROTECT(coerceVector(endYear, INTSXP)); + dailyInputFlags = PROTECT(coerceVector(dailyInputFlags, LGLSXP)); + + /* Create convenience pointers */ + int *xdif = LOGICAL(dailyInputFlags); /* LGLSXP are internally coded as int */ + + + #ifdef RSWDEBUG + if (debug) swprintf("\n'rSW2_readAllWeatherFromDisk': data preparation: "); + #endif + SW_Model.startyr = INTEGER(startYear)[0]; + SW_Model.endyr = INTEGER(endYear)[0]; + + strcpy(SW_Weather.name_prefix, CHAR(STRING_ELT(path, 0))); + strcat(SW_Weather.name_prefix, "/"); + strcat(SW_Weather.name_prefix, CHAR(STRING_ELT(name_prefix, 0))); + + // read only from files + SW_Weather.use_weathergenerator_only = FALSE; // no weather generator + SW_Weather.generateWeatherMethod = 0; + + SW_Weather.use_cloudCoverMonthly = FALSE; // don't interpolate monthly values + SW_Weather.use_windSpeedMonthly = FALSE; // don't interpolate monthly values + SW_Weather.use_humidityMonthly = FALSE; // don't interpolate monthly values + for (i = 0; i < MAX_MONTHS; i++) { + SW_Sky.cloudcov[i] = SW_MISSING; + SW_Sky.windspeed[i] = SW_MISSING; + SW_Sky.r_humidity[i] = SW_MISSING; + } + + for (i = 0; i < MAX_INPUT_COLUMNS; i++) { + SW_Weather.dailyInputFlags[i] = xdif[i] ? swTRUE : swFALSE; + }; + + set_dailyInputIndices( + SW_Weather.dailyInputFlags, + SW_Weather.dailyInputIndices, + &SW_Weather.n_input_forcings + ); + + check_and_update_dailyInputFlags( + SW_Weather.use_cloudCoverMonthly, + SW_Weather.use_humidityMonthly, + SW_Weather.use_windSpeedMonthly, + SW_Weather.dailyInputFlags + ); + + // no monthly scaling + for (i = 0; i < MAX_MONTHS; i++) { + SW_Weather.scale_precip[i] = 1; + SW_Weather.scale_temp_max[i] = 0; + SW_Weather.scale_temp_min[i] = 0; + SW_Weather.scale_skyCover[i] = 0; + SW_Weather.scale_wind[i] = 1; + SW_Weather.scale_rH[i] = 0; + SW_Weather.scale_actVapPress[i] = 1; + SW_Weather.scale_shortWaveRad[i] = 1; + } + + + // Process weather data + #ifdef RSWDEBUG + if (debug) swprintf("'rSW2_readAllWeatherFromDisk': process weather data"); + #endif + // using global variables: SW_Weather, SW_Model, SW_Sky + SW_WTH_read(); + + // Finalize daily weather (weather generator & monthly scaling) + #ifdef RSWDEBUG + if (debug) swprintf(" > finalize daily weather.\n"); + #endif + SW_WTH_finalize_all_weather(); + + + // Return processed weather data + // using global variables: SW_Weather + res = PROTECT(onGet_WTH_DATA()); + + UNPROTECT(6); + return res; +} + + + + /** Expose SOILWAT2 constants and defines to internal R code of rSOILWAT2 @return A list with six elements: one element `kINT` for integer constants; @@ -488,7 +601,7 @@ SEXP sw_consts(void) { #endif const int nret = 9; // length of cret - const int nINT = 13; // length of vINT and cINT + const int nINT = 14; // length of vINT and cINT const int nNUM = 1; // length of vNUM and cNUM #ifdef RSWDEBUG @@ -528,14 +641,14 @@ SEXP sw_consts(void) { SWRC_PARAM_NMAX, eSW_NoTime, SW_OUTNPERIODS, SW_OUTNKEYS, SW_NSUMTYPES, NVEGTYPES, OUT_DIGITS, - N_SWRCs, N_PTFs + N_SWRCs, N_PTFs, MAX_INPUT_COLUMNS }; char *cINT[] = { "SW_NFILES", "MAX_LAYERS", "MAX_TRANSP_REGIONS", "MAX_NYEAR", "SWRC_PARAM_NMAX", "eSW_NoTime", "SW_OUTNPERIODS", "SW_OUTNKEYS", "SW_NSUMTYPES", "NVEGTYPES", "OUT_DIGITS", - "N_SWRCs", "N_PTFs" + "N_SWRCs", "N_PTFs", "MAX_INPUT_COLUMNS" }; // Vegetation types diff --git a/src/SW_R_lib.h b/src/SW_R_lib.h index f8067537..a5f6113f 100644 --- a/src/SW_R_lib.h +++ b/src/SW_R_lib.h @@ -33,6 +33,13 @@ SEXP tempError(void); SEXP onGetInputDataFromFiles(SEXP input, SEXP quiet); SEXP start(SEXP inputOptions, SEXP inputData, SEXP weatherList, SEXP quiet); SEXP rSW2_processAllWeather(SEXP weatherList, SEXP inputData); +SEXP rSW2_readAllWeatherFromDisk( + SEXP path, + SEXP name_prefix, + SEXP startYear, + SEXP endYear, + SEXP dailyInputFlags +); SEXP sw_consts(void); SEXP rSW2_SWRC_PTF_estimate_parameters( diff --git a/src/rSW_Weather.c b/src/rSW_Weather.c index 2973d24b..e7f432eb 100644 --- a/src/rSW_Weather.c +++ b/src/rSW_Weather.c @@ -17,6 +17,7 @@ #include "SOILWAT2/include/filefuncs.h" #include "SOILWAT2/include/Times.h" #include "SOILWAT2/include/myMemory.h" +#include "SOILWAT2/include/SW_Flow_lib_PET.h" #include "SOILWAT2/include/SW_Defines.h" #include "SOILWAT2/include/SW_Files.h" @@ -39,13 +40,18 @@ static char *MyFileName; static char *cSW_WTH_names[] = { + "MonthlyScalingParams", "UseSnow", "pct_SnowDrift", "pct_SnowRunoff", "use_weathergenerator", "use_weathergenerator_only", "FirstYear_Historical", // removed from SOILWAT2; kept here for backwards compatibility - "MonthlyScalingParams" + "use_cloudCoverMonthly", + "use_windSpeedMonthly", + "use_humidityMonthly", + "desc_rsds", + "dailyInputFlags" }; @@ -60,9 +66,26 @@ static void rSW2_setAllWeather( SW_WEATHER_HIST **allHist, int startYear, unsigned int n_years, - Bool use_weathergenerator_only + Bool use_weathergenerator_only, + Bool use_cloudCoverMonthly, + Bool use_humidityMonthly, + Bool use_windSpeedMonthly, + Bool *dailyInputFlags, + RealD *cloudcov, + RealD *windspeed, + RealD *r_humidity ); +static void rSW2_set_weather_hist( + SEXP listAllW, + TimeInt year, + SW_WEATHER_HIST *yearWeather, + Bool *dailyInputFlags +); + +static double value_or_missing(double x) { + return (R_FINITE(x) && !missing(x)) ? x : SW_MISSING; +} /* =================================================== */ /* Global Function Definitions */ @@ -77,19 +100,23 @@ static void rSW2_setAllWeather( */ SEXP onGet_SW_WTH_setup(void) { int i; - const int nitems = 6; + const int nitems = 8; RealD *p_MonthlyValues; SW_WEATHER *w = &SW_Weather; SEXP swWeather; SEXP SW_WTH; - SEXP - use_snow, pct_snowdrift, pct_snowRunoff, - use_weathergenerator, use_weathergenerator_only, yr_first; + SEXP + use_snow, pct_snowdrift, pct_snowRunoff, + use_weathergenerator, use_weathergenerator_only, + yr_first, + use_cloudCoverMonthly, use_windSpeedMonthly, use_humidityMonthly, + desc_rsds, + dailyInputFlags; SEXP MonthlyScalingParams, MonthlyScalingParams_names, MonthlyScalingParams_names_x, MonthlyScalingParams_names_y; - char *cMonthlyScalingParams_names[] = {"PPT", "MaxT", "MinT", "SkyCover", "Wind", "rH"}; + char *cMonthlyScalingParams_names[] = {"PPT", "MaxT", "MinT", "SkyCover", "Wind", "rH", "ActVP", "ShortWR"}; char *cMonths[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; PROTECT(swWeather = MAKE_CLASS("swWeather")); @@ -111,6 +138,21 @@ SEXP onGet_SW_WTH_setup(void) { */ INTEGER_POINTER(yr_first)[0] = SW_Weather.startYear; + PROTECT(use_cloudCoverMonthly = NEW_LOGICAL(1)); + LOGICAL_POINTER(use_cloudCoverMonthly)[0] = w->use_cloudCoverMonthly; + PROTECT(use_windSpeedMonthly = NEW_LOGICAL(1)); + LOGICAL_POINTER(use_windSpeedMonthly)[0] = w->use_windSpeedMonthly; + PROTECT(use_humidityMonthly = NEW_LOGICAL(1)); + LOGICAL_POINTER(use_humidityMonthly)[0] = w->use_humidityMonthly; + + PROTECT(desc_rsds = NEW_INTEGER(1)); + INTEGER_POINTER(desc_rsds)[0] = w->desc_rsds; + + PROTECT(dailyInputFlags = allocVector(LGLSXP, MAX_INPUT_COLUMNS)); + for (i = 0; i < MAX_INPUT_COLUMNS; i++) { + LOGICAL_POINTER(dailyInputFlags)[i] = w->dailyInputFlags[i]; + } + PROTECT(MonthlyScalingParams = allocMatrix(REALSXP, 12, nitems)); p_MonthlyValues = REAL(MonthlyScalingParams); for (i = 0; i < 12; i++) { @@ -120,6 +162,8 @@ SEXP onGet_SW_WTH_setup(void) { p_MonthlyValues[i + 12 * 3] = w->scale_skyCover[i]; p_MonthlyValues[i + 12 * 4] = w->scale_wind[i]; p_MonthlyValues[i + 12 * 5] = w->scale_rH[i]; + p_MonthlyValues[i + 12 * 6] = w->scale_actVapPress[i]; + p_MonthlyValues[i + 12 * 7] = w->scale_shortWaveRad[i]; } PROTECT(MonthlyScalingParams_names = allocVector(VECSXP, 2)); PROTECT(MonthlyScalingParams_names_x = allocVector(STRSXP, 12)); @@ -132,15 +176,21 @@ SEXP onGet_SW_WTH_setup(void) { SET_VECTOR_ELT(MonthlyScalingParams_names, 1, MonthlyScalingParams_names_y); setAttrib(MonthlyScalingParams, R_DimNamesSymbol, MonthlyScalingParams_names); - SET_SLOT(SW_WTH, install(cSW_WTH_names[0]), use_snow); - SET_SLOT(SW_WTH, install(cSW_WTH_names[1]), pct_snowdrift); - SET_SLOT(SW_WTH, install(cSW_WTH_names[2]), pct_snowRunoff); - SET_SLOT(SW_WTH, install(cSW_WTH_names[3]), use_weathergenerator); - SET_SLOT(SW_WTH, install(cSW_WTH_names[4]), use_weathergenerator_only); - SET_SLOT(SW_WTH, install(cSW_WTH_names[5]), yr_first); - SET_SLOT(SW_WTH, install(cSW_WTH_names[6]), MonthlyScalingParams); - - UNPROTECT(12); + SET_SLOT(SW_WTH, install(cSW_WTH_names[0]), MonthlyScalingParams); + SET_SLOT(SW_WTH, install(cSW_WTH_names[1]), use_snow); + SET_SLOT(SW_WTH, install(cSW_WTH_names[2]), pct_snowdrift); + SET_SLOT(SW_WTH, install(cSW_WTH_names[3]), pct_snowRunoff); + SET_SLOT(SW_WTH, install(cSW_WTH_names[4]), use_weathergenerator); + SET_SLOT(SW_WTH, install(cSW_WTH_names[5]), use_weathergenerator_only); + SET_SLOT(SW_WTH, install(cSW_WTH_names[6]), yr_first); + SET_SLOT(SW_WTH, install(cSW_WTH_names[7]), use_cloudCoverMonthly); + SET_SLOT(SW_WTH, install(cSW_WTH_names[8]), use_windSpeedMonthly); + SET_SLOT(SW_WTH, install(cSW_WTH_names[9]), use_humidityMonthly); + SET_SLOT(SW_WTH, install(cSW_WTH_names[10]), desc_rsds); + SET_SLOT(SW_WTH, install(cSW_WTH_names[11]), dailyInputFlags); + + + UNPROTECT(17); return SW_WTH; } @@ -155,23 +205,42 @@ void onSet_SW_WTH_setup(SEXP SW_WTH) { int i; SW_WEATHER *w = &SW_Weather; SEXP - use_snow, pct_snowdrift, pct_snowRunoff, - use_weathergenerator, use_weathergenerator_only; + use_snow, pct_snowdrift, pct_snowRunoff, + use_weathergenerator, use_weathergenerator_only, + use_cloudCoverMonthly, use_windSpeedMonthly, use_humidityMonthly, + desc_rsds, + dailyInputFlags; SEXP MonthlyScalingParams; RealD *p_MonthlyValues; + int *p_dailyInputFlags; MyFileName = SW_F_name(eWeather); - PROTECT(use_snow = GET_SLOT(SW_WTH, install(cSW_WTH_names[0]))); + SW_WeatherPrefix(w->name_prefix); + + PROTECT(MonthlyScalingParams = GET_SLOT(SW_WTH, install(cSW_WTH_names[0]))); + p_MonthlyValues = REAL(MonthlyScalingParams); + for (i = 0; i < 12; i++) { + w->scale_precip[i] = p_MonthlyValues[i + 12 * 0]; + w->scale_temp_max[i] = p_MonthlyValues[i + 12 * 1]; + w->scale_temp_min[i] = p_MonthlyValues[i + 12 * 2]; + w->scale_skyCover[i] = p_MonthlyValues[i + 12 * 3]; + w->scale_wind[i] = p_MonthlyValues[i + 12 * 4]; + w->scale_rH[i] = p_MonthlyValues[i + 12 * 5]; + w->scale_actVapPress[i] = p_MonthlyValues[i + 12 * 6]; + w->scale_shortWaveRad[i] = p_MonthlyValues[i + 12 * 7]; + } + + PROTECT(use_snow = GET_SLOT(SW_WTH, install(cSW_WTH_names[1]))); w->use_snow = (Bool) *INTEGER(use_snow); - PROTECT(pct_snowdrift = GET_SLOT(SW_WTH, install(cSW_WTH_names[1]))); + PROTECT(pct_snowdrift = GET_SLOT(SW_WTH, install(cSW_WTH_names[2]))); w->pct_snowdrift = *REAL(pct_snowdrift); - PROTECT(pct_snowRunoff = GET_SLOT(SW_WTH, install(cSW_WTH_names[2]))); + PROTECT(pct_snowRunoff = GET_SLOT(SW_WTH, install(cSW_WTH_names[3]))); w->pct_snowRunoff = *REAL(pct_snowRunoff); - PROTECT(use_weathergenerator = GET_SLOT(SW_WTH, install(cSW_WTH_names[3]))); + PROTECT(use_weathergenerator = GET_SLOT(SW_WTH, install(cSW_WTH_names[4]))); w->generateWeatherMethod = *INTEGER(use_weathergenerator) ? 2 : 0; - PROTECT(use_weathergenerator_only = GET_SLOT(SW_WTH, install(cSW_WTH_names[4]))); + PROTECT(use_weathergenerator_only = GET_SLOT(SW_WTH, install(cSW_WTH_names[5]))); w->use_weathergenerator_only = (Bool) *INTEGER(use_weathergenerator_only); if (w->use_weathergenerator_only) { w->generateWeatherMethod = 2; @@ -181,23 +250,26 @@ void onSet_SW_WTH_setup(SEXP SW_WTH) { SEXP yr_first; int tmp; - PROTECT(yr_first = GET_SLOT(SW_WTH, install(cSW_WTH_names[5]))); + PROTECT(yr_first = GET_SLOT(SW_WTH, install(cSW_WTH_names[6]))); tmp = *INTEGER(yr_first); w->yr.first = (tmp < 0) ? SW_Model.startyr : yearto4digit(tmp); */ - PROTECT(MonthlyScalingParams = GET_SLOT(SW_WTH, install(cSW_WTH_names[6]))); - p_MonthlyValues = REAL(MonthlyScalingParams); - for (i = 0; i < 12; i++) { - w->scale_precip[i] = p_MonthlyValues[i + 12 * 0]; - w->scale_temp_max[i] = p_MonthlyValues[i + 12 * 1]; - w->scale_temp_min[i] = p_MonthlyValues[i + 12 * 2]; - w->scale_skyCover[i] = p_MonthlyValues[i + 12 * 3]; - w->scale_wind[i] = p_MonthlyValues[i + 12 * 4]; - w->scale_rH[i] = p_MonthlyValues[i + 12 * 5]; - } + PROTECT(use_cloudCoverMonthly = GET_SLOT(SW_WTH, install(cSW_WTH_names[7]))); + w->use_cloudCoverMonthly = (Bool) *INTEGER(use_cloudCoverMonthly); + PROTECT(use_windSpeedMonthly = GET_SLOT(SW_WTH, install(cSW_WTH_names[8]))); + w->use_windSpeedMonthly = (Bool) *INTEGER(use_windSpeedMonthly); + PROTECT(use_humidityMonthly = GET_SLOT(SW_WTH, install(cSW_WTH_names[9]))); + w->use_humidityMonthly = (Bool) *INTEGER(use_humidityMonthly); - SW_WeatherPrefix(w->name_prefix); + PROTECT(desc_rsds = GET_SLOT(SW_WTH, install(cSW_WTH_names[10]))); + w->desc_rsds = (unsigned int) *INTEGER(desc_rsds); + + PROTECT(dailyInputFlags = GET_SLOT(SW_WTH, install(cSW_WTH_names[11]))); + p_dailyInputFlags = INTEGER(dailyInputFlags); + for (i = 0; i < MAX_INPUT_COLUMNS; i++) { + w->dailyInputFlags[i] = (Bool) p_dailyInputFlags[i]; + } /* `SW_weather.yr` was removed from SOILWAT2: w->yr.last = SW_Model.endyr; @@ -215,7 +287,14 @@ void onSet_SW_WTH_setup(SEXP SW_WTH) { } */ - UNPROTECT(6); + check_and_update_dailyInputFlags( + w->use_cloudCoverMonthly, + w->use_humidityMonthly, + w->use_windSpeedMonthly, + w->dailyInputFlags + ); + + UNPROTECT(11); } @@ -253,16 +332,29 @@ SEXP onGet_WTH_DATA(void) { @brief Copy weather data for `year` from `SOILWAT2` data structure to `rSOILWAT2` `swWeatherData` + Daily weather elements that are not internally stored by `SOILWAT2` are + returned as missing values; these are + `"windSpeed_east_mPERs"`, `"windSpeed_north_mPERs"`, + `"rHmax_pct"`, `"rHmin_pct"`, `"specHavg_pct"`, `"Tdewpoint_C"` + Called by `onGet_WTH_DATA()` */ SEXP onGet_WTH_DATA_YEAR(TimeInt year) { int i, days, yearIndex; - const int nitems = 4; + const int nitems = 15; SEXP swWeatherData; SEXP WeatherData; SEXP Year, Year_names, Year_names_y; SEXP nYear; - char *cYear[] = {"DOY", "Tmax_C", "Tmin_C", "PPT_cm"}; + char *cYear[] = { + "DOY", + "Tmax_C", "Tmin_C", "PPT_cm", + "cloudCov_pct", + "windSpeed_mPERs", "windSpeed_east_mPERs", "windSpeed_north_mPERs", + "rHavg_pct", "rHmax_pct", "rHmin_pct", "specHavg_pct", "Tdewpoint_C", + "actVP_kPa", + "shortWR" + }; RealD *p_Year; SW_WEATHER *w = &SW_Weather; @@ -279,9 +371,24 @@ SEXP onGet_WTH_DATA_YEAR(TimeInt year) { p_Year = REAL(Year); for (i = 0; i < days; i++) { p_Year[i + days * 0] = (i + 1); - p_Year[i + days * 1] = w->allHist[yearIndex]->temp_max[i]; - p_Year[i + days * 2] = w->allHist[yearIndex]->temp_min[i]; - p_Year[i + days * 3] = w->allHist[yearIndex]->ppt[i]; + p_Year[i + days * (TEMP_MAX + 1)] = w->allHist[yearIndex]->temp_max[i]; + p_Year[i + days * (TEMP_MIN + 1)] = w->allHist[yearIndex]->temp_min[i]; + p_Year[i + days * (PPT + 1)] = w->allHist[yearIndex]->ppt[i]; + + p_Year[i + days * (CLOUD_COV + 1)] = w->allHist[yearIndex]->cloudcov_daily[i]; + + p_Year[i + days * (WIND_SPEED + 1)] = w->allHist[yearIndex]->windspeed_daily[i]; + p_Year[i + days * (WIND_EAST + 1)] = NA_REAL; // windSpeed_east_mPERs + p_Year[i + days * (WIND_NORTH + 1)] = NA_REAL; // windSpeed_north_mPERs + + p_Year[i + days * (REL_HUMID + 1)] = w->allHist[yearIndex]->r_humidity_daily[i]; + p_Year[i + days * (REL_HUMID_MAX + 1)] = NA_REAL; // rHmax_pct + p_Year[i + days * (REL_HUMID_MIN + 1)] = NA_REAL; // rHmin_pct + p_Year[i + days * (SPEC_HUMID + 1)] = NA_REAL; // specHavg_pct + p_Year[i + days * (TEMP_DEWPOINT + 1)] = NA_REAL; // Tdewpoint_C + + p_Year[i + days * (ACTUAL_VP + 1)] = w->allHist[yearIndex]->actualVaporPressure[i]; + p_Year[i + days * (SHORT_WR + 1)] = w->allHist[yearIndex]->shortWaveRad[i]; } PROTECT(Year_names = allocVector(VECSXP, 2)); @@ -313,6 +420,10 @@ SEXP onGet_WTH_DATA_YEAR(TimeInt year) { @note Elements `endyr` and `startyr` of `SW_Model` must be set/updated via `onSet_SW_MDL()` before this function is called. + + @note `SW_Weather` (via `onSet_SW_WTH_setup()`) and + `SW_Sky` (via `onSet_SW_SKY()`) must be set/updated + before this function is called. */ void onSet_WTH_DATA(void) { @@ -344,7 +455,14 @@ void onSet_WTH_DATA(void) { SW_Weather.allHist, SW_Weather.startYear, SW_Weather.n_years, - SW_Weather.use_weathergenerator_only + SW_Weather.use_weathergenerator_only, + SW_Weather.use_cloudCoverMonthly, + SW_Weather.use_humidityMonthly, + SW_Weather.use_windSpeedMonthly, + SW_Weather.dailyInputFlags, + SW_Sky.cloudcov, + SW_Sky.windspeed, + SW_Sky.r_humidity ); } @@ -356,112 +474,312 @@ static void rSW2_setAllWeather( SW_WEATHER_HIST **allHist, int startYear, unsigned int n_years, - Bool use_weathergenerator_only + Bool use_weathergenerator_only, + Bool use_cloudCoverMonthly, + Bool use_humidityMonthly, + Bool use_windSpeedMonthly, + Bool *dailyInputFlags, + RealD *cloudcov, + RealD *windspeed, + RealD *r_humidity ) { - int nList, yearIndex, year, numDaysYear, day, doy, i, j; - Bool weth_found; - SEXP tmpW, yrWData; - double *p_yrWData; - - nList = LENGTH(listAllW); - - // Loop over years and move weather data to `SOILWAT2` `allHist` - for (yearIndex = 0; yearIndex < n_years; yearIndex++) { - - if (use_weathergenerator_only) { - // Set values to missing for call to `generateMissingWeather()` - _clear_hist_weather(allHist[yearIndex]); - - } else { - year = yearIndex + startYear; - - // Locate suitable year among rSOILWAT2 list of `swWeatherData` - weth_found = swFALSE; - - for (i = 0; !weth_found && i < nList; i++) { - tmpW = VECTOR_ELT(listAllW, i); - weth_found = (Bool) year == *INTEGER(GET_SLOT(tmpW, install("year"))); - } - - if (weth_found) { - yrWData = GET_SLOT(tmpW, install("data")); - weth_found = !isnull(yrWData); - } - if (weth_found) { - numDaysYear = Time_get_lastdoy_y(year); - - if (nrows(yrWData) != numDaysYear || ncols(yrWData) != 4) { - LogError( - logfp, - LOGFATAL, - "Weather data (year %d): wrong dimensions: " - "expected %d rows (had %d) and 4 columns (had %d).\n", - year, - numDaysYear, - nrows(yrWData), - ncols(yrWData) - ); - return; + unsigned int yearIndex, year; + + /* Interpolation is to be in base0 in `interpolate_monthlyValues()` */ + Bool interpAsBase1 = swFALSE; + + for(yearIndex = 0; yearIndex < n_years; yearIndex++) { + year = yearIndex + startYear; + + // Set all daily weather values to missing + _clear_hist_weather(allHist[yearIndex]); + + // Update yearly day/month information needed when interpolating + // cloud cover, wind speed, and relative humidity if necessary + Time_new_year(year); + + if(use_cloudCoverMonthly) { + interpolate_monthlyValues(cloudcov, interpAsBase1, allHist[yearIndex]->cloudcov_daily); } - p_yrWData = REAL(yrWData); + if(use_humidityMonthly) { + interpolate_monthlyValues(r_humidity, interpAsBase1, allHist[yearIndex]->r_humidity_daily); + } + + if(use_windSpeedMonthly) { + interpolate_monthlyValues(windspeed, interpAsBase1, allHist[yearIndex]->windspeed_daily); + } - // Loop over days of current year - for (day = 0; day < numDaysYear; day++) { + // Read daily weather values from disk + if (!use_weathergenerator_only) { - doy = p_yrWData[day + numDaysYear * 0]; - if (doy < 1 || doy > numDaysYear) { - LogError( + rSW2_set_weather_hist( + listAllW, + year, + allHist[yearIndex], + dailyInputFlags + ); + } + } +} + + +// Equivalent to `_read_weather_hist()`: +// fill `SOILWAT2` `allHist` with values from `rSOILWAT2` +static void rSW2_set_weather_hist( + SEXP listAllW, + TimeInt year, + SW_WEATHER_HIST *yearWeather, + Bool *dailyInputFlags +) { + + // Locate suitable year among rSOILWAT2 list of `swWeatherData` + int i, nList = LENGTH(listAllW); + TimeInt numDaysYear; + Bool weth_found = FALSE; + SEXP tmpW, yrWData; + double *p_yrWData; + + for (i = 0; !weth_found && i < nList; i++) { + tmpW = VECTOR_ELT(listAllW, i); + weth_found = (Bool) year == *INTEGER(GET_SLOT(tmpW, install("year"))); + } + + if (weth_found) { + yrWData = GET_SLOT(tmpW, install("data")); + weth_found = !isnull(yrWData); + } + + if (!weth_found) { + return; + } + + numDaysYear = Time_get_lastdoy_y(year); + if (nrows(yrWData) != numDaysYear) { + LogError( + logfp, + LOGFATAL, + "Weather data (year %d): " + "expected %d rows (had %d).\n", + year, + numDaysYear, + nrows(yrWData) + ); + return; + } + + // Suitable year among rSOILWAT2 weather list located + p_yrWData = REAL(yrWData); + + + // Copy values from rSOILWAT2 to SOILWAT2 + int doy; + + // Pre-calculate logic for calculation of daily variables + Bool hasMaxMinTemp = (Bool) (dailyInputFlags[TEMP_MAX] && dailyInputFlags[TEMP_MIN]); + Bool hasMaxMinRelHumid = (Bool) (dailyInputFlags[REL_HUMID_MAX] && dailyInputFlags[REL_HUMID_MIN]); + Bool hasEastNorthWind = (Bool) (dailyInputFlags[WIND_EAST] && dailyInputFlags[WIND_NORTH]); + + // Calculate if daily input values of humidity are to be used instead of + // being interpolated from monthly values + Bool useHumidityDaily = (Bool) (hasMaxMinRelHumid || dailyInputFlags[REL_HUMID] || + dailyInputFlags[SPEC_HUMID] || dailyInputFlags[ACTUAL_VP]); + + double v1, v2, es, e, relHum, tempSlope, svpVal; + + + // Loop over days of current year + for (doy = 0; doy < numDaysYear; doy++) { + + /* --- Make the assignments ---- */ + // (Translate R's `NA` to SOILWAT2's `SW_MISSING`) + + if (doy != p_yrWData[doy + numDaysYear * 0] - 1) { + LogError( logfp, LOGFATAL, "Weather data (year %d): " "day of year out of range (%d), expected: %d.\n", year, - doy, - day + 1 - ); - } + p_yrWData[doy + numDaysYear * 0], + doy + 1 + ); + } - // Copy weather data to `SOILWAT2` `allHist` + // Maximum daily temperature [C] + yearWeather->temp_max[doy] = value_or_missing( + p_yrWData[doy + numDaysYear * (TEMP_MAX + 1)] + ); + + // Minimum daily temperature [C] + yearWeather->temp_min[doy] = value_or_missing( + p_yrWData[doy + numDaysYear * (TEMP_MIN + 1)] + ); + + // Calculate average air temperature if min/max not missing + if ( + !missing(yearWeather->temp_max[doy]) && + !missing(yearWeather->temp_min[doy]) + ) { + yearWeather->temp_avg[doy] = + (yearWeather->temp_max[doy] + yearWeather->temp_min[doy]) / 2.0; + } + + // Precipitation [cm] + yearWeather->ppt[doy] = value_or_missing( + p_yrWData[doy + numDaysYear * (PPT + 1)] + ); - // Translate `NA` to `SW_MISSING` - j = day + numDaysYear * 1; - allHist[yearIndex]->temp_max[day] = - (R_FINITE(p_yrWData[j]) && !missing(p_yrWData[j])) ? - p_yrWData[j] : - SW_MISSING; - j = day + numDaysYear * 2; - allHist[yearIndex]->temp_min[day] = - (R_FINITE(p_yrWData[j]) && !missing(p_yrWData[j])) ? - p_yrWData[j] : - SW_MISSING; + // Cloud cover [%] + if (dailyInputFlags[CLOUD_COV]) { + yearWeather->cloudcov_daily[doy] = value_or_missing( + p_yrWData[doy + numDaysYear * (CLOUD_COV + 1)] + ); + } - j = day + numDaysYear * 3; - allHist[yearIndex]->ppt[day] = - (R_FINITE(p_yrWData[j]) && !missing(p_yrWData[j])) ? - p_yrWData[j] : - SW_MISSING; + + // Wind speed [m/s] + if (dailyInputFlags[WIND_SPEED]) { + yearWeather->windspeed_daily[doy] = value_or_missing( + p_yrWData[doy + numDaysYear * (WIND_SPEED + 1)] + ); + + } else if (hasEastNorthWind) { + + // Make sure wind is not calculated over SW_MISSING + v1 = value_or_missing( + p_yrWData[doy + numDaysYear * (WIND_EAST + 1)] + ); + v2 = value_or_missing( + p_yrWData[doy + numDaysYear * (WIND_NORTH + 1)] + ); + + if (!missing(v1) && !missing(v2)) { + yearWeather->windspeed_daily[doy] = sqrt( + squared(v1) + squared(v2) + ); + } + } - // Calculate average air temperature + // Relative humidity [%] + if (useHumidityDaily) { + if (hasMaxMinRelHumid) { + // Make sure rH is not calculated over SW_MISSING + v1 = value_or_missing( + p_yrWData[doy + numDaysYear * (REL_HUMID_MAX + 1)] + ); + v2 = value_or_missing( + p_yrWData[doy + numDaysYear * (REL_HUMID_MIN + 1)] + ); + + if (!missing(v1) && !missing(v2)) { + yearWeather->r_humidity_daily[doy] = (v1 + v2) / 2; + } + + } else if (dailyInputFlags[REL_HUMID]) { + yearWeather->r_humidity_daily[doy] = value_or_missing( + p_yrWData[doy + numDaysYear * (REL_HUMID + 1)] + ); + + } else if (dailyInputFlags[SPEC_HUMID]) { + // Make sure rH is not calculated over SW_MISSING + v1 = value_or_missing( + p_yrWData[doy + numDaysYear * (SPEC_HUMID + 1)] + ); + + if (!missing(yearWeather->temp_avg[doy]) && !missing(v1)) { + // Specific humidity (Bolton 1980) + es = 6.112 * exp(17.67 * yearWeather->temp_avg[doy]) / + (yearWeather->temp_avg[doy] + 243.5); + + e = (v1 * 1013.25) / (.378 * v1 + .622); + + relHum = e / es; + relHum = max(0., relHum); + + yearWeather->r_humidity_daily[doy] = min(100., relHum); + } + } + + // Actual vapor pressure [kPa] + if (dailyInputFlags[ACTUAL_VP]) { + yearWeather->actualVaporPressure[doy] = value_or_missing( + p_yrWData[doy + numDaysYear * (ACTUAL_VP + 1)] + ); + + } else { + v1 = value_or_missing( + p_yrWData[doy + numDaysYear * (TEMP_DEWPOINT + 1)] + ); + + + if (dailyInputFlags[TEMP_DEWPOINT] && !missing(v1)) { + yearWeather->actualVaporPressure[doy] = actualVaporPressure3(v1); + + } else if (hasMaxMinTemp && hasMaxMinRelHumid) { + // Make sure vp is not calculated over SW_MISSING + v1 = value_or_missing( + p_yrWData[doy + numDaysYear * (REL_HUMID_MAX + 1)] + ); + v2 = value_or_missing( + p_yrWData[doy + numDaysYear * (REL_HUMID_MIN + 1)] + ); + + if ( + !missing(yearWeather->temp_max[doy]) && + !missing(yearWeather->temp_min[doy]) && + !missing(v1) && !missing(v2) + ) { + yearWeather->actualVaporPressure[doy] = actualVaporPressure2( + v1, + v2, + yearWeather->temp_max[doy], + yearWeather->temp_min[doy] + ); + } + + } else if (dailyInputFlags[REL_HUMID] || dailyInputFlags[SPEC_HUMID]) { + if ( + !missing(yearWeather->r_humidity_daily[doy]) && + !missing(yearWeather->temp_avg[doy]) + ) { + yearWeather->actualVaporPressure[doy] = actualVaporPressure1( + yearWeather->r_humidity_daily[doy], + yearWeather->temp_avg[doy] + ); + } + } + } + + + // Relative humidity [%] if still missing if ( - !missing(allHist[yearIndex]->temp_max[day]) && - !missing(allHist[yearIndex]->temp_min[day]) + missing(yearWeather->r_humidity_daily[doy]) && + (dailyInputFlags[ACTUAL_VP] || dailyInputFlags[TEMP_DEWPOINT]) ) { - allHist[yearIndex]->temp_avg[day] = ( - allHist[yearIndex]->temp_max[day] + - allHist[yearIndex]->temp_min[day] - ) / 2.; + // Make sure rH is not calculated over SW_MISSING + if ( + !missing(yearWeather->temp_avg[doy]) && + !missing(yearWeather->actualVaporPressure[doy]) + ) { + svpVal = svp(yearWeather->temp_avg[doy], &tempSlope); + + yearWeather->r_humidity_daily[doy] = + yearWeather->actualVaporPressure[doy] / svpVal; + } } } - } else { - // Set values to missing for call to `generateMissingWeather()` - _clear_hist_weather(allHist[yearIndex]); - } + + // Downward surface shortwave radiation + if (dailyInputFlags[SHORT_WR]) { + yearWeather->shortWaveRad[doy] = value_or_missing( + p_yrWData[doy + numDaysYear * (SHORT_WR + 1)] + ); + } } - } } SEXP rSW2_calc_SiteClimate(SEXP weatherList, SEXP yearStart, SEXP yearEnd, @@ -469,14 +787,15 @@ SEXP rSW2_calc_SiteClimate(SEXP weatherList, SEXP yearStart, SEXP yearEnd, SW_WEATHER_HIST **allHist; - SW_WEATHER *weather = &SW_Weather; - SW_CLIMATE_YEARLY climateOutput; SW_CLIMATE_CLIM climateAverages; int numYears = asInteger(yearEnd) - asInteger(yearStart) + 1, year, calcSiteOutputNum = 10, index; + Bool dailyInputFlags[MAX_INPUT_COLUMNS]; + double cloudcov[MAX_MONTHS], windspeed[MAX_MONTHS], r_humidity[MAX_MONTHS]; + SEXP res, monthlyMean, monthlyMax, monthlyMin, monthlyPPT, MAT_C, MAP_cm, vectorNames, C4Variables, Cheatgrass, cnamesC4SEXP, cnamesCheatgrassSEXP; @@ -513,9 +832,29 @@ SEXP rSW2_calc_SiteClimate(SEXP weatherList, SEXP yearStart, SEXP yearEnd, Time_init_model(); + // Set `dailyInputFlags`: currently, `calcSiteClimate()` use only tmax, tmin, ppt + for (index = 0; index < MAX_INPUT_COLUMNS; index++) { + dailyInputFlags[index] = FALSE; + } + dailyInputFlags[TEMP_MAX] = TRUE; + dailyInputFlags[TEMP_MIN] = TRUE; + dailyInputFlags[PPT] = TRUE; + // Fill SOILWAT `allHist` with data from weatherList - rSW2_setAllWeather(weatherList, allHist, asInteger(yearStart), numYears, - weather->use_weathergenerator_only); + rSW2_setAllWeather( + weatherList, + allHist, + asInteger(yearStart), + numYears, + FALSE, // use_weathergenerator_only + FALSE, // use_cloudCoverMonthly, + FALSE, // use_windSpeedMonthly, + FALSE, // use_humidityMonthly, + dailyInputFlags, + cloudcov, + windspeed, + r_humidity + ); // Allocate memory of structs for climate on SOILWAT side allocateClimateStructs(numYears, &climateOutput, &climateAverages); diff --git a/tests/test_data/Ex1_input.rds b/tests/test_data/Ex1_input.rds index d1fba66b..7c0077a2 100644 Binary files a/tests/test_data/Ex1_input.rds and b/tests/test_data/Ex1_input.rds differ diff --git a/tests/test_data/Ex1_output.rds b/tests/test_data/Ex1_output.rds index 0cec5993..318cbe68 100644 Binary files a/tests/test_data/Ex1_output.rds and b/tests/test_data/Ex1_output.rds differ diff --git a/tests/test_data/Ex1_weather.rds b/tests/test_data/Ex1_weather.rds index 82978781..621d1933 100644 Binary files a/tests/test_data/Ex1_weather.rds and b/tests/test_data/Ex1_weather.rds differ diff --git a/tests/test_data/Ex2_input.rds b/tests/test_data/Ex2_input.rds index f44179c4..9003cd94 100644 Binary files a/tests/test_data/Ex2_input.rds and b/tests/test_data/Ex2_input.rds differ diff --git a/tests/test_data/Ex2_weather.rds b/tests/test_data/Ex2_weather.rds index 0116f91c..1533bfe4 100644 Binary files a/tests/test_data/Ex2_weather.rds and b/tests/test_data/Ex2_weather.rds differ diff --git a/tests/test_data/Ex3_input.rds b/tests/test_data/Ex3_input.rds index c8e4cc2c..3255bb9c 100644 Binary files a/tests/test_data/Ex3_input.rds and b/tests/test_data/Ex3_input.rds differ diff --git a/tests/test_data/Ex3_output.rds b/tests/test_data/Ex3_output.rds index 76b5e5b7..ef11ea11 100644 Binary files a/tests/test_data/Ex3_output.rds and b/tests/test_data/Ex3_output.rds differ diff --git a/tests/test_data/Ex3_weather.rds b/tests/test_data/Ex3_weather.rds index 82978781..621d1933 100644 Binary files a/tests/test_data/Ex3_weather.rds and b/tests/test_data/Ex3_weather.rds differ diff --git a/tests/test_data/Ex4_input.rds b/tests/test_data/Ex4_input.rds index 4ebce754..b86f5734 100644 Binary files a/tests/test_data/Ex4_input.rds and b/tests/test_data/Ex4_input.rds differ diff --git a/tests/test_data/Ex4_output.rds b/tests/test_data/Ex4_output.rds index 1c5b4efa..b8eb17ff 100644 Binary files a/tests/test_data/Ex4_output.rds and b/tests/test_data/Ex4_output.rds differ diff --git a/tests/test_data/Ex4_weather.rds b/tests/test_data/Ex4_weather.rds index 82978781..621d1933 100644 Binary files a/tests/test_data/Ex4_weather.rds and b/tests/test_data/Ex4_weather.rds differ diff --git a/tests/test_data/Ex5_input.rds b/tests/test_data/Ex5_input.rds index f3b7ccbb..0c1f3c20 100644 Binary files a/tests/test_data/Ex5_input.rds and b/tests/test_data/Ex5_input.rds differ diff --git a/tests/test_data/Ex5_output.rds b/tests/test_data/Ex5_output.rds index ca5ee95d..1b928093 100644 Binary files a/tests/test_data/Ex5_output.rds and b/tests/test_data/Ex5_output.rds differ diff --git a/tests/test_data/Ex5_weather.rds b/tests/test_data/Ex5_weather.rds index 82978781..621d1933 100644 Binary files a/tests/test_data/Ex5_weather.rds and b/tests/test_data/Ex5_weather.rds differ diff --git a/tests/test_data/Ex6_input.rds b/tests/test_data/Ex6_input.rds index e9a1e00b..d5ae0bd9 100644 Binary files a/tests/test_data/Ex6_input.rds and b/tests/test_data/Ex6_input.rds differ diff --git a/tests/test_data/Ex6_output.rds b/tests/test_data/Ex6_output.rds index 043d8dae..1a9f12a9 100644 Binary files a/tests/test_data/Ex6_output.rds and b/tests/test_data/Ex6_output.rds differ diff --git a/tests/test_data/Ex6_weather.rds b/tests/test_data/Ex6_weather.rds index 8d1b14d9..621d1933 100644 Binary files a/tests/test_data/Ex6_weather.rds and b/tests/test_data/Ex6_weather.rds differ diff --git a/tests/test_data/versioned_swInputData/Ex1_input_v6.0.0.rds b/tests/test_data/versioned_swInputData/Ex1_input_v6.0.0.rds index d1fba66b..7c0077a2 100644 Binary files a/tests/test_data/versioned_swInputData/Ex1_input_v6.0.0.rds and b/tests/test_data/versioned_swInputData/Ex1_input_v6.0.0.rds differ diff --git a/tests/test_data/versioned_weatherData/Ex1_weather_v4.0.0.rds b/tests/test_data/versioned_weatherData/Ex1_weather_v4.0.0.rds new file mode 100644 index 00000000..82978781 Binary files /dev/null and b/tests/test_data/versioned_weatherData/Ex1_weather_v4.0.0.rds differ diff --git a/tests/test_data/versioned_weatherData/Ex1_weather_v6.0.0.rds b/tests/test_data/versioned_weatherData/Ex1_weather_v6.0.0.rds new file mode 100644 index 00000000..621d1933 Binary files /dev/null and b/tests/test_data/versioned_weatherData/Ex1_weather_v6.0.0.rds differ diff --git a/tests/testthat/test_Upgrade_rSOILWAT_S4_classes.R b/tests/testthat/test_Upgrade_rSOILWAT_S4_classes.R index 516f7ac2..4208a887 100644 --- a/tests/testthat/test_Upgrade_rSOILWAT_S4_classes.R +++ b/tests/testthat/test_Upgrade_rSOILWAT_S4_classes.R @@ -1,6 +1,6 @@ -# Maintenance: +#--- Maintenance inputs ------ # Copy "Ex1_input.rds" to "versioned_swInputData/" (with updated name) # if significant changes occurred. @@ -27,3 +27,37 @@ test_that("Upgrade old rSOILWAT2 input objects", { expect_true(validObject(sw_upgrade(xold))) } }) + + + +#--- Maintenance weather ------ +# Copy "Ex1_weather.rds" to "versioned_weatherData/" (with updated name) +# if significant changes occurred. + +test_that("Upgrade old rSOILWAT2 weather objects", { + #--- Locate versioned `weatherData` objects + dir_test_data <- file.path("..", "test_data", "versioned_weatherData") + fnames_vdata <- list.files( + dir_test_data, + pattern = "Ex1_weather_v", + full.names = TRUE + ) + + tmp <- gsub("Ex1_weather_v", "", basename(fnames_vdata), fixed = TRUE) + tmp <- gsub(".rds", "", tmp, fixed = TRUE) + vs <- as.numeric_version(tmp) + + expect_gt(length(fnames_vdata), 0L) + + + # Upgrade weather data, i.e., lists of class `swWeatherData` + for (k in seq_along(fnames_vdata)) { + x <- readRDS(fnames_vdata[k]) + + if (!check_version(vs[k])) { + expect_false(dbW_check_weatherData(x)) + } + + expect_true(dbW_check_weatherData(upgrade_weatherHistory(x))) + } +}) diff --git a/tests/testthat/test_Vegetation.R b/tests/testthat/test_Vegetation.R index edb32b39..4f350329 100644 --- a/tests/testthat/test_Vegetation.R +++ b/tests/testthat/test_Vegetation.R @@ -111,11 +111,16 @@ test_that("Vegetation: estimate land cover composition", { )[["Rel_Abundance_L1"]] # Expect them to be identical - expect_identical(pnvsim[["fCover_shrub"]], pnvex[["SW_SHRUB"]]) - expect_identical(pnvsim[["fCover_grass"]], pnvex[["SW_GRASS"]]) - expect_identical(pnvsim[["fCover_forbs"]], pnvex[["SW_FORBS"]]) - expect_identical(pnvsim[["fCover_tree"]], pnvex[["SW_TREES"]]) - expect_identical(pnvsim[["fCover_BareGround"]], pnvex[["SW_BAREGROUND"]]) + tol <- sqrt(.Machine[["double.eps"]]) + expect_equal(pnvsim[["fCover_shrub"]], pnvex[["SW_SHRUB"]], tolerance = tol) + expect_equal(pnvsim[["fCover_grass"]], pnvex[["SW_GRASS"]], tolerance = tol) + expect_equal(pnvsim[["fCover_forbs"]], pnvex[["SW_FORBS"]], tolerance = tol) + expect_equal(pnvsim[["fCover_tree"]], pnvex[["SW_TREES"]], tolerance = tol) + expect_equal( + pnvsim[["fCover_BareGround"]], + pnvex[["SW_BAREGROUND"]], + tolerance = tol + ) diff --git a/tests/testthat/test_WeatherData.R b/tests/testthat/test_WeatherData.R index 8cefb555..7fa481c9 100644 --- a/tests/testthat/test_WeatherData.R +++ b/tests/testthat/test_WeatherData.R @@ -1,4 +1,15 @@ +path_example1 <- system.file("extdata", "example1", package = "rSOILWAT2") +dir_weather <- list.files( + file.path(path_example1, "Input"), + pattern = "data_weather" +) + +test_that("Test data availability", { + expect_gt(length(dir_weather), 0) +}) + + test_that("Weather data check", { expect_false(dbW_check_weatherData(NA)) expect_false(dbW_check_weatherData(NULL)) @@ -8,8 +19,8 @@ test_that("Weather data check", { expect_false(dbW_check_weatherData(swWeatherData())) expect_false(dbW_check_weatherData(weatherHistory())) expect_false(dbW_check_weatherData( - swWeatherData(rSOILWAT2::weatherData[[1]])) - ) + swWeatherData(rSOILWAT2::weatherData[[1]]) + )) expect_true(dbW_check_weatherData(rSOILWAT2::weatherData)) expect_true(dbW_check_weatherData(weatherHistory(rSOILWAT2::weatherData))) @@ -19,4 +30,171 @@ test_that("Weather data check", { expect_true(dbW_check_weatherData( get_WeatherHistory(rSOILWAT2::sw_exampleData) )) + expect_true(dbW_check_weatherData(weatherHistory(), check_all = FALSE)) +}) + +test_that("Missing weather data", { + expect_true(is_missing_weather(NA)) + expect_true(is_missing_weather(NaN)) + expect_true(is_missing_weather(999)) + + expect_false(is_missing_weather(0)) + expect_false(is_missing_weather(-5)) + expect_false(is_missing_weather(100)) +}) + + +test_that("Weather data sources", { + template_swin <- rSOILWAT2::sw_exampleData + + # see data-raw/prepare_testInput_objects.R + add_weather_sources <- c("minimalInputs", "daymet", "gridmet", "maca") + template_dailyInputFlags <- c(rep(TRUE, 3L), rep(FALSE, 11L)) + + for (ws in add_weather_sources) { + ws_dailyInputFlags <- switch( + EXPR = ws, + minimalInputs = template_dailyInputFlags, + daymet = { + dif <- template_dailyInputFlags + dif[13L] <- TRUE # ACTUAL_VP + dif[14L] <- TRUE # SHORT_WR, desc_rsds = 2 + dif + }, + gridmet = { + dif <- template_dailyInputFlags + dif[5L] <- TRUE # WIND_SPEED + dif[9L] <- TRUE # REL_HUMID_MAX + dif[10L] <- TRUE # REL_HUMID_MIN + dif[14L] <- TRUE # SHORT_WR, desc_rsds = 1 + dif + }, + maca = { + dif <- template_dailyInputFlags + dif[6L] <- TRUE # WIND_EAST + dif[7L] <- TRUE # WIND_NORTH + dif[9L] <- TRUE # REL_HUMID_MAX + dif[10L] <- TRUE # REL_HUMID_MIN + dif[14L] <- TRUE # SHORT_WR, desc_rsds = 1 + dif + } + ) + + weatherDirName <- switch( + EXPR = ws, + minimalInputs = "data_weather", + grep(ws, dir_weather, value = TRUE) + ) + + sww <- list( + C = rSOILWAT2::getWeatherData_folders( + LookupWeatherFolder = file.path(path_example1, "Input"), + weatherDirName = weatherDirName, + filebasename = "weath", + dailyInputFlags = ws_dailyInputFlags, + method = "C" + ), + + R = rSOILWAT2::getWeatherData_folders( + LookupWeatherFolder = file.path(path_example1, "Input"), + weatherDirName = weatherDirName, + filebasename = "weath", + dailyInputFlags = ws_dailyInputFlags, + method = "R" + ) + ) + + expect_true(rSOILWAT2::dbW_check_weatherData(sww[["C"]])) + expect_true(rSOILWAT2::dbW_check_weatherData(sww[["R"]])) + + years <- rSOILWAT2::get_years_from_weatherData(sww[["C"]]) + + expect_identical( + years, + rSOILWAT2::get_years_from_weatherData(sww[["R"]]) + ) + + + calc_difs <- lapply(sww, rSOILWAT2::calc_dailyInputFlags) + + expect_equal( + ws_dailyInputFlags, + calc_difs[["R"]], + ignore_attr = "names" + ) + + expect_true( + all( + intersect(which(calc_difs[["C"]]), which(calc_difs[["R"]])) %in% + which(ws_dailyInputFlags) + ) + ) + + + #--- Prepare simulation run with specified weather data + swin <- template_swin + + swYears_EndYear(swin) <- max(years) + swYears_StartYear(swin) <- min(years) + + if (ws == "minimalInputs") { + swin@weather@desc_rsds <- 0L + swin@weather@use_cloudCoverMonthly <- TRUE + swin@weather@use_windSpeedMonthly <- TRUE + swin@weather@use_humidityMonthly <- TRUE + + } else if (ws == "daymet") { + swin@weather@desc_rsds <- 2L # flux density over the daylight period + swin@weather@use_cloudCoverMonthly <- FALSE # use radiation instead + swin@weather@use_windSpeedMonthly <- TRUE + swin@weather@use_humidityMonthly <- FALSE # use vapor pressure instead + + } else if (ws == "gridmet") { + swin@weather@desc_rsds <- 1L # flux density over 24-hour period + swin@weather@use_cloudCoverMonthly <- FALSE # use radiation instead + swin@weather@use_windSpeedMonthly <- FALSE # has daily wind + swin@weather@use_humidityMonthly <- FALSE # has humidity + + } else if (ws == "maca") { + swin@weather@desc_rsds <- 1L # flux density over 24-hour period + swin@weather@use_cloudCoverMonthly <- FALSE # use radiation instead + swin@weather@use_windSpeedMonthly <- FALSE # has daily wind + swin@weather@use_humidityMonthly <- FALSE # has humidity + + } + + + #--- Run and check simulation with specified weather data + rd <- list() + + for (method in c("C", "R")) { + swin@weather@dailyInputFlags <- calc_difs[[method]] + + rd[[method]] <- rSOILWAT2::sw_exec( + inputData = swin, + weatherList = sww[[method]], + echo = FALSE, + quiet = TRUE + ) + + expect_true(rSOILWAT2::check_version(rd[[method]], level = "minor")) + expect_s4_class(rd[[method]], "swOutput") + expect_false(rSOILWAT2::has_soilTemp_failed()) + expect_true(all(rSOILWAT2::sw_out_flags() %in% slotNames(rd[[method]]))) + } + + + #--- Expect identical simulation output independent of reading method + vars <- grep( + pattern = "timestamp", + x = slotNames(rd[["C"]]), + value = TRUE, + invert = TRUE, + fixed = TRUE + ) + + for (var in vars) { + expect_identical(slot(rd[["C"]], var), slot(rd[["R"]], var)) + } + } }) diff --git a/tests/testthat/test_WeatherGenerator_functionality.R b/tests/testthat/test_WeatherGenerator_functionality.R index a251709e..c2c0000e 100644 --- a/tests/testthat/test_WeatherGenerator_functionality.R +++ b/tests/testthat/test_WeatherGenerator_functionality.R @@ -12,6 +12,9 @@ test_that("Test data availability", { #---TESTS test_that("Weather generator: estimate input parameters", { + + weatherGenerator_dataColumns <- c("DOY", "Tmax_C", "Tmin_C", "PPT_cm") + for (k in seq_along(tests)) { test_dat <- readRDS( file.path(dir_test_data, paste0(tests[k], "_weather.rds")) @@ -19,7 +22,7 @@ test_that("Weather generator: estimate input parameters", { test_df <- data.frame(dbW_weatherData_to_dataframe(test_dat, valNA = NULL)) - if (anyNA(test_df)) { + if (anyNA(test_df[, weatherGenerator_dataColumns(), drop = FALSE])) { # We have NAs that propagate # --> warnings: "Insufficient weather data to estimate values [...]" res <- suppressWarnings( @@ -62,6 +65,8 @@ test_that("Weather generator: estimate input parameters", { test_that("Weather generator: generate weather", { + digits <- 9L + for (k in seq_along(tests)) { test_dat <- readRDS( file.path(dir_test_data, paste0(tests[k], "_weather.rds")) @@ -76,7 +81,9 @@ test_that("Weather generator: generate weather", { dbW_generateWeather( test_dat, imputation_type = "mean", - imputation_span = 5 + imputation_span = 5, + digits = digits, + seed = 123 ) ) @@ -105,31 +112,58 @@ test_that("Weather generator: generate weather", { wgen_coeffs = wgen_coeffs ) - # Expectations - for (k in seq_along(wout)) { - x <- wout[[k]] - iyrs <- seq_along(x) - for (i in iyrs) { - # It is a valid object of class "swWeatherData" - expect_true(validObject(x[[i]])) + #--- Expectations + for (ke in seq_along(wout)) { - # Prepare weather data.frame - wdf <- slot(x[[i]], "data") - wdf <- set_missing_weather(wdf) + # Expect valid weather history object + expect_true(dbW_check_weatherData(wout[[ke]])) - # It meets weather data requirements - expect_silent( - check_weather( - weather = wdf, - required_variables = c("DOY", "Tmax_C", "Tmin_C", "PPT_cm") - ) - ) + wdf <- dbW_weatherData_to_dataframe(wout[[ke]]) + wdf <- wdf[, weatherGenerator_dataColumns(), drop = FALSE] - # There are no missing data - expect_false(anyNA(wdf)) - } + #--- Expect no missing data in implemented variables + expect_false(any(is_missing_weather(wdf))) } + + + #--- Expect that values remain unchanged + # wgen-variables: on days where all wgen-variables are non-missing + # Non-wgen variables: any non-missing value remain unchanged + + wout1_df <- rSOILWAT2::dbW_weatherData_to_dataframe(wout[[1L]]) + test_dat1_df <- rSOILWAT2::dbW_weatherData_to_dataframe(test_dat) + + ids_wgen <- which( + colnames(test_dat1_df) %in% rSOILWAT2::weatherGenerator_dataColumns() + ) + tmp <- apply( + !is_missing_weather(test_dat1_df[, ids_wgen, drop = FALSE]), + MARGIN = 1L, + FUN = all + ) + isnot_missing_wgen <- as.matrix(data.frame( + row = rep(which(tmp), times = length(ids_wgen)), + col = rep(ids_wgen, each = sum(tmp)) + )) + + ids_nowgen <- which( + !colnames(test_dat1_df) %in% rSOILWAT2::weatherGenerator_dataColumns() + ) + isnot_missing_nowgen <- which( + !is_missing_weather(test_dat1_df[, ids_nowgen, drop = FALSE]), + arr.ind = TRUE + ) + isnot_missing_nowgen[, "col"] <- ids_nowgen[isnot_missing_nowgen[, "col"]] + + isnot_missing <- rbind(isnot_missing_wgen, isnot_missing_nowgen) + + + expect_equal( + test_dat1_df[isnot_missing], + wout1_df[isnot_missing], + tolerance = 10 ^ (-digits) + ) } }) diff --git a/tests/testthat/test_dbW_functionality.R b/tests/testthat/test_dbW_functionality.R index 2d06ae8e..12e45215 100644 --- a/tests/testthat/test_dbW_functionality.R +++ b/tests/testthat/test_dbW_functionality.R @@ -56,8 +56,6 @@ site_data3 <- data.frame( stringsAsFactors = FALSE ) -weatherDF_dataColumns <- c("DOY", "Tmax_C", "Tmin_C", "PPT_cm") - # This function is needed for appveyor: for some reason 'dbW_createDatabase' @@ -845,7 +843,7 @@ test_that("Manipulate weather data: years", { datA_DF_result_con1 <- get_years_from_weatherDF( weatherDF = datA_DF, years = datA_yrs_ts, - weatherDF_dataColumns = weatherDF_dataColumns + weatherDF_dataColumns = "DOY" ) expect_equal(datA_DF_result_con1[["years"]], datA_yrs) expect_equal(datA_DF_result_con1[["year_ts"]], datA_yrs_ts) @@ -853,19 +851,19 @@ test_that("Manipulate weather data: years", { datA_DF_result_con2 <- get_years_from_weatherDF( weatherDF = datA_DF, years = datA_yrs, - weatherDF_dataColumns = weatherDF_dataColumns + weatherDF_dataColumns = "DOY" ) expect_equal(datA_DF_result_con2[["years"]], datA_yrs) expect_equal(datA_DF_result_con2[["year_ts"]], datA_yrs_ts) expect_error( - get_years_from_weatherDF(datA_DF, datA_yrs[2:20], weatherDF_dataColumns) + get_years_from_weatherDF(datA_DF, datA_yrs[2:20], "DOY") ) #con 3 datA_DF_result_con4 <- get_years_from_weatherDF( weatherDF = datA_DF, years = NULL, - weatherDF_dataColumns = weatherDF_dataColumns + weatherDF_dataColumns = "DOY" ) expect_equal(datA_DF_result_con4[["years"]], datA_yrs) expect_equal(datA_DF_result_con4[["year_ts"]], datA_yrs_ts) @@ -874,7 +872,7 @@ test_that("Manipulate weather data: years", { get_years_from_weatherDF( weatherDF = datA_DF_noyrs, years = NULL, - weatherDF_dataColumns = weatherDF_dataColumns + weatherDF_dataColumns = "DOY" ) ) #con 5 @@ -888,9 +886,20 @@ test_that("Manipulate weather data: years", { datB <- sw_weather[[k]] datB_yrs <- get_years_from_weatherData(datB) yrs_joint <- intersect(datA_yrs, datB_yrs) + + # exclude calculated variables from comparison + ids <- c( + 1:2, + 2L + which(slot(slot(sw_input, "weather"), "dailyInputFlags")) + ) + expect_equal( - datA[select_years(datA_yrs, min(yrs_joint), max(yrs_joint))], - datB[select_years(datB_yrs, min(yrs_joint), max(yrs_joint))], + dbW_weatherData_to_dataframe( + datA[select_years(datA_yrs, min(yrs_joint), max(yrs_joint))] + )[, ids, drop = FALSE], + dbW_weatherData_to_dataframe( + datB[select_years(datB_yrs, min(yrs_joint), max(yrs_joint))] + )[, ids, drop = FALSE], tolerance = 1e-3 ) } @@ -901,6 +910,10 @@ test_that("Manipulate weather data: years", { test_that("Convert calendar years", { wdata <- rSOILWAT2::weatherData + dailyInputFlags <- calc_dailyInputFlags(wdata) + ids_vars <- 2L + which(dailyInputFlags) + ids_cols <- c(1:2, ids_vars) + ## Transfer to different years (partially overlapping) wnew <- dbW_convert_to_GregorianYears( wdata, @@ -908,8 +921,8 @@ test_that("Convert calendar years", { new_endYear = 2020 ) expect_equal(unique(wnew[, "Year"]), 2000:2020) - expect_false(anyNA(wnew[wnew[, "Year"] %in% names(wdata), ])) - expect_true(anyNA(wnew)) + expect_false(anyNA(wnew[wnew[, "Year"] %in% names(wdata), ids_cols])) + expect_true(anyNA(wnew[, ids_cols])) ## Transfer to a subset of years (i.e., subset) wnew <- dbW_convert_to_GregorianYears( @@ -918,7 +931,7 @@ test_that("Convert calendar years", { new_endYear = 2005 ) expect_equal(unique(wnew[, "Year"]), 2000:2005) - expect_false(anyNA(wnew)) + expect_false(anyNA(wnew[, ids_cols])) ## Correct/convert from a non-leap to a Gregorian calendar wempty <- dbW_weatherData_to_dataframe(weatherHistory())[1:365, ] @@ -930,7 +943,7 @@ test_that("Convert calendar years", { ) expect_equal(unique(wnew[, "Year"]), 2016:2016) expect_equal(nrow(wnew), 366) # leap year - expect_true(anyNA(wnew)) + expect_true(anyNA(wnew[, ids_cols])) wnew <- dbW_convert_to_GregorianYears( @@ -941,5 +954,6 @@ test_that("Convert calendar years", { ) expect_equal(unique(wnew[, "Year"]), 2016:2016) expect_equal(nrow(wnew), 366) # leap year - expect_equal(sum(is.na(wnew)), 3) # 3 variables on leap day are missing + # variables on leap day are missing + expect_equal(sum(is.na(wnew[, ids_cols])), length(ids_vars)) }) diff --git a/tests/testthat/test_testInputs.R b/tests/testthat/test_testInputs.R index ec27c616..28f21539 100644 --- a/tests/testthat/test_testInputs.R +++ b/tests/testthat/test_testInputs.R @@ -17,25 +17,31 @@ test_that("Check example data", { for (it in tests) { sw_input <- readRDS(file.path(dir_test_data, paste0(it, "_input.rds"))) + dailyInputFlags <- slot(slot(sw_input, "weather"), "dailyInputFlags") sw_weather <- readRDS(file.path(dir_test_data, paste0(it, "_weather.rds"))) sw_weather_df <- dbW_weatherData_to_dataframe(sw_weather) + sw_wactive_df <- sw_weather_df[ + , + c(1:2, 2L + which(dailyInputFlags)), + drop = FALSE + ] yrs_sim <- seq(swYears_StartYear(sw_input), swYears_EndYear(sw_input)) yrs_wth <- get_years_from_weatherData(sw_weather) - #--- Check that weather is (not) missing ------ + #--- Check that weather is (not) missing (for 'active' inputs) ------ if (it != "Ex2") { # not missing: no NAs, no SW_MISSING, all years - expect_identical(sum(is.na(sw_weather_df)), 0L) - expect_identical(sum(sw_weather_df == swmiss), 0L) + expect_identical(sum(is.na(sw_wactive_df)), 0L) + expect_identical(sum(sw_wactive_df == swmiss), 0L) expect_true(all(yrs_sim %in% yrs_wth)) } else { # missing: NAs, SW_MISSING, or not all years expect_true( - sum(is.na(sw_weather_df)) > 0 || - sum(sw_weather_df == swmiss) > 0 || + sum(is.na(sw_wactive_df)) > 0 || + sum(sw_wactive_df == swmiss) > 0 || !all(yrs_sim %in% yrs_wth) ) } diff --git a/tests/testthat/test_version.R b/tests/testthat/test_version.R index 5024e210..bd5ebc9b 100644 --- a/tests/testthat/test_version.R +++ b/tests/testthat/test_version.R @@ -91,14 +91,24 @@ test_that("rSOILWAT2 object versions", { ) + #--- Check that numeric versions are passed through + v <- as.numeric_version(getNamespaceVersion("rSOILWAT2")) + expect_identical(get_version(v), as.character(v)) + v <- packageVersion("base") + expect_identical(get_version(v), as.character(v)) + + #--- Check for other object classes (ANY-method): return `NA_character_` - expect_equal(get_version(), NA_character_) - expect_equal(get_version(NA), NA_character_) - expect_equal(get_version(NULL), NA_character_) - expect_equal(get_version(1), NA_character_) - expect_equal(get_version(list()), NA_character_) - expect_equal(get_version(try(stop("error"), silent = TRUE)), NA_character_) - expect_equal(get_version(swSoils_Layers(sw_in)), NA_character_) + expect_identical(get_version(), NA_character_) + expect_identical(get_version(NA), NA_character_) + expect_identical(get_version(NULL), NA_character_) + expect_identical(get_version(1), NA_character_) + expect_identical(get_version(list()), NA_character_) + expect_identical( + get_version(try(stop("error"), silent = TRUE)), + NA_character_ + ) + expect_identical(get_version(swSoils_Layers(sw_in)), NA_character_) expect_false(check_version(NA)) }) diff --git a/vignettes/rSOILWAT2_demo.Rmd b/vignettes/rSOILWAT2_demo.Rmd index 802c4334..fbbc2c7d 100644 --- a/vignettes/rSOILWAT2_demo.Rmd +++ b/vignettes/rSOILWAT2_demo.Rmd @@ -239,6 +239,8 @@ You may organize weather data in a variety of ways: ### Access external data sets: for example, `DayMet` ```{r, weather_daymetr, results = "hide", message = FALSE, warning = FALSE} + has_daymet <- FALSE + if ( requireNamespace("daymetr") && requireNamespace("curl") && @@ -258,26 +260,95 @@ You may organize weather data in a variety of ways: if (!inherits(dm_Laramie, "try-error")) { # Convert data to a `rSOILWAT2`-formatted weather object - vars <- c("year", "yday", "tmax..deg.c.", "tmin..deg.c.", "prcp..mm.day.") + dif <- c(rep(TRUE, 3L), rep(FALSE, 11L)) # Tmax, Tmin, PPT + dif[13L] <- TRUE # ACTUAL_VP + dif[14L] <- TRUE # SHORT_WR, desc_rsds = 2 + + vars <- c( + "year", "yday", + "tmax..deg.c.", "tmin..deg.c.", "prcp..mm.day.", + "vp..Pa.", + "srad..W.m.2." + ) xdf <- dm_Laramie[["data"]][, vars] xdf[, "prcp..mm.day."] <- xdf[, "prcp..mm.day."] / 10 # convert mm -> cm - colnames(xdf) <- c("Year", "DOY", "Tmax_C", "Tmin_C", "PPT_cm") + xdf[, "vp..Pa."] <- xdf[, "vp..Pa."] / 1000 # convert Pa -> kPa + colnames(xdf) <- c( + "Year", "DOY", + "Tmax_C", "Tmin_C", "PPT_cm", "actVP_kPa", "shortWR" + ) + + xdf2 <- array( + dim = c(nrow(xdf), 2L + length(rSOILWAT2::weather_dataColumns())), + dimnames = list( + NULL, + c("Year", "DOY", rSOILWAT2::weather_dataColumns()) + ) + ) + + xdf2[, colnames(xdf)] <- as.matrix(xdf) - wdata_dm <- rSOILWAT2::dbW_dataframe_to_weatherData(weatherDF = xdf) # Convert `DayMet`'s `noleap` calendar to proleptic Gregorian calendar - xdf2 <- rSOILWAT2::dbW_convert_to_GregorianYears(weatherData = wdata_dm) + xdf3 <- rSOILWAT2::dbW_convert_to_GregorianYears( + weatherData = rSOILWAT2::dbW_dataframe_to_weatherData( + weatherDF = xdf2[, -1L, drop = FALSE], + years = unique(xdf2[, "Year"]), + weatherDF_dataColumns = colnames(xdf2)[-1L], + round = 4L + ) + ) + + # Impute values for added leap days + # Use weather generator for available variables, use LOCF otherwise + xdf4 <- xdf3 - wdata <- rSOILWAT2::dbW_generateWeather( - weatherData = rSOILWAT2::dbW_dataframe_to_weatherData(weatherDF = xdf2), - seed = 123 + vars_wgen <- rSOILWAT2::weatherGenerator_dataColumns() + needs_wgen <- which( + !is.finite(as.matrix(xdf4[, vars_wgen, drop = FALSE])), + arr.ind = TRUE ) + if (NROW(needs_wgen) > 0) { + tmp1 <- rSOILWAT2::dbW_generateWeather( + weatherData = xdf4, + seed = 123 + ) + tmp2 <- rSOILWAT2::dbW_weatherData_to_dataframe(tmp1) + + xdf4[, vars_wgen][needs_wgen] <- tmp2[, vars_wgen][needs_wgen] + } + + ids_dif <- 2L + which(dif) + needs_locf <- which( + !is.finite(as.matrix(xdf4[, ids_dif, drop = FALSE])), + arr.ind = TRUE + ) + if (NROW(needs_locf) > 0) { + tmp1 <- rSW2utils::impute_df( + xdf4[, ids_dif, drop = FALSE], + imputation_type = "locf" + ) + + xdf4[, ids_dif][needs_locf] <- tmp1[needs_locf] + } + + wdata <- rSOILWAT2::dbW_dataframe_to_weatherData(xdf4, round = 4L) # Check that weather data is well-formed stopifnot(rSOILWAT2::dbW_check_weatherData(wdata)) + + # Set use flags + sw_in@weather@desc_rsds <- 2L # flux density over the daylight period + sw_in@weather@use_cloudCoverMonthly <- FALSE # use radiation instead + sw_in@weather@use_windSpeedMonthly <- TRUE + sw_in@weather@use_humidityMonthly <- FALSE # use vapor pressure instead + sw_in@weather@dailyInputFlags <- dif + + has_daymet <- TRUE } + } - } else { + if (!has_daymet) { # We don't have live internet and # were not able to obtain weather data for requested years # --> instead, use data we have locally and adjust years @@ -285,6 +356,13 @@ You may organize weather data in a variety of ways: rSOILWAT2::swYears_StartYear(sw_in) <- 0 rSOILWAT2::swYears_EndYear(sw_in) <- max(years) rSOILWAT2::swYears_StartYear(sw_in) <- min(years) + + # Set use flags + sw_in@weather@desc_rsds <- 0L + sw_in@weather@use_cloudCoverMonthly <- TRUE + sw_in@weather@use_windSpeedMonthly <- TRUE + sw_in@weather@use_humidityMonthly <- TRUE + sw_in@weather@dailyInputFlags <- c(rep(TRUE, 3L), rep(FALSE, 11L)) } ```