diff --git a/DESCRIPTION b/DESCRIPTION index 8631c311..7ca2056d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: nasapower Type: Package Title: NASA POWER API Client -Version: 2.0.0 +Version: 3.0.0 Authors@R: c(person(given = "Adam H.", family = "Sparks", @@ -40,14 +40,12 @@ Depends: R (>= 3.5.0) License: MIT + file LICENSE Imports: - APSIM, crul, curl, lubridate, jsonlite, readr, - tibble, - utils + tibble RoxygenNote: 7.1.1 Encoding: UTF-8 Language: en-AU @@ -64,8 +62,7 @@ Suggests: rmarkdown, rnaturalearth, sf, - testthat, - vcr + testthat VignetteBuilder: knitr X-schema.org-applicationCategory: Tools X-schema.org-keywords: NASA, meteorological-data, weather, global, weather, diff --git a/NAMESPACE b/NAMESPACE index 3182e117..9779d503 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,6 @@ # Generated by roxygen2: do not edit by hand S3method(print,POWER.Info) +export(create_icasa) export(create_met) export(get_power) diff --git a/NEWS.md b/NEWS.md index 3fe57a28..89f53eee 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,10 +1,18 @@ -# nasapower 2.0.0 +# nasapower 3.0.0 -## Bug Fixes +## Major Changes to Functionality -* Correct any missing or redirecting URLs +* Due to the removal of the CRAN package _APSIM_ from CRAN, the removal of the `create_met()` function has been implemented sooner than expected to keep _nasapower_ on CRAN -* Replace deprecated `subclass` with `class` in `new_tibble()` +* Deprecates `create_met()` + +## Bug fixes + +* Properly deprecates `create_icasa()` + +# nasapower 2.0.0 + +## Bug Fixes * Correct any missing or redirecting URLs @@ -159,8 +167,7 @@ These tests should be skipped on CRAN but were not. - Corrects logical operators `&&` and `||` where they should be `&` or `|` -- Removes extra code in `create_icasa()` and `create_met()` that performed -a duplicated check of `latlon` values +- Removes extra code in `create_icasa()` and `create_met()` that performed a duplicated check of `latlon` values - Removes unnecessary checks for `latlon` in `get_power()` @@ -168,8 +175,7 @@ a duplicated check of `latlon` values ## Minor changes -- Provides corrections to documentation formatting as per CRAN volunteers' -requests +- Provides corrections to documentation formatting as per CRAN volunteers' requests - Provides edits and clarifications in DESCRIPTION's Description and Title about the package's uses and capabilities @@ -183,12 +189,11 @@ requests - Uses new 'POWER' 'API' to download new 1/2 x 1/2 degree data -- Adds function `get_power()` to get weather data and optionally metadata as -well +- Adds function `get_power()` to get weather data and optionally metadata as well - Adds function `create_met()` to create 'APSIM' met objects from 'POWER' data -- Adsd function `create_icasa()` to create a text file of weather data for use in 'DSSAT' crop modelling +- Adds function `create_icasa()` to create a text file of weather data for use in 'DSSAT' crop modelling - Internally, replaces _httr_ package with _crul_ diff --git a/R/deprecated_create_met.R b/R/deprecated_create_met.R deleted file mode 100644 index 605823c2..00000000 --- a/R/deprecated_create_met.R +++ /dev/null @@ -1,244 +0,0 @@ - -#' Deprecated function to create an APSIM met file from POWER data -#' -#' @note This function is deprecated and will be removed in a future release of -#' \CRANpkg{nasapower}. Please use \code{\link[apsimx]{get_power_apsim_met}} -#' from the \CRANpkg{apsimx} package if you require this functionality. -#' -#' @description Get \acronym{POWER} values for a single point or region and -#' create an \acronym{APSIM} \code{met} file suitable for use in -#' \acronym{APSIM} for crop modelling; saving it to local disk. -#' -#' @param lonlat A numeric vector of geographic coordinates for a cell or region -#' entered as x, y coordinates. See argument details for more. -#' @param dates A character vector of start and end dates in that order,\cr -#' \emph{e.g.}, \code{dates = c("1983-01-01", "2017-12-31")}. See argument -#' details for more. -#' @param dsn A file path where the resulting text file should be stored. -#' @param file_out A file name for the resulting text file, \emph{e.g.} -#' \dQuote{Kingsthorpe.met}. A \dQuote{.met} extension will be appended if -#' given or otherwise specified by user. -#' @param missing_csv A Boolean value indicating whether a csv file is to be -#' written to disk with a record of missing values. If `FALSE`, the default, -#' no file is created, only a message is emitted. If `TRUE` a csv file is -#' created with a record of all missing values in the .met file. -#' -#' @details This function is essentially a wrapper for \code{\link{get_power}} -#' \code{\link[APSIM]{prepareMet}} and \code{\link[APSIM]{writeMetFile}} that -#' simplifies the querying of the \acronym{POWER} \acronym{API} and writes the -#' \code{met} to local disk. -#' -#' The weather values from \acronym{POWER} for temperature are 2 metre max and -#' min temperatures, \dQuote{T2M_MAX} and \dQuote{T2M_MIN}; radiation, -#' \dQuote{ALLSKY_SFC_SW_DWN}; and rain, \dQuote{PRECTOT} from the -#' \acronym{POWER} AG community on a daily time-step. -#' -#' Further details for each of the arguments are provided in their -#' respective sections following below. -#' -#' @section Argument details for \code{lonlat}: -#' \describe{ -#' \item{For a single point}{To get a specific cell, 1/2 x 1/2 degree, supply -#' a length-two numeric vector giving the decimal degree longitude and -#' latitude in that order for data to download,\cr -#' \emph{e.g.}, \code{lonlat = c(151.81, -27.48)}.} -#' -#' \item{For regional coverage}{To get a region, supply a length-four numeric -#' vector as lower left (lon, lat) and upper right (lon, lat) coordinates, -#' \emph{e.g.}, \code{lonlat = c(xmin, ymin, xmax, ymax)} in that order for a -#' given region, \emph{e.g.}, a bounding box for the southwestern corner of -#' Australia: \code{lonlat = c(112.5, -55.5, 115.5, -50.5)}. \emph{Max -#' bounding box is 10 x 10 degrees} of 1/2 x 1/2 degree data, \emph{i.e.}, 100 -#' points maximum in total.} -#' } -#' -#' @section Argument details for \code{dates}: If \code{dates} is unspecified, -#' defaults to a start date of 1983-01-01 (the earliest available data) and an -#' end date of current date according to the system. -#' -#' If one date only is provided, it will be treated as both the start date and -#' the end date and only a single day's values will be returned. -#' -#' @return A text file in met format saved to local disk for use in -#' \acronym{APSIM} crop modelling. -#' -#' @examples -#' # Create a met file for Kingsthorpe, Qld -#' # from 1985-01-01 to 1985-06-30 and -#' # save it in the current R session -#' # tempdir() as `APSIM_example.met` -#' -#' \donttest{ -#' create_met(lonlat = c(151.81, -27.48), -#' dates = c("1985-01-01", "1985-12-31"), -#' dsn = tempdir(), -#' file_out = "APSIM_example.met" -#' ) -#' } -#' -#' @author Sparks, A. H. \email{adamhsparks@@gmail.com} -#' @export -create_met <- function(lonlat, - dates, - dsn, - file_out, - missing_csv = FALSE) { - .Deprecated( - new = "get_power_apsim_met", - package = "apsimx", - msg = - "\nThe 'create_met()' function has been deprecated and will be removed in - a future release of 'nasapower'. The contributed R package 'apsimx' - provides functionality, 'get_power_apsim_met()' that uses 'get_power()' - to fetch weather data from the POWER web API for the purposes of - creating an APSIM .met file.\n" - ) - - file_out <- .met_checks(.dsn = dsn, .file_out = file_out) - - power_data <- - .get_met_data( - .dates = dates, - .dsn = dsn, - .lonlat = lonlat, - .file_out = file_out, - .missing_csv = missing_csv - ) - - APSIM::writeMetFile(fileName = file.path(dsn, file_out), - met = power_data) -} - -#' Check User Inputs for Creating a Valid .met File -#' -#' Check user inputs for the `dsn` and `file_out` -#' -#' @param .dsn user supplied `dsn` value -#' @param .file_out user supplied `file_out` value -#' -#' @return A validated file_out name with a .met extension -#' -#' @noRd -.met_checks <- function(.dsn, .file_out) { - if (missing(.dsn) | missing(.file_out)) { - stop(call. = FALSE, - "You must provide a file location, `dsn` and file name, `file_out`.") - } - if (substr(.file_out, nchar(.file_out) - 3, nchar(.file_out)) != ".met") { - .file_out <- paste0(.file_out, ".met") - } - return(.file_out) -} - -#' Query POWER API and Return Data for APSIM .met File -#' -#' Given user-supplied dates and lon and lat values, query POWER API and return -#' a `data.frame` of requested data. -#' -#' @param .dates user supplied `dates` value -#' @param .lonlat user supplied `lonlat` value -#' -#' @return A `list` of POWER data suitable for creating a .met file, names for -#' the file and corresponding units -#' -#' @noRd -.get_met_data <- - function(.dates, - .lonlat, - .dsn, - .file_out, - .missing_csv) { - power_data <- as.data.frame( - get_power( - pars = c( - "T2M_MAX", - "T2M_MIN", - "ALLSKY_SFC_SW_DWN", - "PRECTOT", - "RH2M", - "WS2M" - ), - dates = .dates, - lonlat = .lonlat, - temporal_average = "DAILY", - community = "AG" - ) - ) - - if (isTRUE(.missing_csv)) { - .check_met_missing(.power_data = power_data, - #nocov start - .dsn = .dsn, - .file_out = .file_out) #nocov end - } - - power_data <- - power_data[c("T2M_MAX", - "T2M_MIN", - "ALLSKY_SFC_SW_DWN", - "PRECTOT", - "RH2M", - "WS2M", - "YEAR", - "DOY")] - - met_names <- c("maxt", - "mint", - "radn", - "rain", - "rh", - "wind", - "year", - "day") - - met_units <- - c("(oC)", - "(oC)", - "(MJ/m^2/day)", - "(mm)", - "(%)", - "(m/s)", - "()", - "()") - - invisible(utils::capture.output( - out <- APSIM::prepareMet( - power_data, - lat = .lonlat[2], - lon = .lonlat[1], - newNames = met_names, - units = met_units - ) - )) - return(out) - } - -#' Check for Missing Values in .met File -#' -#' Checks for missing values in .met file. If missing values are found, a -#' message is emitted as well as an auxilary .csv file being written to disk -#' alongside the .met file for the user to refer to -#' -#' @param .power_data data from a `get_power()` query -#' @param .file_out user-supplied file name for .met file output -#' -#' @return A .csv file if missing values are found -#' -#' @noRd -.check_met_missing <- function(.power_data, .dsn, .file_out) { - if (any(is.na(as.data.frame(.power_data)))) { - m <- - as.data.frame(which(is.na(as.data.frame(.power_data)), arr.ind = TRUE)) - col_names <- names(.power_data)[unique(m[, 2])][match(m[, 2], - c(unique(m[, 2])))] - m <- data.frame(col_names, m[, c(2, 1)]) - message( - "\nThere are missing values in your .MET file, an auxillary file `", - tools::file_path_sans_ext(.file_out), - "_missing.csv` has been created as well.\n", - paste0(utils::capture.output(m), collapse = "\n") - ) - readr::write_csv(x = m, - path = file.path(.dsn, paste0(.file_out, "_missing.csv"))) - } -} diff --git a/R/internal_functions.R b/R/internal_functions.R index fd132aa2..9259d957 100644 --- a/R/internal_functions.R +++ b/R/internal_functions.R @@ -560,7 +560,7 @@ } } -#' Prints Power.Info object. +#' Prints Power.Info object #' #' @param x POWER.Info object #' @param ... ignored diff --git a/R/nasapower-defunct.R b/R/nasapower-defunct.R new file mode 100644 index 00000000..2aca481a --- /dev/null +++ b/R/nasapower-defunct.R @@ -0,0 +1,30 @@ +#' @name nasapower-defunct +#' +#' @title Defunct functions in \CRANpkg{nasapower} +#' +#' These functions are gone, no longer available. +#' +#' \itemize{ +#' \item \code{\link{create_icasa}}: This function is defunct. +#' \item \code{\link{create_met}}: This function is defunct. +#' } +#' +NULL + +#' @details `create_met()` is now defunct and has been removed from +#' \CRANpkg{nasapower} +#' @param ... unused arguments +#' @rdname nasapower-defunct +#' @export +create_met <- function(...){ + .Defunct() +} + +#' @details `create_icasa()` is now defunct and has been removed from +#' \CRANpkg{nasapower} +#' @param ... unused arguments +#' @rdname nasapower-defunct +#' @export +create_icasa <- function(...){ + .Defunct() +} diff --git a/R/parameters_data.R b/R/parameters_data.R index eec030fb..4db8399a 100644 --- a/R/parameters_data.R +++ b/R/parameters_data.R @@ -12,16 +12,26 @@ #' \describe{ #' \item{ALLSKY_SFC_LW_DWN}{Downward Thermal Infrared (Longwave) Radiative Flux} #' \item{ALLSKY_SFC_SW_DWN}{All Sky Insolation Incident on a Horizontal Surface} -#' \item{ALLSKY_SFC_SW_DWN_00_GMT}{All Sky Insolation Incident On A Horizontal Surface at 00 GMT} -#' \item{ALLSKY_SFC_SW_DWN_03_GMT}{All Sky Insolation Incident On A Horizontal Surface at 03 GMT} -#' \item{ALLSKY_SFC_SW_DWN_06_GMT}{All Sky Insolation Incident On A Horizontal Surface at 06 GMT} -#' \item{ALLSKY_SFC_SW_DWN_09_GMT}{All Sky Insolation Incident On A Horizontal Surface at 09 GMT} -#' \item{ALLSKY_SFC_SW_DWN_12_GMT}{All Sky Insolation Incident On A Horizontal Surface at 12 GMT} -#' \item{ALLSKY_SFC_SW_DWN_15_GMT}{All Sky Insolation Incident On A Horizontal Surface at 15 GMT} -#' \item{ALLSKY_SFC_SW_DWN_18_GMT}{All Sky Insolation Incident On A Horizontal Surface at 18 GMT} -#' \item{ALLSKY_SFC_SW_DWN_21_GMT}{All Sky Insolation Incident On A Horizontal Surface at 21 GMT} -#' \item{ALLSKY_SFC_SW_DWN_MAX_DIFF}{Maximum Monthly Difference From Monthly Averaged All Sky Insolation } -#' \item{ALLSKY_SFC_SW_DWN_MIN_DIFF}{Minimum Monthly Difference From Monthly Averaged All Sky Insolation} +#' \item{ALLSKY_SFC_SW_DWN_00_GMT}{All Sky Insolation Incident On A Horizontal +#' Surface at 00 GMT} +#' \item{ALLSKY_SFC_SW_DWN_03_GMT}{All Sky Insolation Incident On A Horizontal +#' Surface at 03 GMT} +#' \item{ALLSKY_SFC_SW_DWN_06_GMT}{All Sky Insolation Incident On A Horizontal +#' Surface at 06 GMT} +#' \item{ALLSKY_SFC_SW_DWN_09_GMT}{All Sky Insolation Incident On A Horizontal +#' Surface at 09 GMT} +#' \item{ALLSKY_SFC_SW_DWN_12_GMT}{All Sky Insolation Incident On A Horizontal +#' Surface at 12 GMT} +#' \item{ALLSKY_SFC_SW_DWN_15_GMT}{All Sky Insolation Incident On A Horizontal +#' Surface at 15 GMT} +#' \item{ALLSKY_SFC_SW_DWN_18_GMT}{All Sky Insolation Incident On A Horizontal +#' Surface at 18 GMT} +#' \item{ALLSKY_SFC_SW_DWN_21_GMT}{All Sky Insolation Incident On A Horizontal +#' Surface at 21 GMT} +#' \item{ALLSKY_SFC_SW_DWN_MAX_DIFF}{Maximum Monthly Difference From Monthly +#' Averaged All Sky Insolation } +#' \item{ALLSKY_SFC_SW_DWN_MIN_DIFF}{Minimum Monthly Difference From Monthly +#' Averaged All Sky Insolation} #' \item{ALLSKY_TOA_SW_DWN}{Top-of-atmosphere Insolation} #' \item{CDD0}{Cooling Degree Days Above 0 C} #' \item{CDD10}{Cooling Degree Days Above 10 C} @@ -37,30 +47,47 @@ #' \item{CLD_AMT_21_GMT}{Cloud Amount at 21 GMT} #' \item{CLRSKY_DIFF}{Clear Sky Diffuse Radiation On A Horizontal Surface} #' \item{CLRSKY_NKT}{Normalized Clear Sky Insolation Clearness Index} -#' \item{CLRSKY_SFC_SW_DWN}{Clear Sky Insolation Incident on a Horizontal Surface} +#' \item{CLRSKY_SFC_SW_DWN}{Clear Sky Insolation Incident on a Horizontal +#' Surface} #' \item{DIFF}{Diffuse Radiation On A Horizontal Surface} #' \item{DIFF_MAX}{Maximum Diffuse Radiation On A Horizontal Surface} #' \item{DIFF_MIN}{Minimum Diffuse Radiation On A Horizontal Surface} #' \item{DNR}{Direct Normal Radiation} #' \item{DNR_MAX}{Maximum Direct Normal Radiation} -#' \item{DNR_MAX_DIFF}{Maximum Difference From Monthly Averaged Direct Normal Radiation} +#' \item{DNR_MAX_DIFF}{Maximum Difference From Monthly Averaged Direct Normal +#' Radiation} #' \item{DNR_MIN}{Minimum Direct Normal Radiation} -#' \item{DNR_MIN_DIFF}{Minimum Difference From Monthly Averaged Direct Normal Radiation} -#' \item{EQVLNT_NO_SUN_BLACKDAYS_1}{Equivalent Number Of NO-SUN Or BLACK Days Over A Consecutive 1-day Period} -#' \item{EQVLNT_NO_SUN_BLACKDAYS_14}{Equivalent Number Of NO-SUN Or BLACK Days Over A Consecutive 14-day Period} -#' \item{EQVLNT_NO_SUN_BLACKDAYS_21}{Equivalent Number Of NO-SUN Or BLACK Days Over A Consecutive 21-day Period} -#' \item{EQVLNT_NO_SUN_BLACKDAYS_3}{Equivalent Number Of NO-SUN Or BLACK Days Over A Consecutive 3-day Period} -#' \item{EQVLNT_NO_SUN_BLACKDAYS_7}{Equivalent Number Of NO-SUN Or BLACK Days Over A Consecutive 7-day Period} -#' \item{EQVLNT_NO_SUN_BLACKDAYS_MONTH}{Equivalent Number Of NO-SUN Or BLACK Days Over A Consecutive Month Period} +#' \item{DNR_MIN_DIFF}{Minimum Difference From Monthly Averaged Direct Norma +#' l Radiation} +#' \item{EQVLNT_NO_SUN_BLACKDAYS_1}{Equivalent Number Of NO-SUN Or BLACK Days +#' Over A Consecutive 1-day Period} +#' \item{EQVLNT_NO_SUN_BLACKDAYS_14}{Equivalent Number Of NO-SUN Or BLACK Days +#' Over A Consecutive 14-day Period} +#' \item{EQVLNT_NO_SUN_BLACKDAYS_21}{Equivalent Number Of NO-SUN Or BLACK Days +#' Over A Consecutive 21-day Period} +#' \item{EQVLNT_NO_SUN_BLACKDAYS_3}{Equivalent Number Of NO-SUN Or BLACK Days +#' Over A Consecutive 3-day Period} +#' \item{EQVLNT_NO_SUN_BLACKDAYS_7}{Equivalent Number Of NO-SUN Or BLACK Days +#' Over A Consecutive 7-day Period} +#' \item{EQVLNT_NO_SUN_BLACKDAYS_MONTH}{Equivalent Number Of NO-SUN Or BLACK +#' Days Over A Consecutive Month Period} #' \item{FROST_DAYS}{Frost Days} -#' \item{FRQ_BRKNCLD_10_70_00_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At 00 GMT} -#' \item{FRQ_BRKNCLD_10_70_03_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At 03 GMT} -#' \item{FRQ_BRKNCLD_10_70_06_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At 06 GMT} -#' \item{FRQ_BRKNCLD_10_70_09_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At 09 GMT} -#' \item{FRQ_BRKNCLD_10_70_12_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At 12 GMT} -#' \item{FRQ_BRKNCLD_10_70_15_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At 15 GMT} -#' \item{FRQ_BRKNCLD_10_70_18_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At 18 GMT} -#' \item{FRQ_BRKNCLD_10_70_21_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At 21 GMT} +#' \item{FRQ_BRKNCLD_10_70_00_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At +#' 00 GMT} +#' \item{FRQ_BRKNCLD_10_70_03_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At +#' 03 GMT} +#' \item{FRQ_BRKNCLD_10_70_06_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At +#' 06 GMT} +#' \item{FRQ_BRKNCLD_10_70_09_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At +#' 09 GMT} +#' \item{FRQ_BRKNCLD_10_70_12_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At +#' 12 GMT} +#' \item{FRQ_BRKNCLD_10_70_15_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At +#' 15 GMT} +#' \item{FRQ_BRKNCLD_10_70_18_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At +#' 18 GMT} +#' \item{FRQ_BRKNCLD_10_70_21_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At +#' 21 GMT} #' \item{FRQ_CLRSKY_0_10_00_GMT}{Frequency Of Clear Skies < 10 \% At 00 GMT} #' \item{FRQ_CLRSKY_0_10_03_GMT}{Frequency Of Clear Skies < 10 \% At 03 GMT} #' \item{FRQ_CLRSKY_0_10_06_GMT}{Frequency Of Clear Skies < 10 \% At 06 GMT} @@ -69,23 +96,37 @@ #' \item{FRQ_CLRSKY_0_10_15_GMT}{Frequency Of Clear Skies < 10 \% At 15 GMT} #' \item{FRQ_CLRSKY_0_10_18_GMT}{Frequency Of Clear Skies < 10 \% At 18 GMT} #' \item{FRQ_CLRSKY_0_10_21_GMT}{Frequency Of Clear Skies < 10 \% At 21 GMT} -#' \item{FRQ_NROVRCST_70_00_GMT}{Frequency Of Near-overcast Skies >= 70 \% At 00 GMT} -#' \item{FRQ_NROVRCST_70_03_GMT}{Frequency Of Near-overcast Skies >= 70 \% At 03 GMT} -#' \item{FRQ_NROVRCST_70_06_GMT}{Frequency Of Near-overcast Skies >= 70 \% At 06 GMT} -#' \item{FRQ_NROVRCST_70_09_GMT}{Frequency Of Near-overcast Skies >= 70 \% At 09 GMT} -#' \item{FRQ_NROVRCST_70_12_GMT}{Frequency Of Near-overcast Skies >= 70 \% At 12 GMT} -#' \item{FRQ_NROVRCST_70_15_GMT}{Frequency Of Near-overcast Skies >= 70 \% At 15 GMT} -#' \item{FRQ_NROVRCST_70_18_GMT}{Frequency Of Near-overcast Skies >= 70 \% At 18 GMT} -#' \item{FRQ_NROVRCST_70_21_GMT}{Frequency Of Near-overcast Skies >= 70 \% At 21 GMT} +#' \item{FRQ_NROVRCST_70_00_GMT}{Frequency Of Near-overcast Skies >= 70 \% At +#' 00 GMT} +#' \item{FRQ_NROVRCST_70_03_GMT}{Frequency Of Near-overcast Skies >= 70 \% At +#' 03 GMT} +#' \item{FRQ_NROVRCST_70_06_GMT}{Frequency Of Near-overcast Skies >= 70 \% At +#' 06 GMT} +#' \item{FRQ_NROVRCST_70_09_GMT}{Frequency Of Near-overcast Skies >= 70 \% At +#' 09 GMT} +#' \item{FRQ_NROVRCST_70_12_GMT}{Frequency Of Near-overcast Skies >= 70 \% At +#' 12 GMT} +#' \item{FRQ_NROVRCST_70_15_GMT}{Frequency Of Near-overcast Skies >= 70 \% At +#' 15 GMT} +#' \item{FRQ_NROVRCST_70_18_GMT}{Frequency Of Near-overcast Skies >= 70 \% At +#' 18 GMT} +#' \item{FRQ_NROVRCST_70_21_GMT}{Frequency Of Near-overcast Skies >= 70 \% At +#' 21 GMT} #' \item{HDD0}{Heating Degree Days Below 0 C} #' \item{HDD10}{Heating Degree Days Below 10 C} #' \item{HDD18_3}{Heating Degree Days Below 18.3 C} -#' \item{INSOL_MIN_CONSEC_1}{Minimum Available Insolation Over A Consecutive 1-day Period} -#' \item{INSOL_MIN_CONSEC_14}{Minimum Available Insolation Over A Consecutive 14-day Period} -#' \item{INSOL_MIN_CONSEC_21}{Minimum Available Insolation Over A Consecutive 21-day Period} -#' \item{INSOL_MIN_CONSEC_3}{Minimum Available Insolation Over A Consecutive 3-day Period} -#' \item{INSOL_MIN_CONSEC_7}{Minimum Available Insolation Over A Consecutive 7-day Period} -#' \item{INSOL_MIN_CONSEC_MONTH}{Minimum Available Insolation Over A Consecutive Month Period} +#' \item{INSOL_MIN_CONSEC_1}{Minimum Available Insolation Over A Consecutive +#' 1-day Period} +#' \item{INSOL_MIN_CONSEC_14}{Minimum Available Insolation Over A Consecutive +#' 14-day Period} +#' \item{INSOL_MIN_CONSEC_21}{Minimum Available Insolation Over A Consecutive +#' 21-day Period} +#' \item{INSOL_MIN_CONSEC_3}{Minimum Available Insolation Over A Consecutive +#' 3-day Period} +#' \item{INSOL_MIN_CONSEC_7}{Minimum Available Insolation Over A Consecutive +#' 7-day Period} +#' \item{INSOL_MIN_CONSEC_MONTH}{Minimum Available Insolation Over A Consecutive +#' Month Period} #' \item{KT}{Insolation Clearness Index} #' \item{KT_CLEAR}{Clear Sky Insolation Clearness Index} #' \item{MIDDAY_INSOL}{Midday Insolation Incident On A Horizontal Surface} @@ -97,45 +138,69 @@ #' \item{PSC}{Corrected Atmospheric Pressure (Adjusted For Site Elevation)} #' \item{QV2M}{Specific Humidity at 2 Meters} #' \item{RH2M}{Relative Humidity at 2 Meters} -#' \item{SG_DAY_COZ_ZEN_AVG}{Daylight Average Of Hourly Cosine Solar Zenith Angles} +#' \item{SG_DAY_COZ_ZEN_AVG}{Daylight Average Of Hourly Cosine Solar Zenith +#' Angles} #' \item{SG_DAY_HOUR_AVG}{Daylight Hours} #' \item{SG_DEC_AVG}{Declination} #' \item{SG_HR_AZM_ANG_AVG}{Hourly Solar Azimuth Angles} #' \item{SG_HR_HRZ_ANG_AVG}{Hourly Solar Angles Relative To The Horizon} #' \item{SG_HR_SET_ANG}{Sunset Hour Angle} #' \item{SG_MAX_HRZ_ANG}{Maximum Solar Angle Relative To The Horizon} -#' \item{SG_MID_COZ_ZEN_ANG}{Cosine Solar Zenith Angle At Mid-Time Between Sunrise And Solar Noon} +#' \item{SG_MID_COZ_ZEN_ANG}{Cosine Solar Zenith Angle At Mid-Time Between +#' Sunrise And Solar Noon} #' \item{SG_NOON}{Solar Noon} -#' \item{SI_EF_TILTED_SURFACE_HORIZONTAL}{Solar Irradiance for Equator Facing Horizontal Surface} -#' \item{SI_EF_TILTED_SURFACE_LAT_MINUS15}{Solar Irradiance for Equator Facing Latitude Minus 15 Tilt} -#' \item{SI_EF_TILTED_SURFACE_LATITUDE}{Solar Irradiance for Equator Facing Latitude Tilt} -#' \item{SI_EF_TILTED_SURFACE_LAT_PLUS15}{Solar Irradiance for Equator Facing Latitude Plus 15 Tilt} -#' \item{SI_EF_TILTED_SURFACE_VERTICAL}{Solar Irradiance for Equator Facing Vertical Surface} +#' \item{SI_EF_TILTED_SURFACE_HORIZONTAL}{Solar Irradiance for Equator Facing +#' Horizontal Surface} +#' \item{SI_EF_TILTED_SURFACE_LAT_MINUS15}{Solar Irradiance for Equator Facing +#' Latitude Minus 15 Tilt} +#' \item{SI_EF_TILTED_SURFACE_LATITUDE}{Solar Irradiance for Equator Facing +#' Latitude Tilt} +#' \item{SI_EF_TILTED_SURFACE_LAT_PLUS15}{Solar Irradiance for Equator Facing +#' Latitude Plus 15 Tilt} +#' \item{SI_EF_TILTED_SURFACE_VERTICAL}{Solar Irradiance for Equator Facing +#' Vertical Surface} #' \item{SI_EF_OPTIMAL}{Solar Irradiance Optimal} #' \item{SI_EF_OPTIMAL_ANG}{Solar Irradiance Optimal Angle} #' \item{SI_EF_OPTIMAL_ANG_ORT}{Solar Irradiance Tilted Surface Orientation} #' \item{SI_EF_TRACKER}{Solar Irradiance Irradiance Tracking the Sun} -#' \item{SI_EF_TILTED_SURFACE}{Solar Irradiance for Equator Facing Tilted Surfaces (Set of Surfaces)} -#' \item{SI_EF_MIN_TILTED_SURFACE_HORIZONTAL}{Minimum Solar Irradiance for Equator Facing Horizontal Surface} -#' \item{SI_EF_MIN_TILTED_SURFACE_LAT_MINUS15}{Minimum Solar Irradiance for Equator Facing Latitude Minus 15 Tilt} -#' \item{SI_EF_MIN_TILTED_SURFACE_LATITUDE}{Minimum Solar Irradiance for Equator Facing Latitude Tilt} -#' \item{SI_EF_MIN_TILTED_SURFACE_LAT_PLUS15}{Minimum Solar Irradiance for Equator Facing Latitude Plus 15 Tilt} -#' \item{SI_EF_MIN_TILTED_SURFACE_VERTICAL}{Minimum Solar Irradiance for Equator Facing Vertical Surface} +#' \item{SI_EF_TILTED_SURFACE}{Solar Irradiance for Equator Facing Tilted +#' Surfaces (Set of Surfaces)} +#' \item{SI_EF_MIN_TILTED_SURFACE_HORIZONTAL}{Minimum Solar Irradiance for +#' Equator Facing Horizontal Surface} +#' \item{SI_EF_MIN_TILTED_SURFACE_LAT_MINUS15}{Minimum Solar Irradiance for +#' Equator Facing Latitude Minus 15 Tilt} +#' \item{SI_EF_MIN_TILTED_SURFACE_LATITUDE}{Minimum Solar Irradiance for Equator +#' Facing Latitude Tilt} +#' \item{SI_EF_MIN_TILTED_SURFACE_LAT_PLUS15}{Minimum Solar Irradiance for +#' Equator Facing Latitude Plus 15 Tilt} +#' \item{SI_EF_MIN_TILTED_SURFACE_VERTICAL}{Minimum Solar Irradiance for Equator +#' Facing Vertical Surface} #' \item{SI_EF_MIN_OPTIMAL}{Minimum Solar Irradiance Optimal} #' \item{SI_EF_MIN_OPTIMAL_ANG}{Minimum Solar Irradiance Optimal Angle} -#' \item{SI_EF_MIN_OPTIMAL_ANG_ORT}{Minimum Solar Irradiance Tilted Surface Orientation} -#' \item{SI_EF_MIN_TRACKER}{Minimum Solar Irradiance Irradiance Tracking the Sun} -#' \item{SI_EF_MIN_TILTED_SURFACE}{Minimum Solar Irradiance for Equator Facing Tilted Surfaces (Set of Surfaces)} -#' \item{SI_EF_MAX_TILTED_SURFACE_HORIZONTAL}{Maximum Solar Irradiance for Equator Facing Horizontal Surface} -#' \item{SI_EF_MAX_TILTED_SURFACE_LAT_MINUS15}{Maximum Solar Irradiance for Equator Facing Latitude Minus 15 Tilt} -#' \item{SI_EF_MAX_TILTED_SURFACE_LATITUDE}{Maximum Solar Irradiance for Equator Facing Latitude Tilt} -#' \item{SI_EF_MAX_TILTED_SURFACE_LAT_PLUS15}{Maximum Solar Irradiance for Equator Facing Latitude Plus 15 Tilt} -#' \item{SI_EF_MAX_TILTED_SURFACE_VERTICAL}{Maximum Solar Irradiance for Equator Facing Vertical Surface} +#' \item{SI_EF_MIN_OPTIMAL_ANG_ORT}{Minimum Solar Irradiance Tilted Surface +#' Orientation} +#' \item{SI_EF_MIN_TRACKER}{Minimum Solar Irradiance Irradiance Tracking the +#' Sun} +#' \item{SI_EF_MIN_TILTED_SURFACE}{Minimum Solar Irradiance for Equator Facing +#' Tilted Surfaces (Set of Surfaces)} +#' \item{SI_EF_MAX_TILTED_SURFACE_HORIZONTAL}{Maximum Solar Irradiance for +#' Equator Facing Horizontal Surface} +#' \item{SI_EF_MAX_TILTED_SURFACE_LAT_MINUS15}{Maximum Solar Irradiance for +#' Equator Facing Latitude Minus 15 Tilt} +#' \item{SI_EF_MAX_TILTED_SURFACE_LATITUDE}{Maximum Solar Irradiance for +#' Equator Facing Latitude Tilt} +#' \item{SI_EF_MAX_TILTED_SURFACE_LAT_PLUS15}{Maximum Solar Irradiance for +#' Equator Facing Latitude Plus 15 Tilt} +#' \item{SI_EF_MAX_TILTED_SURFACE_VERTICAL}{Maximum Solar Irradiance for Equator +#' Facing Vertical Surface} #' \item{SI_EF_MAX_OPTIMAL}{Maximum Solar Irradiance Optimal} #' \item{SI_EF_MAX_OPTIMAL_ANG}{Maximum Solar Irradiance Optimal Angle} -#' \item{SI_EF_MAX_OPTIMAL_ANG_ORT}{Maximum Solar Irradiance Tilted Surface Orientation} -#' \item{SI_EF_MAX_TRACKER}{Maximum Solar Irradiance Irradiance Tracking the Sun} -#' \item{SI_EF_MAX_TILTED_SURFACE}{Maximum Solar Irradiance for Equator Facing Tilted Surfaces (Set of Surfaces)} +#' \item{SI_EF_MAX_OPTIMAL_ANG_ORT}{Maximum Solar Irradiance Tilted Surface +#' Orientation} +#' \item{SI_EF_MAX_TRACKER}{Maximum Solar Irradiance Irradiance Tracking the +#' Sun} +#' \item{SI_EF_MAX_TILTED_SURFACE}{Maximum Solar Irradiance for Equator Facing +#' Tilted Surfaces (Set of Surfaces)} #' \item{SR}{Surface Roughness} #' \item{SRF_ALB}{Surface Albedo} #' \item{T10M}{Temperature at 10 Meters} diff --git a/codemeta.json b/codemeta.json index 28777787..3ee50df5 100644 --- a/codemeta.json +++ b/codemeta.json @@ -10,7 +10,7 @@ "codeRepository": "https://github.com/ropensci/nasapower", "issueTracker": "https://github.com/ropensci/nasapower/issues", "license": "https://spdx.org/licenses/MIT", - "version": "2.0.0", + "version": "3.0.0", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", @@ -152,18 +152,6 @@ "url": "https://cran.r-project.org" }, "sameAs": "https://CRAN.R-project.org/package=testthat" - }, - { - "@type": "SoftwareApplication", - "identifier": "vcr", - "name": "vcr", - "provider": { - "@id": "https://cran.r-project.org", - "@type": "Organization", - "name": "Comprehensive R Archive Network (CRAN)", - "url": "https://cran.r-project.org" - }, - "sameAs": "https://CRAN.R-project.org/package=vcr" } ], "softwareRequirements": [ @@ -173,18 +161,6 @@ "name": "R", "version": ">= 3.5.0" }, - { - "@type": "SoftwareApplication", - "identifier": "APSIM", - "name": "APSIM", - "provider": { - "@id": "https://cran.r-project.org", - "@type": "Organization", - "name": "Comprehensive R Archive Network (CRAN)", - "url": "https://cran.r-project.org" - }, - "sameAs": "https://CRAN.R-project.org/package=APSIM" - }, { "@type": "SoftwareApplication", "identifier": "crul", @@ -256,11 +232,6 @@ "url": "https://cran.r-project.org" }, "sameAs": "https://CRAN.R-project.org/package=tibble" - }, - { - "@type": "SoftwareApplication", - "identifier": "utils", - "name": "utils" } ], "applicationCategory": "Tools", @@ -316,5 +287,5 @@ } ], "relatedLink": ["https://docs.ropensci.org/nasapower/", "https://CRAN.R-project.org/package=nasapower"], - "fileSize": "128822.472KB" + "fileSize": "53243.388KB" } diff --git a/cran-comments.md b/cran-comments.md index 3ff77e25..dab0bb4f 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -2,46 +2,25 @@ ## Test environments * local macOS, R 4.0.2 -* win-builder, R Under development (unstable) (2020-09-17 r79226) +* win-builder, R Under development (unstable) (2020-10-09 r79316) * win-builder, R 4.0.2 ## R CMD check results 0 errors | 0 warnings | 1 note -This is a resubmission of a major version release +This is a new major release -## CRAN Requested Corrections +## Major changes to functionality -* Fix the NOTE, -> Found the following (possibly) invalid URLs: - URL: https://github.com/ropensci/onboarding/issues/155 (moved to https://github.com/ropensci/software-review/issues/155) - From: NEWS.md - Status: 200 -The moved URL has been replaced with the updated version. +* Due to the removal of the CRAN package _APSIM_ from CRAN, the removal of the `create_met()` function has been implemented sooner than expected to keep _nasapower_ on CRAN -## Bug Fixes +* Deprecates `create_icasa()` -* Correct any missing or redirecting URLs +## Bug fixes -* Replace deprecated `subclass` with `class` in `new_tibble()` +* Properly deprecates `create_icasa()` -## Major Changes to Functionality - -* Following a UNIX-like philosophy, this release removes functionality to write APSIM .met and DSSAT ICASA files to disk. -_nasapower_ now will only fetch the appropriate data and return a `tibble()` object in-session, please use [apsimx](https://cran.r-project.org/package=apsimx) or the POWER web API data access viewer, , for fetching and/or writing .met or .icasa files, respectively. -Note that `create_icasa()` ideally should have been deprecated, but the server was not responding properly when queried for some time before the current release of _nasapower_ so the function has been removed. - -* Add ability to `get_power()` to accept a user-provided `site_elevation` parameter that is passed to the API. -When this is used it will return a corrected atmospheric pressure value adjusted to the elevation provided. - -## Minor and Internal Changes - -* Use newest values from POWER team to validate user inputs for API requests, see for more. - -* Replace _raster_ with _terra_ for examples of converting to spatial data in vignettes - -* Use _vcr_ for enhanced testing - -* Refactor the internal handling of temporary files to allow for more efficient use of the _future_ package +## Reverse dependencies +No ERRORs or WARNINGs found diff --git a/man/create_met.Rd b/man/create_met.Rd deleted file mode 100644 index 7c648762..00000000 --- a/man/create_met.Rd +++ /dev/null @@ -1,100 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/deprecated_create_met.R -\name{create_met} -\alias{create_met} -\title{Deprecated function to create an APSIM met file from POWER data} -\usage{ -create_met(lonlat, dates, dsn, file_out, missing_csv = FALSE) -} -\arguments{ -\item{lonlat}{A numeric vector of geographic coordinates for a cell or region -entered as x, y coordinates. See argument details for more.} - -\item{dates}{A character vector of start and end dates in that order,\cr -\emph{e.g.}, \code{dates = c("1983-01-01", "2017-12-31")}. See argument -details for more.} - -\item{dsn}{A file path where the resulting text file should be stored.} - -\item{file_out}{A file name for the resulting text file, \emph{e.g.} -\dQuote{Kingsthorpe.met}. A \dQuote{.met} extension will be appended if -given or otherwise specified by user.} - -\item{missing_csv}{A Boolean value indicating whether a csv file is to be -written to disk with a record of missing values. If `FALSE`, the default, -no file is created, only a message is emitted. If `TRUE` a csv file is -created with a record of all missing values in the .met file.} -} -\value{ -A text file in met format saved to local disk for use in - \acronym{APSIM} crop modelling. -} -\description{ -Get \acronym{POWER} values for a single point or region and - create an \acronym{APSIM} \code{met} file suitable for use in - \acronym{APSIM} for crop modelling; saving it to local disk. -} -\details{ -This function is essentially a wrapper for \code{\link{get_power}} - \code{\link[APSIM]{prepareMet}} and \code{\link[APSIM]{writeMetFile}} that - simplifies the querying of the \acronym{POWER} \acronym{API} and writes the - \code{met} to local disk. - - The weather values from \acronym{POWER} for temperature are 2 metre max and - min temperatures, \dQuote{T2M_MAX} and \dQuote{T2M_MIN}; radiation, - \dQuote{ALLSKY_SFC_SW_DWN}; and rain, \dQuote{PRECTOT} from the - \acronym{POWER} AG community on a daily time-step. - - Further details for each of the arguments are provided in their - respective sections following below. -} -\note{ -This function is deprecated and will be removed in a future release of -\CRANpkg{nasapower}. Please use \code{\link[apsimx]{get_power_apsim_met}} -from the \CRANpkg{apsimx} package if you require this functionality. -} -\section{Argument details for \code{lonlat}}{ - -\describe{ - \item{For a single point}{To get a specific cell, 1/2 x 1/2 degree, supply - a length-two numeric vector giving the decimal degree longitude and - latitude in that order for data to download,\cr - \emph{e.g.}, \code{lonlat = c(151.81, -27.48)}.} - - \item{For regional coverage}{To get a region, supply a length-four numeric - vector as lower left (lon, lat) and upper right (lon, lat) coordinates, - \emph{e.g.}, \code{lonlat = c(xmin, ymin, xmax, ymax)} in that order for a - given region, \emph{e.g.}, a bounding box for the southwestern corner of - Australia: \code{lonlat = c(112.5, -55.5, 115.5, -50.5)}. \emph{Max - bounding box is 10 x 10 degrees} of 1/2 x 1/2 degree data, \emph{i.e.}, 100 - points maximum in total.} -} -} - -\section{Argument details for \code{dates}}{ - If \code{dates} is unspecified, - defaults to a start date of 1983-01-01 (the earliest available data) and an - end date of current date according to the system. - - If one date only is provided, it will be treated as both the start date and - the end date and only a single day's values will be returned. -} - -\examples{ -# Create a met file for Kingsthorpe, Qld -# from 1985-01-01 to 1985-06-30 and -# save it in the current R session -# tempdir() as `APSIM_example.met` - -\donttest{ -create_met(lonlat = c(151.81, -27.48), - dates = c("1985-01-01", "1985-12-31"), - dsn = tempdir(), - file_out = "APSIM_example.met" - ) -} - -} -\author{ -Sparks, A. H. \email{adamhsparks@gmail.com} -} diff --git a/man/nasapower-defunct.Rd b/man/nasapower-defunct.Rd new file mode 100644 index 00000000..ea389ebe --- /dev/null +++ b/man/nasapower-defunct.Rd @@ -0,0 +1,39 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/nasapower-defunct.R +\name{nasapower-defunct} +\alias{nasapower-defunct} +\alias{create_met} +\alias{create_icasa} +\title{Defunct functions in \CRANpkg{nasapower} + +These functions are gone, no longer available. + +\itemize{ + \item \code{\link{create_icasa}}: This function is defunct. + \item \code{\link{create_met}}: This function is defunct. +}} +\usage{ +create_met(...) + +create_icasa(...) +} +\arguments{ +\item{...}{unused arguments} +} +\description{ +Defunct functions in \CRANpkg{nasapower} + +These functions are gone, no longer available. + +\itemize{ + \item \code{\link{create_icasa}}: This function is defunct. + \item \code{\link{create_met}}: This function is defunct. +} +} +\details{ +`create_met()` is now defunct and has been removed from + \CRANpkg{nasapower} + +`create_icasa()` is now defunct and has been removed from + \CRANpkg{nasapower} +} diff --git a/man/parameters.Rd b/man/parameters.Rd index 96ced51b..33ff2704 100644 --- a/man/parameters.Rd +++ b/man/parameters.Rd @@ -11,16 +11,26 @@ A list with 161 weather and climate parameters contained within the \describe{ \item{ALLSKY_SFC_LW_DWN}{Downward Thermal Infrared (Longwave) Radiative Flux} \item{ALLSKY_SFC_SW_DWN}{All Sky Insolation Incident on a Horizontal Surface} -\item{ALLSKY_SFC_SW_DWN_00_GMT}{All Sky Insolation Incident On A Horizontal Surface at 00 GMT} -\item{ALLSKY_SFC_SW_DWN_03_GMT}{All Sky Insolation Incident On A Horizontal Surface at 03 GMT} -\item{ALLSKY_SFC_SW_DWN_06_GMT}{All Sky Insolation Incident On A Horizontal Surface at 06 GMT} -\item{ALLSKY_SFC_SW_DWN_09_GMT}{All Sky Insolation Incident On A Horizontal Surface at 09 GMT} -\item{ALLSKY_SFC_SW_DWN_12_GMT}{All Sky Insolation Incident On A Horizontal Surface at 12 GMT} -\item{ALLSKY_SFC_SW_DWN_15_GMT}{All Sky Insolation Incident On A Horizontal Surface at 15 GMT} -\item{ALLSKY_SFC_SW_DWN_18_GMT}{All Sky Insolation Incident On A Horizontal Surface at 18 GMT} -\item{ALLSKY_SFC_SW_DWN_21_GMT}{All Sky Insolation Incident On A Horizontal Surface at 21 GMT} -\item{ALLSKY_SFC_SW_DWN_MAX_DIFF}{Maximum Monthly Difference From Monthly Averaged All Sky Insolation } -\item{ALLSKY_SFC_SW_DWN_MIN_DIFF}{Minimum Monthly Difference From Monthly Averaged All Sky Insolation} +\item{ALLSKY_SFC_SW_DWN_00_GMT}{All Sky Insolation Incident On A Horizontal + Surface at 00 GMT} +\item{ALLSKY_SFC_SW_DWN_03_GMT}{All Sky Insolation Incident On A Horizontal + Surface at 03 GMT} +\item{ALLSKY_SFC_SW_DWN_06_GMT}{All Sky Insolation Incident On A Horizontal + Surface at 06 GMT} +\item{ALLSKY_SFC_SW_DWN_09_GMT}{All Sky Insolation Incident On A Horizontal + Surface at 09 GMT} +\item{ALLSKY_SFC_SW_DWN_12_GMT}{All Sky Insolation Incident On A Horizontal + Surface at 12 GMT} +\item{ALLSKY_SFC_SW_DWN_15_GMT}{All Sky Insolation Incident On A Horizontal + Surface at 15 GMT} +\item{ALLSKY_SFC_SW_DWN_18_GMT}{All Sky Insolation Incident On A Horizontal + Surface at 18 GMT} +\item{ALLSKY_SFC_SW_DWN_21_GMT}{All Sky Insolation Incident On A Horizontal + Surface at 21 GMT} +\item{ALLSKY_SFC_SW_DWN_MAX_DIFF}{Maximum Monthly Difference From Monthly + Averaged All Sky Insolation } +\item{ALLSKY_SFC_SW_DWN_MIN_DIFF}{Minimum Monthly Difference From Monthly + Averaged All Sky Insolation} \item{ALLSKY_TOA_SW_DWN}{Top-of-atmosphere Insolation} \item{CDD0}{Cooling Degree Days Above 0 C} \item{CDD10}{Cooling Degree Days Above 10 C} @@ -36,30 +46,47 @@ A list with 161 weather and climate parameters contained within the \item{CLD_AMT_21_GMT}{Cloud Amount at 21 GMT} \item{CLRSKY_DIFF}{Clear Sky Diffuse Radiation On A Horizontal Surface} \item{CLRSKY_NKT}{Normalized Clear Sky Insolation Clearness Index} -\item{CLRSKY_SFC_SW_DWN}{Clear Sky Insolation Incident on a Horizontal Surface} +\item{CLRSKY_SFC_SW_DWN}{Clear Sky Insolation Incident on a Horizontal + Surface} \item{DIFF}{Diffuse Radiation On A Horizontal Surface} \item{DIFF_MAX}{Maximum Diffuse Radiation On A Horizontal Surface} \item{DIFF_MIN}{Minimum Diffuse Radiation On A Horizontal Surface} \item{DNR}{Direct Normal Radiation} \item{DNR_MAX}{Maximum Direct Normal Radiation} -\item{DNR_MAX_DIFF}{Maximum Difference From Monthly Averaged Direct Normal Radiation} +\item{DNR_MAX_DIFF}{Maximum Difference From Monthly Averaged Direct Normal + Radiation} \item{DNR_MIN}{Minimum Direct Normal Radiation} -\item{DNR_MIN_DIFF}{Minimum Difference From Monthly Averaged Direct Normal Radiation} -\item{EQVLNT_NO_SUN_BLACKDAYS_1}{Equivalent Number Of NO-SUN Or BLACK Days Over A Consecutive 1-day Period} -\item{EQVLNT_NO_SUN_BLACKDAYS_14}{Equivalent Number Of NO-SUN Or BLACK Days Over A Consecutive 14-day Period} -\item{EQVLNT_NO_SUN_BLACKDAYS_21}{Equivalent Number Of NO-SUN Or BLACK Days Over A Consecutive 21-day Period} -\item{EQVLNT_NO_SUN_BLACKDAYS_3}{Equivalent Number Of NO-SUN Or BLACK Days Over A Consecutive 3-day Period} -\item{EQVLNT_NO_SUN_BLACKDAYS_7}{Equivalent Number Of NO-SUN Or BLACK Days Over A Consecutive 7-day Period} -\item{EQVLNT_NO_SUN_BLACKDAYS_MONTH}{Equivalent Number Of NO-SUN Or BLACK Days Over A Consecutive Month Period} +\item{DNR_MIN_DIFF}{Minimum Difference From Monthly Averaged Direct Norma +l Radiation} +\item{EQVLNT_NO_SUN_BLACKDAYS_1}{Equivalent Number Of NO-SUN Or BLACK Days + Over A Consecutive 1-day Period} +\item{EQVLNT_NO_SUN_BLACKDAYS_14}{Equivalent Number Of NO-SUN Or BLACK Days + Over A Consecutive 14-day Period} +\item{EQVLNT_NO_SUN_BLACKDAYS_21}{Equivalent Number Of NO-SUN Or BLACK Days + Over A Consecutive 21-day Period} +\item{EQVLNT_NO_SUN_BLACKDAYS_3}{Equivalent Number Of NO-SUN Or BLACK Days + Over A Consecutive 3-day Period} +\item{EQVLNT_NO_SUN_BLACKDAYS_7}{Equivalent Number Of NO-SUN Or BLACK Days + Over A Consecutive 7-day Period} +\item{EQVLNT_NO_SUN_BLACKDAYS_MONTH}{Equivalent Number Of NO-SUN Or BLACK + Days Over A Consecutive Month Period} \item{FROST_DAYS}{Frost Days} -\item{FRQ_BRKNCLD_10_70_00_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At 00 GMT} -\item{FRQ_BRKNCLD_10_70_03_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At 03 GMT} -\item{FRQ_BRKNCLD_10_70_06_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At 06 GMT} -\item{FRQ_BRKNCLD_10_70_09_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At 09 GMT} -\item{FRQ_BRKNCLD_10_70_12_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At 12 GMT} -\item{FRQ_BRKNCLD_10_70_15_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At 15 GMT} -\item{FRQ_BRKNCLD_10_70_18_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At 18 GMT} -\item{FRQ_BRKNCLD_10_70_21_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At 21 GMT} +\item{FRQ_BRKNCLD_10_70_00_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At + 00 GMT} +\item{FRQ_BRKNCLD_10_70_03_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At + 03 GMT} +\item{FRQ_BRKNCLD_10_70_06_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At + 06 GMT} +\item{FRQ_BRKNCLD_10_70_09_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At + 09 GMT} +\item{FRQ_BRKNCLD_10_70_12_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At + 12 GMT} +\item{FRQ_BRKNCLD_10_70_15_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At + 15 GMT} +\item{FRQ_BRKNCLD_10_70_18_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At + 18 GMT} +\item{FRQ_BRKNCLD_10_70_21_GMT}{Frequency Of Broken-cloud Skies 10 - 70 \% At + 21 GMT} \item{FRQ_CLRSKY_0_10_00_GMT}{Frequency Of Clear Skies < 10 \% At 00 GMT} \item{FRQ_CLRSKY_0_10_03_GMT}{Frequency Of Clear Skies < 10 \% At 03 GMT} \item{FRQ_CLRSKY_0_10_06_GMT}{Frequency Of Clear Skies < 10 \% At 06 GMT} @@ -68,23 +95,37 @@ A list with 161 weather and climate parameters contained within the \item{FRQ_CLRSKY_0_10_15_GMT}{Frequency Of Clear Skies < 10 \% At 15 GMT} \item{FRQ_CLRSKY_0_10_18_GMT}{Frequency Of Clear Skies < 10 \% At 18 GMT} \item{FRQ_CLRSKY_0_10_21_GMT}{Frequency Of Clear Skies < 10 \% At 21 GMT} -\item{FRQ_NROVRCST_70_00_GMT}{Frequency Of Near-overcast Skies >= 70 \% At 00 GMT} -\item{FRQ_NROVRCST_70_03_GMT}{Frequency Of Near-overcast Skies >= 70 \% At 03 GMT} -\item{FRQ_NROVRCST_70_06_GMT}{Frequency Of Near-overcast Skies >= 70 \% At 06 GMT} -\item{FRQ_NROVRCST_70_09_GMT}{Frequency Of Near-overcast Skies >= 70 \% At 09 GMT} -\item{FRQ_NROVRCST_70_12_GMT}{Frequency Of Near-overcast Skies >= 70 \% At 12 GMT} -\item{FRQ_NROVRCST_70_15_GMT}{Frequency Of Near-overcast Skies >= 70 \% At 15 GMT} -\item{FRQ_NROVRCST_70_18_GMT}{Frequency Of Near-overcast Skies >= 70 \% At 18 GMT} -\item{FRQ_NROVRCST_70_21_GMT}{Frequency Of Near-overcast Skies >= 70 \% At 21 GMT} +\item{FRQ_NROVRCST_70_00_GMT}{Frequency Of Near-overcast Skies >= 70 \% At + 00 GMT} +\item{FRQ_NROVRCST_70_03_GMT}{Frequency Of Near-overcast Skies >= 70 \% At + 03 GMT} +\item{FRQ_NROVRCST_70_06_GMT}{Frequency Of Near-overcast Skies >= 70 \% At + 06 GMT} +\item{FRQ_NROVRCST_70_09_GMT}{Frequency Of Near-overcast Skies >= 70 \% At + 09 GMT} +\item{FRQ_NROVRCST_70_12_GMT}{Frequency Of Near-overcast Skies >= 70 \% At + 12 GMT} +\item{FRQ_NROVRCST_70_15_GMT}{Frequency Of Near-overcast Skies >= 70 \% At + 15 GMT} +\item{FRQ_NROVRCST_70_18_GMT}{Frequency Of Near-overcast Skies >= 70 \% At + 18 GMT} +\item{FRQ_NROVRCST_70_21_GMT}{Frequency Of Near-overcast Skies >= 70 \% At + 21 GMT} \item{HDD0}{Heating Degree Days Below 0 C} \item{HDD10}{Heating Degree Days Below 10 C} \item{HDD18_3}{Heating Degree Days Below 18.3 C} -\item{INSOL_MIN_CONSEC_1}{Minimum Available Insolation Over A Consecutive 1-day Period} -\item{INSOL_MIN_CONSEC_14}{Minimum Available Insolation Over A Consecutive 14-day Period} -\item{INSOL_MIN_CONSEC_21}{Minimum Available Insolation Over A Consecutive 21-day Period} -\item{INSOL_MIN_CONSEC_3}{Minimum Available Insolation Over A Consecutive 3-day Period} -\item{INSOL_MIN_CONSEC_7}{Minimum Available Insolation Over A Consecutive 7-day Period} -\item{INSOL_MIN_CONSEC_MONTH}{Minimum Available Insolation Over A Consecutive Month Period} +\item{INSOL_MIN_CONSEC_1}{Minimum Available Insolation Over A Consecutive + 1-day Period} +\item{INSOL_MIN_CONSEC_14}{Minimum Available Insolation Over A Consecutive + 14-day Period} +\item{INSOL_MIN_CONSEC_21}{Minimum Available Insolation Over A Consecutive + 21-day Period} +\item{INSOL_MIN_CONSEC_3}{Minimum Available Insolation Over A Consecutive + 3-day Period} +\item{INSOL_MIN_CONSEC_7}{Minimum Available Insolation Over A Consecutive + 7-day Period} +\item{INSOL_MIN_CONSEC_MONTH}{Minimum Available Insolation Over A Consecutive + Month Period} \item{KT}{Insolation Clearness Index} \item{KT_CLEAR}{Clear Sky Insolation Clearness Index} \item{MIDDAY_INSOL}{Midday Insolation Incident On A Horizontal Surface} @@ -96,45 +137,69 @@ A list with 161 weather and climate parameters contained within the \item{PSC}{Corrected Atmospheric Pressure (Adjusted For Site Elevation)} \item{QV2M}{Specific Humidity at 2 Meters} \item{RH2M}{Relative Humidity at 2 Meters} -\item{SG_DAY_COZ_ZEN_AVG}{Daylight Average Of Hourly Cosine Solar Zenith Angles} +\item{SG_DAY_COZ_ZEN_AVG}{Daylight Average Of Hourly Cosine Solar Zenith + Angles} \item{SG_DAY_HOUR_AVG}{Daylight Hours} \item{SG_DEC_AVG}{Declination} \item{SG_HR_AZM_ANG_AVG}{Hourly Solar Azimuth Angles} \item{SG_HR_HRZ_ANG_AVG}{Hourly Solar Angles Relative To The Horizon} \item{SG_HR_SET_ANG}{Sunset Hour Angle} \item{SG_MAX_HRZ_ANG}{Maximum Solar Angle Relative To The Horizon} -\item{SG_MID_COZ_ZEN_ANG}{Cosine Solar Zenith Angle At Mid-Time Between Sunrise And Solar Noon} +\item{SG_MID_COZ_ZEN_ANG}{Cosine Solar Zenith Angle At Mid-Time Between + Sunrise And Solar Noon} \item{SG_NOON}{Solar Noon} -\item{SI_EF_TILTED_SURFACE_HORIZONTAL}{Solar Irradiance for Equator Facing Horizontal Surface} -\item{SI_EF_TILTED_SURFACE_LAT_MINUS15}{Solar Irradiance for Equator Facing Latitude Minus 15 Tilt} -\item{SI_EF_TILTED_SURFACE_LATITUDE}{Solar Irradiance for Equator Facing Latitude Tilt} -\item{SI_EF_TILTED_SURFACE_LAT_PLUS15}{Solar Irradiance for Equator Facing Latitude Plus 15 Tilt} -\item{SI_EF_TILTED_SURFACE_VERTICAL}{Solar Irradiance for Equator Facing Vertical Surface} +\item{SI_EF_TILTED_SURFACE_HORIZONTAL}{Solar Irradiance for Equator Facing + Horizontal Surface} +\item{SI_EF_TILTED_SURFACE_LAT_MINUS15}{Solar Irradiance for Equator Facing + Latitude Minus 15 Tilt} +\item{SI_EF_TILTED_SURFACE_LATITUDE}{Solar Irradiance for Equator Facing + Latitude Tilt} +\item{SI_EF_TILTED_SURFACE_LAT_PLUS15}{Solar Irradiance for Equator Facing + Latitude Plus 15 Tilt} +\item{SI_EF_TILTED_SURFACE_VERTICAL}{Solar Irradiance for Equator Facing + Vertical Surface} \item{SI_EF_OPTIMAL}{Solar Irradiance Optimal} \item{SI_EF_OPTIMAL_ANG}{Solar Irradiance Optimal Angle} \item{SI_EF_OPTIMAL_ANG_ORT}{Solar Irradiance Tilted Surface Orientation} \item{SI_EF_TRACKER}{Solar Irradiance Irradiance Tracking the Sun} -\item{SI_EF_TILTED_SURFACE}{Solar Irradiance for Equator Facing Tilted Surfaces (Set of Surfaces)} -\item{SI_EF_MIN_TILTED_SURFACE_HORIZONTAL}{Minimum Solar Irradiance for Equator Facing Horizontal Surface} -\item{SI_EF_MIN_TILTED_SURFACE_LAT_MINUS15}{Minimum Solar Irradiance for Equator Facing Latitude Minus 15 Tilt} -\item{SI_EF_MIN_TILTED_SURFACE_LATITUDE}{Minimum Solar Irradiance for Equator Facing Latitude Tilt} -\item{SI_EF_MIN_TILTED_SURFACE_LAT_PLUS15}{Minimum Solar Irradiance for Equator Facing Latitude Plus 15 Tilt} -\item{SI_EF_MIN_TILTED_SURFACE_VERTICAL}{Minimum Solar Irradiance for Equator Facing Vertical Surface} +\item{SI_EF_TILTED_SURFACE}{Solar Irradiance for Equator Facing Tilted + Surfaces (Set of Surfaces)} +\item{SI_EF_MIN_TILTED_SURFACE_HORIZONTAL}{Minimum Solar Irradiance for + Equator Facing Horizontal Surface} +\item{SI_EF_MIN_TILTED_SURFACE_LAT_MINUS15}{Minimum Solar Irradiance for + Equator Facing Latitude Minus 15 Tilt} +\item{SI_EF_MIN_TILTED_SURFACE_LATITUDE}{Minimum Solar Irradiance for Equator + Facing Latitude Tilt} +\item{SI_EF_MIN_TILTED_SURFACE_LAT_PLUS15}{Minimum Solar Irradiance for + Equator Facing Latitude Plus 15 Tilt} +\item{SI_EF_MIN_TILTED_SURFACE_VERTICAL}{Minimum Solar Irradiance for Equator + Facing Vertical Surface} \item{SI_EF_MIN_OPTIMAL}{Minimum Solar Irradiance Optimal} \item{SI_EF_MIN_OPTIMAL_ANG}{Minimum Solar Irradiance Optimal Angle} -\item{SI_EF_MIN_OPTIMAL_ANG_ORT}{Minimum Solar Irradiance Tilted Surface Orientation} -\item{SI_EF_MIN_TRACKER}{Minimum Solar Irradiance Irradiance Tracking the Sun} -\item{SI_EF_MIN_TILTED_SURFACE}{Minimum Solar Irradiance for Equator Facing Tilted Surfaces (Set of Surfaces)} -\item{SI_EF_MAX_TILTED_SURFACE_HORIZONTAL}{Maximum Solar Irradiance for Equator Facing Horizontal Surface} -\item{SI_EF_MAX_TILTED_SURFACE_LAT_MINUS15}{Maximum Solar Irradiance for Equator Facing Latitude Minus 15 Tilt} -\item{SI_EF_MAX_TILTED_SURFACE_LATITUDE}{Maximum Solar Irradiance for Equator Facing Latitude Tilt} -\item{SI_EF_MAX_TILTED_SURFACE_LAT_PLUS15}{Maximum Solar Irradiance for Equator Facing Latitude Plus 15 Tilt} -\item{SI_EF_MAX_TILTED_SURFACE_VERTICAL}{Maximum Solar Irradiance for Equator Facing Vertical Surface} +\item{SI_EF_MIN_OPTIMAL_ANG_ORT}{Minimum Solar Irradiance Tilted Surface + Orientation} +\item{SI_EF_MIN_TRACKER}{Minimum Solar Irradiance Irradiance Tracking the + Sun} +\item{SI_EF_MIN_TILTED_SURFACE}{Minimum Solar Irradiance for Equator Facing + Tilted Surfaces (Set of Surfaces)} +\item{SI_EF_MAX_TILTED_SURFACE_HORIZONTAL}{Maximum Solar Irradiance for + Equator Facing Horizontal Surface} +\item{SI_EF_MAX_TILTED_SURFACE_LAT_MINUS15}{Maximum Solar Irradiance for + Equator Facing Latitude Minus 15 Tilt} +\item{SI_EF_MAX_TILTED_SURFACE_LATITUDE}{Maximum Solar Irradiance for + Equator Facing Latitude Tilt} +\item{SI_EF_MAX_TILTED_SURFACE_LAT_PLUS15}{Maximum Solar Irradiance for + Equator Facing Latitude Plus 15 Tilt} +\item{SI_EF_MAX_TILTED_SURFACE_VERTICAL}{Maximum Solar Irradiance for Equator + Facing Vertical Surface} \item{SI_EF_MAX_OPTIMAL}{Maximum Solar Irradiance Optimal} \item{SI_EF_MAX_OPTIMAL_ANG}{Maximum Solar Irradiance Optimal Angle} -\item{SI_EF_MAX_OPTIMAL_ANG_ORT}{Maximum Solar Irradiance Tilted Surface Orientation} -\item{SI_EF_MAX_TRACKER}{Maximum Solar Irradiance Irradiance Tracking the Sun} -\item{SI_EF_MAX_TILTED_SURFACE}{Maximum Solar Irradiance for Equator Facing Tilted Surfaces (Set of Surfaces)} +\item{SI_EF_MAX_OPTIMAL_ANG_ORT}{Maximum Solar Irradiance Tilted Surface + Orientation} +\item{SI_EF_MAX_TRACKER}{Maximum Solar Irradiance Irradiance Tracking the + Sun} +\item{SI_EF_MAX_TILTED_SURFACE}{Maximum Solar Irradiance for Equator Facing + Tilted Surfaces (Set of Surfaces)} \item{SR}{Surface Roughness} \item{SRF_ALB}{Surface Albedo} \item{T10M}{Temperature at 10 Meters} diff --git a/revdep/README.md b/revdep/README.md index c6f412e7..fc0ab676 100644 --- a/revdep/README.md +++ b/revdep/README.md @@ -3,41 +3,44 @@ |field |value | |:--------|:----------------------------| |version |R version 4.0.2 (2020-06-22) | -|os |macOS Catalina 10.15.6 | +|os |macOS Catalina 10.15.7 | |system |x86_64, darwin17.0 | |ui |RStudio | |language |(EN) | |collate |en_AU.UTF-8 | |ctype |en_AU.UTF-8 | |tz |Australia/Brisbane | -|date |2020-09-23 | +|date |2020-10-10 | # Dependencies -|package |old |new |Δ | -|:---------|:------|:------|:--| -|nasapower |1.1.3 |2.0.0 |* | -|APSIM |0.9.3 |0.9.3 | | -|bit |4.0.4 |4.0.4 | | -|bit64 |4.0.5 |4.0.5 | | -|blob |1.2.1 |1.2.1 | | -|crul |1.0.0 |1.0.0 | | -|DBI |1.1.0 |1.1.0 | | -|glue |NA |1.4.2 |* | -|httpcode |0.3.0 |0.3.0 | | -|jsonlite |NA |1.7.1 |* | -|memoise |1.1.0 |1.1.0 | | -|plogr |0.2.0 |0.2.0 | | -|plyr |1.8.6 |1.8.6 | | -|raster |3.3-13 |3.3-13 | | -|RSQLite |2.2.0 |2.2.0 | | -|sirad |2.3-3 |2.3-3 | | -|sp |1.4-2 |1.4-2 | | -|stringi |NA |1.5.3 |* | -|triebeard |0.3.0 |0.3.0 | | -|urltools |1.7.3 |1.7.3 | | -|vctrs |NA |0.3.4 |* | -|zoo |1.8-8 |1.8-8 | | +|package |old |new |Δ | +|:---------|:------|:-----|:--| +|nasapower |2.0.0 |3.0.0 |* | +|APSIM |0.9.3 |NA |* | +|bit |4.0.4 |NA |* | +|bit64 |4.0.5 |NA |* | +|blob |1.2.1 |NA |* | +|clipr |NA |0.7.1 |* | +|cpp11 |NA |0.2.2 |* | +|crul |1.0.0 |1.0.0 | | +|DBI |1.1.0 |NA |* | +|glue |NA |1.4.2 |* | +|httpcode |0.3.0 |0.3.0 | | +|jsonlite |NA |1.7.1 |* | +|memoise |1.1.0 |NA |* | +|plogr |0.2.0 |NA |* | +|plyr |1.8.6 |NA |* | +|raster |3.3-13 |NA |* | +|readr |NA |1.4.0 |* | +|rlang |NA |0.4.8 |* | +|RSQLite |2.2.1 |NA |* | +|sirad |2.3-3 |NA |* | +|sp |1.4-4 |NA |* | +|triebeard |0.3.0 |0.3.0 | | +|urltools |1.7.3 |1.7.3 | | +|vctrs |NA |0.3.4 |* | +|zoo |1.8-8 |NA |* | # Revdeps diff --git a/tests/fixtures/vcr_cassettes/get_power_PS.yml b/tests/fixtures/vcr_cassettes/get_power_PS.yml deleted file mode 100644 index 16c5132c..00000000 --- a/tests/fixtures/vcr_cassettes/get_power_PS.yml +++ /dev/null @@ -1,159 +0,0 @@ -http_interactions: -- request: - method: get - uri: https://power.larc.nasa.gov/cgi-bin/v1/DataAccess.py - body: - encoding: '' - string: '' - headers: - User-Agent: libcurl/7.64.1 r-curl/4.3 crul/1.0.0 - Accept-Encoding: gzip, deflate - Accept: application/json, text/xml, application/xml, */* - response: - status: - status_code: '200' - message: OK - explanation: Request fulfilled, document follows - headers: - status: HTTP/1.1 200 OK - date: Wed, 23 Sep 2020 11:03:06 GMT - server: Apache - x-frame-options: SAMEORIGIN - x-content-type-options: nosniff - strict-transport-security: max-age=31536000 - x-permitted-cross-domain-policies: none - transfer-encoding: chunked - content-type: application/json - body: - encoding: UTF-8 - file: no - string: | - { - "messages": [ - { - "Alert": { - "Description": { - "Issue": "Input request type is not allowed. Please reference our API Documentation at https://power.larc.nasa.gov for more information." - } - } - } - ] - } - recorded_at: 2020-09-23 11:03:09 GMT - recorded_with: vcr/0.5.4, webmockr/0.6.2 -- request: - method: get - uri: https://power.larc.nasa.gov/cgi-bin/v1/DataAccess.py?request=execute&identifier=SinglePoint¶meters=T2M,T2M_MIN,T2M_MAX,RH2M,WS10M,PS&startDate=19830101&endDate=19830101&userCommunity=AG&tempAverage=DAILY&outputList=CSV&lon=-179.5&lat=-89.5&user=nasapower - body: - encoding: '' - string: '' - headers: - User-Agent: libcurl/7.64.1 r-curl/4.3 crul/1.0.0 - Accept-Encoding: gzip, deflate - Accept: application/json, text/xml, application/xml, */* - response: - status: - status_code: '200' - message: OK - explanation: Request fulfilled, document follows - headers: - status: HTTP/1.1 200 OK - date: Wed, 23 Sep 2020 11:03:07 GMT - server: Apache - x-frame-options: SAMEORIGIN - x-content-type-options: nosniff - strict-transport-security: max-age=31536000 - x-permitted-cross-domain-policies: none - transfer-encoding: chunked - content-type: application/json - body: - encoding: UTF-8 - file: no - string: | - { - "features": [ - { - "geometry": { - "coordinates": [ - -179.49999, - -89.49999, - 2938.4 - ], - "type": "Point" - }, - "properties": { - "parameter": { - "PS": { - "19830101": 68.57 - }, - "RH2M": { - "19830101": 73.92 - }, - "T2M": { - "19830101": -25.24 - }, - "T2M_MAX": { - "19830101": -24.9 - }, - "T2M_MIN": { - "19830101": -25.55 - }, - "WS10M": { - "19830101": 2.14 - } - } - }, - "type": "Feature" - } - ], - "header": { - "api_version": "1.1.0", - "endDate": "19830101", - "fillValue": "-99", - "startDate": "19830101", - "title": "NASA/POWER SRB/FLASHFlux/MERRA2/GEOS 5.12.4 (FP-IT) 0.5 x 0.5 Degree Daily Averaged Data" - }, - "messages": [], - "outputs": { - "csv": "https://power.larc.nasa.gov/downloads/POWER_SinglePoint_Daily_19830101_19830101_89d50S_179d50W_2ffb508f.csv" - }, - "parameterInformation": { - "PS": { - "longname": "Surface Pressure", - "units": "kPa" - }, - "RH2M": { - "longname": "Relative Humidity at 2 Meters", - "units": "%" - }, - "T2M": { - "longname": "Temperature at 2 Meters", - "units": "C" - }, - "T2M_MAX": { - "longname": "Maximum Temperature at 2 Meters", - "units": "C" - }, - "T2M_MIN": { - "longname": "Minimum Temperature at 2 Meters", - "units": "C" - }, - "WS10M": { - "longname": "Wind Speed at 10 Meters", - "units": "m/s" - } - }, - "time": [ - [ - "Main OPeNDAP Requests:", - 0.32 - ], - [ - "Total Script:", - 1.64 - ] - ], - "type": "FeatureCollection" - } - recorded_at: 2020-09-23 11:03:09 GMT - recorded_with: vcr/0.5.4, webmockr/0.6.2 diff --git a/tests/fixtures/vcr_cassettes/get_power_SB.yml b/tests/fixtures/vcr_cassettes/get_power_SB.yml deleted file mode 100644 index db9ff51c..00000000 --- a/tests/fixtures/vcr_cassettes/get_power_SB.yml +++ /dev/null @@ -1,152 +0,0 @@ -http_interactions: -- request: - method: get - uri: https://power.larc.nasa.gov/cgi-bin/v1/DataAccess.py - body: - encoding: '' - string: '' - headers: - User-Agent: libcurl/7.64.1 r-curl/4.3 crul/1.0.0 - Accept-Encoding: gzip, deflate - Accept: application/json, text/xml, application/xml, */* - response: - status: - status_code: '200' - message: OK - explanation: Request fulfilled, document follows - headers: - status: HTTP/1.1 200 OK - date: Wed, 23 Sep 2020 11:03:13 GMT - server: Apache - x-frame-options: SAMEORIGIN - x-content-type-options: nosniff - strict-transport-security: max-age=31536000 - x-permitted-cross-domain-policies: none - transfer-encoding: chunked - content-type: application/json - body: - encoding: UTF-8 - file: no - string: | - { - "messages": [ - { - "Alert": { - "Description": { - "Issue": "Input request type is not allowed. Please reference our API Documentation at https://power.larc.nasa.gov for more information." - } - } - } - ] - } - recorded_at: 2020-09-23 11:03:16 GMT - recorded_with: vcr/0.5.4, webmockr/0.6.2 -- request: - method: get - uri: https://power.larc.nasa.gov/cgi-bin/v1/DataAccess.py?request=execute&identifier=SinglePoint¶meters=T2M,T2M_MIN,T2M_MAX,RH2M,WS10M&startDate=19830101&endDate=19830101&userCommunity=SB&tempAverage=DAILY&outputList=CSV&lon=-179.5&lat=-89.5&user=nasapower - body: - encoding: '' - string: '' - headers: - User-Agent: libcurl/7.64.1 r-curl/4.3 crul/1.0.0 - Accept-Encoding: gzip, deflate - Accept: application/json, text/xml, application/xml, */* - response: - status: - status_code: '200' - message: OK - explanation: Request fulfilled, document follows - headers: - status: HTTP/1.1 200 OK - date: Wed, 23 Sep 2020 11:03:14 GMT - server: Apache - x-frame-options: SAMEORIGIN - x-content-type-options: nosniff - strict-transport-security: max-age=31536000 - x-permitted-cross-domain-policies: none - transfer-encoding: chunked - content-type: application/json - body: - encoding: UTF-8 - file: no - string: | - { - "features": [ - { - "geometry": { - "coordinates": [ - -179.49999, - -89.49999, - 2938.4 - ], - "type": "Point" - }, - "properties": { - "parameter": { - "RH2M": { - "19830101": 73.92 - }, - "T2M": { - "19830101": -25.24 - }, - "T2M_MAX": { - "19830101": -24.9 - }, - "T2M_MIN": { - "19830101": -25.55 - }, - "WS10M": { - "19830101": 2.14 - } - } - }, - "type": "Feature" - } - ], - "header": { - "api_version": "1.1.0", - "endDate": "19830101", - "fillValue": "-999", - "startDate": "19830101", - "title": "NASA/POWER SRB/FLASHFlux/MERRA2/GEOS 5.12.4 (FP-IT) 0.5 x 0.5 Degree Daily Averaged Data" - }, - "messages": [], - "outputs": { - "csv": "https://power.larc.nasa.gov/downloads/POWER_SinglePoint_Daily_19830101_19830101_89d50S_179d50W_17a94c36.csv" - }, - "parameterInformation": { - "RH2M": { - "longname": "Relative Humidity at 2 Meters", - "units": "%" - }, - "T2M": { - "longname": "Temperature at 2 Meters", - "units": "C" - }, - "T2M_MAX": { - "longname": "Maximum Temperature at 2 Meters", - "units": "C" - }, - "T2M_MIN": { - "longname": "Minimum Temperature at 2 Meters", - "units": "C" - }, - "WS10M": { - "longname": "Wind Speed at 10 Meters", - "units": "m/s" - } - }, - "time": [ - [ - "Main OPeNDAP Requests:", - 0.28 - ], - [ - "Total Script:", - 1.56 - ] - ], - "type": "FeatureCollection" - } - recorded_at: 2020-09-23 11:03:16 GMT - recorded_with: vcr/0.5.4, webmockr/0.6.2 diff --git a/tests/fixtures/vcr_cassettes/get_power_corrected_AG_climatology.yml b/tests/fixtures/vcr_cassettes/get_power_corrected_AG_climatology.yml deleted file mode 100644 index 6fc7aa04..00000000 --- a/tests/fixtures/vcr_cassettes/get_power_corrected_AG_climatology.yml +++ /dev/null @@ -1,104 +0,0 @@ -http_interactions: -- request: - method: get - uri: https://power.larc.nasa.gov/cgi-bin/v1/DataAccess.py - body: - encoding: '' - string: '' - headers: - User-Agent: libcurl/7.64.1 r-curl/4.3 crul/1.0.0 - Accept-Encoding: gzip, deflate - Accept: application/json, text/xml, application/xml, */* - response: - status: - status_code: '200' - message: OK - explanation: Request fulfilled, document follows - headers: - status: HTTP/1.1 200 OK - date: Wed, 23 Sep 2020 11:03:19 GMT - server: Apache - x-frame-options: SAMEORIGIN - x-content-type-options: nosniff - strict-transport-security: max-age=31536000 - x-permitted-cross-domain-policies: none - transfer-encoding: chunked - content-type: application/json - body: - encoding: UTF-8 - file: no - string: | - { - "messages": [ - { - "Alert": { - "Description": { - "Issue": "Input request type is not allowed. Please reference our API Documentation at https://power.larc.nasa.gov for more information." - } - } - } - ] - } - recorded_at: 2020-09-23 11:04:09 GMT - recorded_with: vcr/0.5.4, webmockr/0.6.2 -- request: - method: get - uri: https://power.larc.nasa.gov/cgi-bin/v1/DataAccess.py?request=execute&identifier=Global¶meters=T2M&userCommunity=AG&tempAverage=CLIMATOLOGY&outputList=CSV&user=nasapower - body: - encoding: '' - string: '' - headers: - User-Agent: libcurl/7.64.1 r-curl/4.3 crul/1.0.0 - Accept-Encoding: gzip, deflate - Accept: application/json, text/xml, application/xml, */* - response: - status: - status_code: '200' - message: OK - explanation: Request fulfilled, document follows - headers: - status: HTTP/1.1 200 OK - date: Wed, 23 Sep 2020 11:03:20 GMT - server: Apache - x-frame-options: SAMEORIGIN - x-content-type-options: nosniff - strict-transport-security: max-age=31536000 - x-permitted-cross-domain-policies: none - transfer-encoding: chunked - content-type: application/json - body: - encoding: UTF-8 - file: no - string: | - { - "features": "The Global Request tool does not return data parameters values by default in JSON format. If JSON output is required please specify JSON as the output type in your request and select the JSON file under outputs section. Please reference our API Documentation at https://power.larc.nasa.gov for more information.", - "header": { - "api_version": "1.1.0", - "fillValue": "-99", - "range": "30-year Meteorological and Solar Monthly & Annual Climatologies (January 1984 - December 2013), 22-year Additional Solar Parameter Monthly & Annual Climatologies (July 1983 - June 2005)", - "title": "NASA/POWER SRB/MERRA2 0.5 x 0.5 Degree Climatologies" - }, - "messages": [], - "outputs": { - "csv": "https://power.larc.nasa.gov/downloads/POWER_Global_Climatology_05c659f6.csv" - }, - "parameterInformation": { - "T2M": { - "longname": "Temperature at 2 Meters", - "units": "C" - } - }, - "time": [ - [ - "Main OPeNDAP Requests:", - 2.38 - ], - [ - "Total Script:", - 9.69 - ] - ], - "type": "FeatureCollection" - } - recorded_at: 2020-09-23 11:04:09 GMT - recorded_with: vcr/0.5.4, webmockr/0.6.2 diff --git a/tests/fixtures/vcr_cassettes/get_power_corrected_AG_regional.yml b/tests/fixtures/vcr_cassettes/get_power_corrected_AG_regional.yml deleted file mode 100644 index 1350e4fb..00000000 --- a/tests/fixtures/vcr_cassettes/get_power_corrected_AG_regional.yml +++ /dev/null @@ -1,105 +0,0 @@ -http_interactions: -- request: - method: get - uri: https://power.larc.nasa.gov/cgi-bin/v1/DataAccess.py - body: - encoding: '' - string: '' - headers: - User-Agent: libcurl/7.64.1 r-curl/4.3 crul/1.0.0 - Accept-Encoding: gzip, deflate - Accept: application/json, text/xml, application/xml, */* - response: - status: - status_code: '200' - message: OK - explanation: Request fulfilled, document follows - headers: - status: HTTP/1.1 200 OK - date: Wed, 23 Sep 2020 11:03:16 GMT - server: Apache - x-frame-options: SAMEORIGIN - x-content-type-options: nosniff - strict-transport-security: max-age=31536000 - x-permitted-cross-domain-policies: none - transfer-encoding: chunked - content-type: application/json - body: - encoding: UTF-8 - file: no - string: | - { - "messages": [ - { - "Alert": { - "Description": { - "Issue": "Input request type is not allowed. Please reference our API Documentation at https://power.larc.nasa.gov for more information." - } - } - } - ] - } - recorded_at: 2020-09-23 11:03:19 GMT - recorded_with: vcr/0.5.4, webmockr/0.6.2 -- request: - method: get - uri: https://power.larc.nasa.gov/cgi-bin/v1/DataAccess.py?request=execute&identifier=Regional¶meters=T2M&startDate=19830101&endDate=19830101&userCommunity=AG&tempAverage=DAILY&bbox=-55.5,112.5,-50.5,115.5&outputList=CSV&user=nasapower - body: - encoding: '' - string: '' - headers: - User-Agent: libcurl/7.64.1 r-curl/4.3 crul/1.0.0 - Accept-Encoding: gzip, deflate - Accept: application/json, text/xml, application/xml, */* - response: - status: - status_code: '200' - message: OK - explanation: Request fulfilled, document follows - headers: - status: HTTP/1.1 200 OK - date: Wed, 23 Sep 2020 11:03:17 GMT - server: Apache - x-frame-options: SAMEORIGIN - x-content-type-options: nosniff - strict-transport-security: max-age=31536000 - x-permitted-cross-domain-policies: none - transfer-encoding: chunked - content-type: application/json - body: - encoding: UTF-8 - file: no - string: | - { - "features": "The Regional Request tool does not return data parameters values by default in JSON format. If JSON output is required please specify JSON as the output type in your request and select the JSON file under outputs section. Please reference our API Documentation at https://power.larc.nasa.gov for more information.", - "header": { - "api_version": "1.1.0", - "endDate": "19830101", - "fillValue": "-99", - "startDate": "19830101", - "title": "NASA/POWER SRB/FLASHFlux/MERRA2/GEOS 5.12.4 (FP-IT) 0.5 x 0.5 Degree Daily Averaged Data" - }, - "messages": [], - "outputs": { - "csv": "https://power.larc.nasa.gov/downloads/POWER_Regional_Daily_19830101_19830101_81d22222.csv" - }, - "parameterInformation": { - "T2M": { - "longname": "Temperature at 2 Meters", - "units": "C" - } - }, - "time": [ - [ - "Main OPeNDAP Requests:", - 0.38 - ], - [ - "Total Script:", - 1.09 - ] - ], - "type": "FeatureCollection" - } - recorded_at: 2020-09-23 11:03:19 GMT - recorded_with: vcr/0.5.4, webmockr/0.6.2 diff --git a/tests/fixtures/vcr_cassettes/get_power_corrected_PS.yml b/tests/fixtures/vcr_cassettes/get_power_corrected_PS.yml deleted file mode 100644 index fcdbcff7..00000000 --- a/tests/fixtures/vcr_cassettes/get_power_corrected_PS.yml +++ /dev/null @@ -1,166 +0,0 @@ -http_interactions: -- request: - method: get - uri: https://power.larc.nasa.gov/cgi-bin/v1/DataAccess.py - body: - encoding: '' - string: '' - headers: - User-Agent: libcurl/7.64.1 r-curl/4.3 crul/1.0.0 - Accept-Encoding: gzip, deflate - Accept: application/json, text/xml, application/xml, */* - response: - status: - status_code: '200' - message: OK - explanation: Request fulfilled, document follows - headers: - status: HTTP/1.1 200 OK - date: Wed, 23 Sep 2020 11:03:09 GMT - server: Apache - x-frame-options: SAMEORIGIN - x-content-type-options: nosniff - strict-transport-security: max-age=31536000 - x-permitted-cross-domain-policies: none - transfer-encoding: chunked - content-type: application/json - body: - encoding: UTF-8 - file: no - string: | - { - "messages": [ - { - "Alert": { - "Description": { - "Issue": "Input request type is not allowed. Please reference our API Documentation at https://power.larc.nasa.gov for more information." - } - } - } - ] - } - recorded_at: 2020-09-23 11:03:13 GMT - recorded_with: vcr/0.5.4, webmockr/0.6.2 -- request: - method: get - uri: https://power.larc.nasa.gov/cgi-bin/v1/DataAccess.py?request=execute&identifier=SinglePoint¶meters=T2M,T2M_MIN,T2M_MAX,RH2M,WS10M,PS&startDate=19830101&endDate=19830101&userCommunity=AG&tempAverage=DAILY&siteElev=0&outputList=CSV&lon=-179.5&lat=-89.5&user=nasapower - body: - encoding: '' - string: '' - headers: - User-Agent: libcurl/7.64.1 r-curl/4.3 crul/1.0.0 - Accept-Encoding: gzip, deflate - Accept: application/json, text/xml, application/xml, */* - response: - status: - status_code: '200' - message: OK - explanation: Request fulfilled, document follows - headers: - status: HTTP/1.1 200 OK - date: Wed, 23 Sep 2020 11:03:10 GMT - server: Apache - x-frame-options: SAMEORIGIN - x-content-type-options: nosniff - strict-transport-security: max-age=31536000 - x-permitted-cross-domain-policies: none - transfer-encoding: chunked - content-type: application/json - body: - encoding: UTF-8 - file: no - string: | - { - "features": [ - { - "geometry": { - "coordinates": [ - -179.49999, - -89.49999, - 2938.4 - ], - "type": "Point" - }, - "properties": { - "parameter": { - "PS": { - "19830101": 68.57 - }, - "PSC": { - "19830101": 101.24 - }, - "RH2M": { - "19830101": 73.92 - }, - "T2M": { - "19830101": -25.24 - }, - "T2M_MAX": { - "19830101": -24.9 - }, - "T2M_MIN": { - "19830101": -25.55 - }, - "WS10M": { - "19830101": 2.14 - } - } - }, - "type": "Feature" - } - ], - "header": { - "api_version": "1.1.0", - "endDate": "19830101", - "fillValue": "-99", - "startDate": "19830101", - "title": "NASA/POWER SRB/FLASHFlux/MERRA2/GEOS 5.12.4 (FP-IT) 0.5 x 0.5 Degree Daily Averaged Data" - }, - "messages": [], - "outputs": { - "csv": "https://power.larc.nasa.gov/downloads/POWER_SinglePoint_Daily_19830101_19830101_89d50S_179d50W_48e1cb81.csv" - }, - "parameterInformation": { - "PS": { - "longname": "Surface Pressure", - "units": "kPa" - }, - "PSC": { - "longname": "Corrected Atmospheric Pressure (Adjusted For Site Elevation)", - "units": "kPa" - }, - "RH2M": { - "longname": "Relative Humidity at 2 Meters", - "units": "%" - }, - "T2M": { - "longname": "Temperature at 2 Meters", - "units": "C" - }, - "T2M_MAX": { - "longname": "Maximum Temperature at 2 Meters", - "units": "C" - }, - "T2M_MIN": { - "longname": "Minimum Temperature at 2 Meters", - "units": "C" - }, - "WS10M": { - "longname": "Wind Speed at 10 Meters", - "units": "m/s" - } - }, - "time": [ - [ - "Main OPeNDAP Requests:", - 0.23 - ], - [ - "Total Script:", - 1.82 - ] - ], - "type": "FeatureCollection" - } - recorded_at: 2020-09-23 11:03:13 GMT - recorded_with: vcr/0.5.4, webmockr/0.6.2 diff --git a/tests/testthat/helper-nasapower.R b/tests/testthat/helper-nasapower.R deleted file mode 100644 index 9f768dbc..00000000 --- a/tests/testthat/helper-nasapower.R +++ /dev/null @@ -1,2 +0,0 @@ -library("vcr") -invisible(vcr::vcr_configure(dir = "../fixtures/vcr_cassettes")) diff --git a/tests/testthat/test-get_power.R b/tests/testthat/test-get_power.R index eaf61b1b..fac92aad 100644 --- a/tests/testthat/test-get_power.R +++ b/tests/testthat/test-get_power.R @@ -1,229 +1,218 @@ + # test queries ----------------------------------------------------------------- context("get_power() AG Community") test_that("get_power returns daily point AG data", { skip_on_cran() - vcr::use_cassette("get_power_PS", { - power_query <- get_power( - community = "AG", - lonlat = c(-179.5, -89.5), - pars = c("T2M", - "T2M_MIN", - "T2M_MAX", - "RH2M", - "WS10M", - "PS"), - dates = c("1983-01-01"), - temporal_average = "Daily" - ) + power_query <- get_power( + community = "AG", + lonlat = c(-179.5, -89.5), + pars = c("T2M", + "T2M_MIN", + "T2M_MAX", + "RH2M", + "WS10M", + "PS"), + dates = c("1983-01-01"), + temporal_average = "Daily" + ) - expect_is(power_query, "data.frame") - expect_equal(power_query$LAT, -89.5, tolerance = 1e-3) - expect_equal(power_query$LON, -179.5, tolerance = 1e-3) - expect_equal(power_query$YEAR, 1983) - expect_equal(power_query$MM, 1) - expect_equal(power_query$DD, 1) - expect_equal(power_query$DOY, 1) - expect_equal(power_query$YYYYMMDD, as.Date("1983-01-01")) - expect_equal(power_query$T2M, -25.24) - expect_equal(power_query$T2M_MIN, -25.55) - expect_equal(power_query$T2M_MAX, -24.9) - expect_equal(power_query$RH2M, 73.92) - expect_equal(power_query$WS10M, 2.14) - expect_equal(power_query$PS, 68.57) - expect_named( - power_query, - c( - "LON", - "LAT", - "YEAR", - "MM", - "DD", - "DOY", - "YYYYMMDD", - "T2M", - "T2M_MIN", - "T2M_MAX", - "RH2M", - "WS10M", - "PS" - ) + expect_is(power_query, "data.frame") + expect_equal(power_query$LAT, -89.5, tolerance = 1e-3) + expect_equal(power_query$LON, -179.5, tolerance = 1e-3) + expect_equal(power_query$YEAR, 1983) + expect_equal(power_query$MM, 1) + expect_equal(power_query$DD, 1) + expect_equal(power_query$DOY, 1) + expect_equal(power_query$YYYYMMDD, as.Date("1983-01-01")) + expect_equal(power_query$T2M, -25.24) + expect_equal(power_query$T2M_MIN, -25.55) + expect_equal(power_query$T2M_MAX, -24.9) + expect_equal(power_query$RH2M, 73.92) + expect_equal(power_query$WS10M, 2.14) + expect_equal(power_query$PS, 68.57) + expect_named( + power_query, + c( + "LON", + "LAT", + "YEAR", + "MM", + "DD", + "DOY", + "YYYYMMDD", + "T2M", + "T2M_MIN", + "T2M_MAX", + "RH2M", + "WS10M", + "PS" ) - rm(power_query) - }) + ) + rm(power_query) }) -test_that("get_power() returns daily point AG data with adjusted atmospheric air pressure", - { +test_that("get_power() returns daily point AG data with adjusted atmospheric + air pressure", { skip_on_cran() - vcr::use_cassette("get_power_corrected_PS", { - power_query <- get_power( - community = "AG", - lonlat = c(-179.5, -89.5), - pars = c("T2M", - "T2M_MIN", - "T2M_MAX", - "RH2M", - "WS10M", - "PS"), - dates = c("1983-01-01"), - temporal_average = "Daily", - site_elevation = 0 - ) + power_query <- get_power( + community = "AG", + lonlat = c(-179.5, -89.5), + pars = c("T2M", + "T2M_MIN", + "T2M_MAX", + "RH2M", + "WS10M", + "PS"), + dates = c("1983-01-01"), + temporal_average = "Daily", + site_elevation = 0 + ) - expect_is(power_query, "data.frame") - expect_equal(power_query$LAT, -89.5, tolerance = 1e-3) - expect_equal(power_query$LON, -179.5, tolerance = 1e-3) - expect_equal(power_query$YEAR, 1983) - expect_equal(power_query$MM, 1) - expect_equal(power_query$DD, 1) - expect_equal(power_query$DOY, 1) - expect_equal(power_query$YYYYMMDD, as.Date("1983-01-01")) - expect_equal(power_query$T2M, -25.24) - expect_equal(power_query$T2M_MIN, -25.55) - expect_equal(power_query$T2M_MAX, -24.9) - expect_equal(power_query$RH2M, 73.92) - expect_equal(power_query$WS10M, 2.14) - expect_equal(power_query$PS, 68.57) - expect_equal(power_query$PSC, 101.2, tolerance = 1e-1) - expect_named( - power_query, - c( - "LON", - "LAT", - "YEAR", - "MM", - "DD", - "DOY", - "YYYYMMDD", - "T2M", - "T2M_MIN", - "T2M_MAX", - "RH2M", - "WS10M", - "PS", - "PSC" - ) + expect_is(power_query, "data.frame") + expect_equal(power_query$LAT, -89.5, tolerance = 1e-3) + expect_equal(power_query$LON, -179.5, tolerance = 1e-3) + expect_equal(power_query$YEAR, 1983) + expect_equal(power_query$MM, 1) + expect_equal(power_query$DD, 1) + expect_equal(power_query$DOY, 1) + expect_equal(power_query$YYYYMMDD, as.Date("1983-01-01")) + expect_equal(power_query$T2M, -25.24) + expect_equal(power_query$T2M_MIN, -25.55) + expect_equal(power_query$T2M_MAX, -24.9) + expect_equal(power_query$RH2M, 73.92) + expect_equal(power_query$WS10M, 2.14) + expect_equal(power_query$PS, 68.57) + expect_equal(power_query$PSC, 101.2, tolerance = 1e-1) + expect_named( + power_query, + c( + "LON", + "LAT", + "YEAR", + "MM", + "DD", + "DOY", + "YYYYMMDD", + "T2M", + "T2M_MIN", + "T2M_MAX", + "RH2M", + "WS10M", + "PS", + "PSC" ) - rm(power_query) - }) + ) + rm(power_query) }) context("get_power() SB Community") test_that("get_power returns daily point SB data", { skip_on_cran() - vcr::use_cassette("get_power_SB", { - power_query <- get_power( - community = "SB", - lonlat = c(-179.5, -89.5), - pars = c("T2M", - "T2M_MIN", - "T2M_MAX", - "RH2M", - "WS10M"), - dates = c("1983-01-01"), - temporal_average = "Daily" - ) + power_query <- get_power( + community = "SB", + lonlat = c(-179.5, -89.5), + pars = c("T2M", + "T2M_MIN", + "T2M_MAX", + "RH2M", + "WS10M"), + dates = c("1983-01-01"), + temporal_average = "Daily" + ) - expect_is(power_query, "data.frame") - expect_equal(power_query$LAT, -89.5, tolerance = 1e-3) - expect_equal(power_query$LON, -179.5, tolerance = 1e-3) - expect_equal(power_query$YEAR, 1983) - expect_equal(power_query$MM, 1) - expect_equal(power_query$DD, 1) - expect_equal(power_query$DOY, 1) - expect_equal(power_query$YYYYMMDD, as.Date("1983-01-01")) - expect_equal(power_query$T2M, -25.24) - expect_equal(power_query$T2M_MIN, -25.55) - expect_equal(power_query$T2M_MAX, -24.9) - expect_equal(power_query$RH2M, 73.92) - expect_equal(power_query$WS10M, 2.14) - rm(power_query) - }) + expect_is(power_query, "data.frame") + expect_equal(power_query$LAT, -89.5, tolerance = 1e-3) + expect_equal(power_query$LON, -179.5, tolerance = 1e-3) + expect_equal(power_query$YEAR, 1983) + expect_equal(power_query$MM, 1) + expect_equal(power_query$DD, 1) + expect_equal(power_query$DOY, 1) + expect_equal(power_query$YYYYMMDD, as.Date("1983-01-01")) + expect_equal(power_query$T2M, -25.24) + expect_equal(power_query$T2M_MIN, -25.55) + expect_equal(power_query$T2M_MAX, -24.9) + expect_equal(power_query$RH2M, 73.92) + expect_equal(power_query$WS10M, 2.14) + rm(power_query) }) test_that("get_power() returns daily regional AG data", { skip_on_cran() - vcr::use_cassette("get_power_corrected_AG_regional", { - power_query <- get_power( - community = "AG", - lonlat = c(112.5, -55.5, 115.5, -50.5), - pars = "T2M", - dates = c("1983-01-01"), - temporal_average = "Daily" - ) + power_query <- get_power( + community = "AG", + lonlat = c(112.5, -55.5, 115.5, -50.5), + pars = "T2M", + dates = c("1983-01-01"), + temporal_average = "Daily" + ) - expect_equal(nrow(power_query), 77) - expect_equal( - unique(power_query$LAT), - c( - -55.25, - -54.75, - -54.25, - -53.75, - -53.25, - -52.75, - -52.25, - -51.75, - -51.25, - -50.75, - -50.25 - ) - ) - expect_equal( - unique(power_query$LON), - c(112.75, 113.25, 113.75, 114.25, 114.75, 115.25, 115.75) + expect_equal(nrow(power_query), 77) + expect_equal( + unique(power_query$LAT), + c( + -55.25, + -54.75, + -54.25, + -53.75, + -53.25, + -52.75, + -52.25, + -51.75, + -51.25, + -50.75, + -50.25 ) - expect_equal(power_query$YEAR[1], 1983) - expect_equal(power_query$MM[1], 1) - expect_equal(power_query$DD[1], 1) - expect_equal(power_query$DOY[1], 1) - expect_equal(power_query$YYYYMMDD[1], as.Date("1983-01-01")) - expect_equal(power_query$DOY[1], 1) - expect_equal(power_query$T2M[1], 3.28) - rm(power_query) - }) + ) + expect_equal(unique(power_query$LON), + c(112.75, 113.25, 113.75, 114.25, 114.75, 115.25, 115.75)) + expect_equal(power_query$YEAR[1], 1983) + expect_equal(power_query$MM[1], 1) + expect_equal(power_query$DD[1], 1) + expect_equal(power_query$DOY[1], 1) + expect_equal(power_query$YYYYMMDD[1], as.Date("1983-01-01")) + expect_equal(power_query$DOY[1], 1) + expect_equal(power_query$T2M[1], 3.28) + rm(power_query) }) test_that("get_power() returns global AG data for climatology", { skip_on_cran() - vcr::use_cassette("get_power_corrected_AG_climatology", { - power_query <- get_power( - community = "AG", - pars = "T2M", - temporal_average = "CLIMATOLOGY", - lonlat = "GLOBAL" - ) + power_query <- get_power( + community = "AG", + pars = "T2M", + temporal_average = "CLIMATOLOGY", + lonlat = "GLOBAL" + ) - expect_equal(nrow(power_query), 259200) - expect_equal(power_query$PARAMETER[1], "T2M") - expect_equal(power_query$LAT[259200], 89.75) - expect_equal(power_query$LAT[1], -89.75) - expect_equal(power_query$LON[259200], 179.75) - expect_equal(power_query$LON[1], -179.75) - expect_named( - power_query, - c( - "LON", - "LAT", - "PARAMETER", - "JAN", - "FEB", - "MAR", - "APR", - "MAY", - "JUN", - "JUL", - "AUG", - "SEP", - "OCT", - "NOV", - "DEC", - "ANN" - ) + expect_equal(nrow(power_query), 259200) + expect_equal(power_query$PARAMETER[1], "T2M") + expect_equal(power_query$LAT[259200], 89.75) + expect_equal(power_query$LAT[1], -89.75) + expect_equal(power_query$LON[259200], 179.75) + expect_equal(power_query$LON[1], -179.75) + expect_named( + power_query, + c( + "LON", + "LAT", + "PARAMETER", + "JAN", + "FEB", + "MAR", + "APR", + "MAY", + "JUN", + "JUL", + "AUG", + "SEP", + "OCT", + "NOV", + "DEC", + "ANN" ) - rm(power_query) - }) + ) + rm(power_query) }) test_that("get_power() stops if `temporal_average` not valid", { @@ -240,8 +229,7 @@ test_that("get_power() stops if `temporal_average` not valid", { }) test_that("get_power() stops if `temporal_average` != CLIMATOLOGY - when lonlat == GLOBAL", - { + when lonlat == GLOBAL", { expect_error( power_query <- get_power( community = "AG", diff --git a/tests/testthat/test-internal_functions.R b/tests/testthat/test-internal_functions.R index 6620673f..bbd39192 100644 --- a/tests/testthat/test-internal_functions.R +++ b/tests/testthat/test-internal_functions.R @@ -101,8 +101,7 @@ test_that("Dates are returned as a vector of characters", { test_that( "If temporal_average == INTERANNUAL and dates are specified, that only years - are returned", - { + are returned", { temporal_average <- "INTERANNUAL" dates <- c("1983-01-01", "1984-01-01") lonlat <- c(-179.5, -89.5) @@ -112,8 +111,7 @@ test_that( } ) -test_that("If temporal_average == INTERANNUAL and <2 dates provided, error", - { +test_that("If temporal_average == INTERANNUAL and <2 dates provided, error", { temporal_average <- "INTERANNUAL" dates <- c("1983-01-01") lonlat <- c(-179.5, -89.5) @@ -258,8 +256,7 @@ test_that(".check_lonlat() checks validity of bbox lonmax values", { test_that( ".check_lonlat() returns message with proper identifier when valid - coordinates are given", - { + coordinates are given", { temporal_average <- "DAILY" test <- .check_lonlat(lonlat = c(-179.5, 88.5, @@ -303,8 +300,7 @@ test_that(".check_pars() stops if `pars` not valid", { }) test_that(".check_pars() stops if `pars` not valid for given - temporal_average", - { + temporal_average", { pars <- "ALLSKY_SFC_SW_DWN_03_GMT" temporal_average <- "INTERANNUAL" lonlat <- c(-179.5, -89.5) @@ -346,8 +342,7 @@ test_that("Only 3 pars are allowed when `temporal_average` = CLIMATOLOGY", { ) }) -test_that("Only 20 pars are allowed when `temporal_average` != CLIMATOLOGY", - { +test_that("Only 20 pars are allowed when `temporal_average` != CLIMATOLOGY", { pars <- c( "ALLSKY_SFC_LW_DWN", "ALLSKY_TOA_SW_DWN", @@ -393,8 +388,7 @@ test_that("Only unique `pars` are queried", { }) test_that("If an invalid temporal average is given for `pars`, - an error occurs", - { + an error occurs", { pars <- "ALLSKY_SFC_SW_DWN_00_GMT" temporal_average <- "DAILY" lonlat <- c(-179.5, -89.5) @@ -403,8 +397,7 @@ test_that("If an invalid temporal average is given for `pars`, # query constructs ------------------------------------------------------------- test_that(".build_query assembles a proper query for single point and != NULL - dates", - { + dates", { temporal_average <- "DAILY" dates <- c("1983-01-01", "1983-02-02") lonlat <- c(-179.5, -89.5) @@ -451,8 +444,7 @@ test_that(".build_query assembles a proper query for single point and != NULL test_that(".build_query assembles a proper query for single point and NULL - dates", - { + dates", { temporal_average <- "CLIMATOLOGY" dates <- NULL lonlat <- c(-179.5, -89.5) @@ -495,8 +487,7 @@ test_that(".build_query assembles a proper query for single point and NULL }) test_that(".build_query assembles a proper query for regional and != NULL - dates", - { + dates", { temporal_average <- "DAILY" dates <- c("1983-01-01", "1983-02-02") lonlat <- c(112.5, -55.5, 115.5, -50.5) @@ -539,8 +530,7 @@ test_that(".build_query assembles a proper query for regional and != NULL ) }) -test_that(".build_query assembles a proper query for regional and NULL dates", - { +test_that(".build_query assembles a proper query for regional and NULL dates", { temporal_average <- "CLIMATOLOGY" dates <- NULL lonlat <- c(112.5, -55.5, 115.5, -50.5)