From 5a396fc5f7f8d92523755202e08ca9e4077877fe Mon Sep 17 00:00:00 2001 From: mitchellmanware Date: Mon, 26 Feb 2024 15:47:11 -0500 Subject: [PATCH 01/10] NULL path default; 'SKIP' EPA TRI download test --- R/download.R | 52 ++++++++++++------------ R/process.R | 21 +++++----- tests/testthat/test-download_functions.R | 2 +- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/R/download.R b/R/download.R index ee4d5473..25668358 100644 --- a/R/download.R +++ b/R/download.R @@ -131,8 +131,8 @@ download_aqs_data <- year_start = 2018, year_end = 2022, resolution_temporal = "daily", - directory_to_download = "./input/aqs/", - directory_to_save = "./input/aqs/", + directory_to_download + directory_to_save, url_aqs_download = "https://aqs.epa.gov/aqsweb/airdata/", data_download_acknowledgement = FALSE, unzip = TRUE, @@ -144,7 +144,7 @@ download_aqs_data <- data_download_acknowledgement = data_download_acknowledgement ) - #### 2. check for null parameteres + #### 2. check for null parameters check_for_null_parameters(mget(ls())) #### 3. directory setup directory_to_download <- download_sanitize_path(directory_to_download) @@ -284,8 +284,8 @@ download_aqs_data <- #' @importFrom utils download.file #' @export download_ecoregion_data <- function( - directory_to_download = "./input/ecoregions/", - directory_to_save = "./input/ecoregions/", + directory_to_download, + directory_to_save, data_download_acknowledgement = FALSE, unzip = TRUE, remove_zip = FALSE, @@ -388,7 +388,7 @@ download_ecoregion_data <- function( # nolint start #' Download atmospheric composition data from the NASA Global Earth Observing System (GEOS) model. #' @description -#' The \code{download_goes_cf_data()} function accesses and downloads various +#' The \code{download_geos_data()} function accesses and downloads various #' atmospheric composition collections from the [NASA Global Earth Observing System (GEOS) model](https://gmao.gsfc.nasa.gov/GEOS_systems/). # nolint end #' @param date_start character(1). length of 10. Start date for downloading @@ -409,7 +409,7 @@ download_ecoregion_data <- function( #' @author Mitchell Manware, Insang Song #' @return NULL; #' @export -download_geos_cf_data <- function( +download_geos_data <- function( date_start = "2023-09-01", date_end = "2023-09-01", collection = @@ -418,7 +418,7 @@ download_geos_cf_data <- function( "met_tavg_1hr_g1440x721_x1", "xgc_tavg_1hr_g1440x721_x1", "chm_inst_1hr_g1440x721_p23", "met_inst_1hr_g1440x721_p23" ), - directory_to_save = "./input/data/geos_cf/", + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, remove_command = FALSE) { @@ -556,8 +556,8 @@ download_gmted_data <- function( "Standard Deviation Statistic" ), resolution = c("7.5 arc-seconds", "15 arc-seconds", "30 arc-seconds"), - directory_to_download = "./input/gmted/", - directory_to_save = "./input/gmted/", + directory_to_download, + directory_to_save, data_download_acknowledgement = FALSE, unzip = TRUE, remove_zip = FALSE, @@ -705,7 +705,7 @@ download_merra2_data <- function( "tavg3_3d_qdt_Np", "tavg3_3d_asm_Nv", "tavg3_3d_cld_Nv", "tavg3_3d_mst_Nv", "tavg3_3d_rad_Nv", "tavg3_2d_glc_Nx" ), - directory_to_save = "./input/merra2/", + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, remove_command = FALSE) { @@ -978,7 +978,7 @@ download_narr_monolevel_data <- function( year_start = 2022, year_end = 2022, variables = NULL, - directory_to_save = "./input/narr/", + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, remove_command = FALSE) { @@ -1101,7 +1101,7 @@ download_narr_p_levels_data <- function( year_start = 2022, year_end = 2022, variables = NULL, - directory_to_save = "./input/narr/", + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, remove_command = FALSE) { @@ -1235,8 +1235,8 @@ download_narr_p_levels_data <- function( download_nlcd_data <- function( year = 2021, collection = "Coterminous United States", - directory_to_download = "./input/nlcd/", - directory_to_save = "./input/nlcd/", + directory_to_download, + directory_to_save, data_download_acknowledgement = FALSE, unzip = TRUE, remove_zip = FALSE, @@ -1376,8 +1376,8 @@ download_nlcd_data <- function( download_sedac_groads_data <- function( data_format = c("Shapefile", "Geodatabase"), data_region = c("Americas", "Global", "Africa", "Asia", "Europe", "Oceania East", "Oceania West"), - directory_to_download = "./input/sedac_groads/", - directory_to_save = "./input/sedac_groads/", + directory_to_download, + directory_to_save, data_download_acknowledgement = FALSE, unzip = TRUE, remove_zip = FALSE, @@ -1518,8 +1518,8 @@ download_sedac_population_data <- function( year = "2020", data_format = c("GeoTIFF", "ASCII", "netCDF"), data_resolution = "60 minute", - directory_to_download = "./input/sedac_population/", - directory_to_save = "./input/sedac_population/", + directory_to_download, + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, unzip = TRUE, @@ -1699,8 +1699,8 @@ download_hms_data <- function( date_start = "2023-09-01", date_end = "2023-09-01", data_format = "Shapefile", - directory_to_download = "./input/noaa_hms/", - directory_to_save = "./input/noaa_hms/", + directory_to_download, + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, remove_command = FALSE, @@ -1865,8 +1865,8 @@ download_hms_data <- function( download_koppen_geiger_data <- function( time_period = c("Present", "Future"), data_resolution = c("0.0083", "0.083", "0.5"), - directory_to_download = "./input/koppen_geiger/", - directory_to_save = "./input/koppen_geiger/", + directory_to_download, + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, unzip = TRUE, @@ -2039,7 +2039,7 @@ download_modis_data <- function( horizontal_tiles = c(7, 13), vertical_tiles = c(3, 6), nasa_earth_data_token = NULL, - directory_to_save = "./input/modis/raw/", + directory_to_save, data_download_acknowledgement = FALSE, mod06_links = NULL, download = TRUE, @@ -2325,7 +2325,7 @@ download_modis_data <- function( download_tri_data <- function( year_start = 2018L, year_end = 2022L, - directory_to_save = "./input/tri/", + directory_to_save =, data_download_acknowledgement = FALSE, download = FALSE, remove_command = FALSE @@ -2421,7 +2421,7 @@ download_tri_data <- function( #' @returns NULL; Two comma-separated value (CSV) raw files for 2017 and 2020 #' @export download_nei_data <- function( - directory_to_save = "./input/nei/", + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, remove_command = FALSE, diff --git a/R/process.R b/R/process.R index c0887f0f..d9632acd 100644 --- a/R/process.R +++ b/R/process.R @@ -472,9 +472,10 @@ process_modis_swath <- #' @export process_koppen_geiger <- function( - path = "./input/koppen_geiger/raw/Beck_KG_V1_present_0p0083.tif", + path, year = NULL ) { + kg_rast <- terra::rast(path) return(kg_rast) } @@ -530,7 +531,7 @@ process_nlcd <- #' @export process_ecoregion <- function( - path = "./input/data/ecoregions/raw/us_eco_l3_state_boundaries.shp" + path, ) { ecoreg <- terra::vect(path) ecoreg <- ecoreg[, grepl("^(L2_KEY|L3_KEY)", names(ecoreg))] @@ -567,8 +568,7 @@ process_conformity <- locs_epsg <- locs$crs_dt } else { if (!all(keyword %in% names(locs))) { - stop("locs should be stdt or -have 'lon', 'lat', (and 'time') fields.\n") + stop("locs should be stdt or have 'lon', 'lat', (and 'time') fields.\n") } if (!methods::is(locs, "SpatVector")) { if (methods::is(locs, "sf")) { @@ -624,7 +624,7 @@ have 'lon', 'lat', (and 'time') fields.\n") #' @importFrom stats setNames #' @export process_tri <- function( - path = "./input/tri/", + path, year = 2018, variables = c(1, 13, 12, 14, 20, 34, 36, 47, 48, 49), ... @@ -786,7 +786,8 @@ process_nei <- function( #' @importFrom terra rast #' @export process_sedac_population <- function( - path = "./input/sedac_population/raw/") { + path +) { if (substr(path, nchar(path) - 2, nchar(path)) == ".nc") { cat(paste0("netCDF functionality for SEDAC data is under construction.\n")) return() @@ -851,7 +852,7 @@ process_hms <- function( date_start = "2018-01-01", date_end = "2018-01-01", variable = c("Light", "Medium", "Heavy"), - path = "./input/noaa_hms/raw/") { + path) { #### directory setup path <- download_sanitize_path(path) #### check for variable @@ -1005,7 +1006,7 @@ process_hms <- function( #' @export process_gmted <- function( variable = NULL, - path = "../../data/covariates/gmted/") { + path) { #### directory setup path <- download_sanitize_path(path) #### check for variable @@ -1084,7 +1085,7 @@ process_narr <- function( date_start = "2023-09-01", date_end = "2023-09-01", variable = NULL, - path = "../../data/covariates/narr/") { + path) { #### directory setup path <- download_sanitize_path(path) #### check for variable @@ -1242,7 +1243,7 @@ process_geos <- function(date_start = "2018-01-01", date_end = "2018-01-01", variable = NULL, - path = "../../data/covariates/geos_cf/") { + path) { #### directory setup path <- download_sanitize_path(path) #### check for variable diff --git a/tests/testthat/test-download_functions.R b/tests/testthat/test-download_functions.R index 785fc33e..ff0619d3 100644 --- a/tests/testthat/test-download_functions.R +++ b/tests/testthat/test-download_functions.R @@ -998,7 +998,7 @@ testthat::test_that("EPA TRI download URLs have HTTP status 200.", { # extract urls urls <- extract_urls(commands = commands, position = 3) # check HTTP URL status - url_status <- check_urls(urls = urls, size = 1L, method = "GET") + url_status <- check_urls(urls = urls, size = 1L, method = "SKIP") # implement unit tests test_download_functions(directory_to_save = directory_to_save, commands_path = commands_path, From 18f90932e927800b4674e5545de8be3012a7d658 Mon Sep 17 00:00:00 2001 From: mitchellmanware Date: Tue, 27 Feb 2024 07:32:31 -0500 Subject: [PATCH 02/10] rename download_geos_data; live download unit test --- NAMESPACE | 2 +- R/download.R | 4 +- R/process.R | 4 +- man/download_aqs_data.Rd | 4 +- man/download_ecoregion_data.Rd | 4 +- ..._geos_cf_data.Rd => download_geos_data.Rd} | 10 +-- man/download_gmted_data.Rd | 4 +- man/download_hms_data.Rd | 4 +- man/download_koppen_geiger_data.Rd | 4 +- man/download_merra2_data.Rd | 2 +- man/download_modis_data.Rd | 2 +- man/download_narr_monolevel_data.Rd | 2 +- man/download_narr_p_levels_data.Rd | 2 +- man/download_nei_data.Rd | 2 +- man/download_nlcd_data.Rd | 4 +- man/download_sedac_groads_data.Rd | 4 +- man/download_sedac_population_data.Rd | 4 +- man/download_tri_data.Rd | 2 +- man/process_ecoregion.Rd | 4 +- man/process_geos.Rd | 2 +- man/process_gmted.Rd | 2 +- man/process_hms.Rd | 2 +- man/process_koppen_geiger.Rd | 5 +- man/process_narr.Rd | 2 +- man/process_sedac_population.Rd | 2 +- man/process_tri.Rd | 2 +- tests/testthat/test-download_functions.R | 75 ++++++++++++++++++- 27 files changed, 114 insertions(+), 46 deletions(-) rename man/{download_geos_cf_data.Rd => download_geos_data.Rd} (89%) diff --git a/NAMESPACE b/NAMESPACE index d20bfbae..feb6e439 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -30,7 +30,7 @@ export(download_aqs_data) export(download_data) export(download_ecoregion_data) export(download_epa_certificate) -export(download_geos_cf_data) +export(download_geos_data) export(download_gmted_data) export(download_hms_data) export(download_koppen_geiger_data) diff --git a/R/download.R b/R/download.R index 25668358..e33cd0b9 100644 --- a/R/download.R +++ b/R/download.R @@ -131,7 +131,7 @@ download_aqs_data <- year_start = 2018, year_end = 2022, resolution_temporal = "daily", - directory_to_download + directory_to_download, directory_to_save, url_aqs_download = "https://aqs.epa.gov/aqsweb/airdata/", data_download_acknowledgement = FALSE, @@ -2325,7 +2325,7 @@ download_modis_data <- function( download_tri_data <- function( year_start = 2018L, year_end = 2022L, - directory_to_save =, + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, remove_command = FALSE diff --git a/R/process.R b/R/process.R index d9632acd..983d4ee1 100644 --- a/R/process.R +++ b/R/process.R @@ -531,7 +531,7 @@ process_nlcd <- #' @export process_ecoregion <- function( - path, + path ) { ecoreg <- terra::vect(path) ecoreg <- ecoreg[, grepl("^(L2_KEY|L3_KEY)", names(ecoreg))] @@ -1220,7 +1220,7 @@ process_narr <- function( } #' Import and clean GEOS-CF data downloaded with -#' `download_geos_cf_data` or `download_data(dataset_name = "geos")`. Function +#' `download_geos_data` or `download_data(dataset_name = "geos")`. Function #' returns a SpatRast object containing the user-defined variables of interest. #' Layer names indicate the variable, pressure level, date (YYYYMMDD), and, if #' applicable, the hour (HHMMSS). diff --git a/man/download_aqs_data.Rd b/man/download_aqs_data.Rd index 78a32bd9..4e591196 100644 --- a/man/download_aqs_data.Rd +++ b/man/download_aqs_data.Rd @@ -9,8 +9,8 @@ download_aqs_data( year_start = 2018, year_end = 2022, resolution_temporal = "daily", - directory_to_download = "./input/aqs/", - directory_to_save = "./input/aqs/", + directory_to_download, + directory_to_save, url_aqs_download = "https://aqs.epa.gov/aqsweb/airdata/", data_download_acknowledgement = FALSE, unzip = TRUE, diff --git a/man/download_ecoregion_data.Rd b/man/download_ecoregion_data.Rd index 390d6971..a738774a 100644 --- a/man/download_ecoregion_data.Rd +++ b/man/download_ecoregion_data.Rd @@ -5,8 +5,8 @@ \title{Download Ecoregion Shapefiles from EPA} \usage{ download_ecoregion_data( - directory_to_download = "./input/ecoregions/", - directory_to_save = "./input/ecoregions/", + directory_to_download, + directory_to_save, data_download_acknowledgement = FALSE, unzip = TRUE, remove_zip = FALSE, diff --git a/man/download_geos_cf_data.Rd b/man/download_geos_data.Rd similarity index 89% rename from man/download_geos_cf_data.Rd rename to man/download_geos_data.Rd index 41313cfd..ddb8d6a2 100644 --- a/man/download_geos_cf_data.Rd +++ b/man/download_geos_data.Rd @@ -1,16 +1,16 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/download.R -\name{download_geos_cf_data} -\alias{download_geos_cf_data} +\name{download_geos_data} +\alias{download_geos_data} \title{Download atmospheric composition data from the NASA Global Earth Observing System (GEOS) model.} \usage{ -download_geos_cf_data( +download_geos_data( date_start = "2023-09-01", date_end = "2023-09-01", collection = c("aqc_tavg_1hr_g1440x721_v1", "chm_tavg_1hr_g1440x721_v1", "met_tavg_1hr_g1440x721_x1", "xgc_tavg_1hr_g1440x721_x1", "chm_inst_1hr_g1440x721_p23", "met_inst_1hr_g1440x721_p23"), - directory_to_save = "./input/data/geos_cf/", + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, remove_command = FALSE @@ -43,7 +43,7 @@ the text file containing download commands.} NULL; } \description{ -The \code{download_goes_cf_data()} function accesses and downloads various +The \code{download_geos_data()} function accesses and downloads various atmospheric composition collections from the \href{https://gmao.gsfc.nasa.gov/GEOS_systems/}{NASA Global Earth Observing System (GEOS) model}. } \author{ diff --git a/man/download_gmted_data.Rd b/man/download_gmted_data.Rd index 5cb60bc4..ded284c7 100644 --- a/man/download_gmted_data.Rd +++ b/man/download_gmted_data.Rd @@ -9,8 +9,8 @@ download_gmted_data( "Minimum Statistic", "Mean Statistic", "Maximum Statistic", "Standard Deviation Statistic"), resolution = c("7.5 arc-seconds", "15 arc-seconds", "30 arc-seconds"), - directory_to_download = "./input/gmted/", - directory_to_save = "./input/gmted/", + directory_to_download, + directory_to_save, data_download_acknowledgement = FALSE, unzip = TRUE, remove_zip = FALSE, diff --git a/man/download_hms_data.Rd b/man/download_hms_data.Rd index c9545b68..45826d9c 100644 --- a/man/download_hms_data.Rd +++ b/man/download_hms_data.Rd @@ -8,8 +8,8 @@ download_hms_data( date_start = "2023-09-01", date_end = "2023-09-01", data_format = "Shapefile", - directory_to_download = "./input/noaa_hms/", - directory_to_save = "./input/noaa_hms/", + directory_to_download, + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, remove_command = FALSE, diff --git a/man/download_koppen_geiger_data.Rd b/man/download_koppen_geiger_data.Rd index c145c2f2..aee72251 100644 --- a/man/download_koppen_geiger_data.Rd +++ b/man/download_koppen_geiger_data.Rd @@ -7,8 +7,8 @@ download_koppen_geiger_data( time_period = c("Present", "Future"), data_resolution = c("0.0083", "0.083", "0.5"), - directory_to_download = "./input/koppen_geiger/", - directory_to_save = "./input/koppen_geiger/", + directory_to_download, + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, unzip = TRUE, diff --git a/man/download_merra2_data.Rd b/man/download_merra2_data.Rd index e028b3df..f6a3cf59 100644 --- a/man/download_merra2_data.Rd +++ b/man/download_merra2_data.Rd @@ -18,7 +18,7 @@ download_merra2_data( "tavg3_3d_mst_Np", "tavg3_3d_rad_Np", "tavg3_3d_tdt_Np", "tavg3_3d_trb_Np", "tavg3_3d_udt_Np", "tavg3_3d_odt_Np", "tavg3_3d_qdt_Np", "tavg3_3d_asm_Nv", "tavg3_3d_cld_Nv", "tavg3_3d_mst_Nv", "tavg3_3d_rad_Nv", "tavg3_2d_glc_Nx"), - directory_to_save = "./input/merra2/", + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, remove_command = FALSE diff --git a/man/download_modis_data.Rd b/man/download_modis_data.Rd index 4cf6368e..37d30af0 100644 --- a/man/download_modis_data.Rd +++ b/man/download_modis_data.Rd @@ -12,7 +12,7 @@ download_modis_data( horizontal_tiles = c(7, 13), vertical_tiles = c(3, 6), nasa_earth_data_token = NULL, - directory_to_save = "./input/modis/raw/", + directory_to_save, data_download_acknowledgement = FALSE, mod06_links = NULL, download = TRUE, diff --git a/man/download_narr_monolevel_data.Rd b/man/download_narr_monolevel_data.Rd index ed7a2545..ef0c01dd 100644 --- a/man/download_narr_monolevel_data.Rd +++ b/man/download_narr_monolevel_data.Rd @@ -8,7 +8,7 @@ download_narr_monolevel_data( year_start = 2022, year_end = 2022, variables = NULL, - directory_to_save = "./input/narr/", + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, remove_command = FALSE diff --git a/man/download_narr_p_levels_data.Rd b/man/download_narr_p_levels_data.Rd index f96f2893..51b312ab 100644 --- a/man/download_narr_p_levels_data.Rd +++ b/man/download_narr_p_levels_data.Rd @@ -8,7 +8,7 @@ download_narr_p_levels_data( year_start = 2022, year_end = 2022, variables = NULL, - directory_to_save = "./input/narr/", + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, remove_command = FALSE diff --git a/man/download_nei_data.Rd b/man/download_nei_data.Rd index 376f2b70..c818576c 100644 --- a/man/download_nei_data.Rd +++ b/man/download_nei_data.Rd @@ -5,7 +5,7 @@ \title{Download data from EPA National Emission Inventory aggregated on-road emission data} \usage{ download_nei_data( - directory_to_save = "./input/nei/", + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, remove_command = FALSE, diff --git a/man/download_nlcd_data.Rd b/man/download_nlcd_data.Rd index 7714d025..c2927da2 100644 --- a/man/download_nlcd_data.Rd +++ b/man/download_nlcd_data.Rd @@ -7,8 +7,8 @@ download_nlcd_data( year = 2021, collection = "Coterminous United States", - directory_to_download = "./input/nlcd/", - directory_to_save = "./input/nlcd/", + directory_to_download, + directory_to_save, data_download_acknowledgement = FALSE, unzip = TRUE, remove_zip = FALSE, diff --git a/man/download_sedac_groads_data.Rd b/man/download_sedac_groads_data.Rd index b8553f92..d8ee7b54 100644 --- a/man/download_sedac_groads_data.Rd +++ b/man/download_sedac_groads_data.Rd @@ -8,8 +8,8 @@ download_sedac_groads_data( data_format = c("Shapefile", "Geodatabase"), data_region = c("Americas", "Global", "Africa", "Asia", "Europe", "Oceania East", "Oceania West"), - directory_to_download = "./input/sedac_groads/", - directory_to_save = "./input/sedac_groads/", + directory_to_download, + directory_to_save, data_download_acknowledgement = FALSE, unzip = TRUE, remove_zip = FALSE, diff --git a/man/download_sedac_population_data.Rd b/man/download_sedac_population_data.Rd index fd1dcb74..5af0af79 100644 --- a/man/download_sedac_population_data.Rd +++ b/man/download_sedac_population_data.Rd @@ -8,8 +8,8 @@ download_sedac_population_data( year = "2020", data_format = c("GeoTIFF", "ASCII", "netCDF"), data_resolution = "60 minute", - directory_to_download = "./input/sedac_population/", - directory_to_save = "./input/sedac_population/", + directory_to_download, + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, unzip = TRUE, diff --git a/man/download_tri_data.Rd b/man/download_tri_data.Rd index 5a613aa4..e2c44538 100644 --- a/man/download_tri_data.Rd +++ b/man/download_tri_data.Rd @@ -7,7 +7,7 @@ download_tri_data( year_start = 2018L, year_end = 2022L, - directory_to_save = "./input/tri/", + directory_to_save, data_download_acknowledgement = FALSE, download = FALSE, remove_command = FALSE diff --git a/man/process_ecoregion.Rd b/man/process_ecoregion.Rd index bb6043d6..dea4cf5e 100644 --- a/man/process_ecoregion.Rd +++ b/man/process_ecoregion.Rd @@ -4,9 +4,7 @@ \alias{process_ecoregion} \title{Process EPA Ecoregion shapefiles} \usage{ -process_ecoregion( - path = "./input/data/ecoregions/raw/us_eco_l3_state_boundaries.shp" -) +process_ecoregion(path) } \arguments{ \item{path}{character(1). Path to Ecoregion Shapefiles} diff --git a/man/process_geos.Rd b/man/process_geos.Rd index b5c168bf..785223be 100644 --- a/man/process_geos.Rd +++ b/man/process_geos.Rd @@ -12,7 +12,7 @@ process_geos( date_start = "2018-01-01", date_end = "2018-01-01", variable = NULL, - path = "../../data/covariates/geos_cf/" + path ) } \arguments{ diff --git a/man/process_gmted.Rd b/man/process_gmted.Rd index 1eff5acf..1d5c13c7 100644 --- a/man/process_gmted.Rd +++ b/man/process_gmted.Rd @@ -8,7 +8,7 @@ Function returns a SpatRast object containing the user-defined variable of interest at specified resolution. Layer name indicates variable and resolution.} \usage{ -process_gmted(variable = NULL, path = "../../data/covariates/gmted/") +process_gmted(variable = NULL, path) } \arguments{ \item{variable}{vector(1). Vector containing the GMTED statistic first and diff --git a/man/process_hms.Rd b/man/process_hms.Rd index aabe0a7b..da0d4608 100644 --- a/man/process_hms.Rd +++ b/man/process_hms.Rd @@ -9,7 +9,7 @@ process_hms( date_start = "2018-01-01", date_end = "2018-01-01", variable = c("Light", "Medium", "Heavy"), - path = "./input/noaa_hms/raw/" + path ) } \arguments{ diff --git a/man/process_koppen_geiger.Rd b/man/process_koppen_geiger.Rd index cb363f7c..0284d413 100644 --- a/man/process_koppen_geiger.Rd +++ b/man/process_koppen_geiger.Rd @@ -4,10 +4,7 @@ \alias{process_koppen_geiger} \title{Process Koeppen-Geiger climate data} \usage{ -process_koppen_geiger( - path = "./input/koppen_geiger/raw/Beck_KG_V1_present_0p0083.tif", - year = NULL -) +process_koppen_geiger(path, year = NULL) } \arguments{ \item{path}{character(1). Path to Koppen-Geiger diff --git a/man/process_narr.Rd b/man/process_narr.Rd index eed35734..fb9b2979 100644 --- a/man/process_narr.Rd +++ b/man/process_narr.Rd @@ -12,7 +12,7 @@ process_narr( date_start = "2023-09-01", date_end = "2023-09-01", variable = NULL, - path = "../../data/covariates/narr/" + path ) } \arguments{ diff --git a/man/process_sedac_population.Rd b/man/process_sedac_population.Rd index 9e25f0ec..e5c01444 100644 --- a/man/process_sedac_population.Rd +++ b/man/process_sedac_population.Rd @@ -5,7 +5,7 @@ \title{Import and clean population data from NASA Socioeconomic Data and Applications Center (SEDAC).} \usage{ -process_sedac_population(path = "./input/sedac_population/raw/") +process_sedac_population(path) } \arguments{ \item{path}{character(1). Path to GeoTIFF or netCDF file.} diff --git a/man/process_tri.Rd b/man/process_tri.Rd index 3d44dbd9..2554437e 100644 --- a/man/process_tri.Rd +++ b/man/process_tri.Rd @@ -5,7 +5,7 @@ \title{Prepare Toxic Release Inventory (TRI) data} \usage{ process_tri( - path = "./input/tri/", + path, year = 2018, variables = c(1, 13, 12, 14, 20, 34, 36, 47, 48, 49), ... diff --git a/tests/testthat/test-download_functions.R b/tests/testthat/test-download_functions.R index ff0619d3..38bff0c0 100644 --- a/tests/testthat/test-download_functions.R +++ b/tests/testthat/test-download_functions.R @@ -1144,4 +1144,77 @@ testthat::test_that("epa certificate", { system.file("extdata/cacert_gaftp_epa.pem", package = "amadeus") ) ) -}) \ No newline at end of file +}) + +testthat::test_that("extract_urls returns NULL undefined position.", { + commands <- paste0( + "curl -s -o ", + "/PATH/hms_smoke_Shapefile_20230901.zip --url ", + "https://satepsanone.nesdis.noaa.gov/pub/FIRE/web/HMS/Smoke_Polygons/", + "Shapefile/2023/09/hms_smoke20230901.zip" + ) + urls <- extract_urls(commands = commands) + expect_true( + is.null(urls) + ) +}) + +testthat::test_that("check_urls returns NULL undefined size.", { + urls <- paste0( + "https://satepsanone.nesdis.noaa.gov/pub/FIRE/web/HMS/Smoke_Polygons/", + "Shapefile/2023/09/hms_smoke20230901.zip" + ) + url_status <- check_urls(urls = urls, method = "HEAD") + expect_true( + is.null(url_status) + ) +}) + +testthat::test_that("download_hms_data LIVE run.", { + # function parameters + date <- "2018-01-01" + directory <- testthat::test_path("..", "testdata", "hms_live") + # create file to be deleted + file.create( + testthat::test_path( + directory, + "hms_smoke_20180101_20180101_curl_commands.txt" + ) + ) + # run download function + download_data( + dataset_name = "hms", + date_start = date, + date_end = date, + directory_to_save = directory, + directory_to_download = directory, + data_download_acknowledgement = TRUE, + download = TRUE, + unzip = TRUE, + remove_zip = TRUE, + remove_command = FALSE + ) + expect_true( + length(list.files(directory)) == 5 + ) + commands <- list.files(directory, pattern = ".txt", full.names = TRUE) + expect_true( + file.exists(commands) + ) + Sys.sleep(1.5) + # remove directory + files <- list.files(directory, full.names = TRUE) + sapply(files, file.remove) + file.remove(directory) +}) + + + + + + + + + + + From 9277f97e53282ddbe8a30682d2e8ee7dfb870814 Mon Sep 17 00:00:00 2001 From: mitchellmanware Date: Tue, 27 Feb 2024 09:02:08 -0500 Subject: [PATCH 03/10] update download tests --- tests/testthat/test-download_functions.R | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/tests/testthat/test-download_functions.R b/tests/testthat/test-download_functions.R index 38bff0c0..e59e0f71 100644 --- a/tests/testthat/test-download_functions.R +++ b/tests/testthat/test-download_functions.R @@ -1175,10 +1175,11 @@ testthat::test_that("download_hms_data LIVE run.", { date <- "2018-01-01" directory <- testthat::test_path("..", "testdata", "hms_live") # create file to be deleted + dir.create(directory) file.create( - testthat::test_path( + paste0( directory, - "hms_smoke_20180101_20180101_curl_commands.txt" + "/hms_smoke_20180101_20180101_curl_commands.txt" ) ) # run download function @@ -1207,14 +1208,3 @@ testthat::test_that("download_hms_data LIVE run.", { sapply(files, file.remove) file.remove(directory) }) - - - - - - - - - - - From 61f8bdde9d3dc9f9298e1e9e885fd3736d0fbce5 Mon Sep 17 00:00:00 2001 From: mitchellmanware Date: Tue, 27 Feb 2024 10:02:23 -0500 Subject: [PATCH 04/10] update invalid temporal range download tests --- tests/testthat/test-download_functions.R | 11 +++++---- .../testthat/test-manipulate_spacetime_data.R | 24 +++++++++++++++++++ 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/tests/testthat/test-download_functions.R b/tests/testthat/test-download_functions.R index e59e0f71..831262d3 100644 --- a/tests/testthat/test-download_functions.R +++ b/tests/testthat/test-download_functions.R @@ -35,7 +35,7 @@ testthat::test_that("Error when one parameter is NULL.", { testthat::test_that("Errors when temporal ranges invalid.", { expect_error( - download_geos_cf_data( + download_geos_data( date_start = "1900-01-01", collection = "aqc_tavg_1hr_g1440x721_v1", data_download_acknowledgement = TRUE, @@ -46,13 +46,14 @@ testthat::test_that("Errors when temporal ranges invalid.", { download_aqs_data( year_start = 1900, data_download_acknowledgement = TRUE, - directory_to_save = "../testdata" + directory_to_save = "../testdata", + directory_to_download = "../testdata" ) ) expect_error( download_narr_monolevel_data( year_start = 1900, - collection = "air.sfc", + variables = "air.sfc", data_download_acknowledgement = TRUE, directory_to_save = "../testdata" ) @@ -60,7 +61,7 @@ testthat::test_that("Errors when temporal ranges invalid.", { expect_error( download_narr_p_levels_data( year_start = 1900, - collection = "omega", + variables = "omega", data_download_acknowledgement = TRUE, directory_to_save = "../testdata" ) @@ -74,7 +75,7 @@ testthat::test_that("Errors when temporal ranges invalid.", { ) ) expect_error( - download_noaa_hms_smoke_data( + download_hms_data( date_start = "1900-01-01", directory_to_save = "../testdata", directory_to_download = "../testdata", diff --git a/tests/testthat/test-manipulate_spacetime_data.R b/tests/testthat/test-manipulate_spacetime_data.R index 7130c304..b42502c8 100644 --- a/tests/testthat/test-manipulate_spacetime_data.R +++ b/tests/testthat/test-manipulate_spacetime_data.R @@ -827,3 +827,27 @@ test_that("project_dt works as expected", { expect_s3_class(dfdtp, "data.table") }) + +testthat::test_that("tests for missing 'time' column across functions.", { + withr::local_package("terra") + withr::local_package("data.table") + locs <- data.frame(lon = -78.8277, lat = 35.95013) + locs$site_id <- "3799900018810101" + expect_error( + convert_stobj_to_stdt( + terra::vect(locs, geom = c("lon", "lat"), crs = "EPSG:4326") + ) + ) + expect_error( + sftime_as_mysftime( + locs, + "time" + ) + ) + expect_error( + dt_as_sftime( + data.table::data.table(locs), + "EPSG:4326" + ) + ) +}) From 6a1a6d193581c643aa0e268683554b5f8242b4b3 Mon Sep 17 00:00:00 2001 From: mitchellmanware Date: Tue, 27 Feb 2024 10:13:40 -0500 Subject: [PATCH 05/10] invalid year integer tests; wildfire smoke KML format tests --- tests/testthat/test-download_functions.R | 98 ++++++++++++++++-------- 1 file changed, 64 insertions(+), 34 deletions(-) diff --git a/tests/testthat/test-download_functions.R b/tests/testthat/test-download_functions.R index 831262d3..b1bb49bf 100644 --- a/tests/testthat/test-download_functions.R +++ b/tests/testthat/test-download_functions.R @@ -348,6 +348,19 @@ testthat::test_that("NARR monolevel download URLs have HTTP status 200.", { file.remove(commands_path) }) +testthat::test_that("NARR monolevel error with invalid years.", { + testthat::expect_error( + download_data( + dataset_name = "narr_monolevel", + variables = "weasd", + year_start = 10, + year_end = 11, + data_download_acknowledgement = TRUE, + directory_to_save = testthat::test_path("..", "testdata/", "") + ) + ) +}) + testthat::test_that("NARR p-levels download URLs have HTTP status 200.", { withr::local_package("httr") withr::local_package("stringr") @@ -391,36 +404,53 @@ testthat::test_that("NOAA HMS Smoke download URLs have HTTP status 200.", { date_end <- "2022-09-21" directory_to_download <- testthat::test_path("..", "testdata/", "") directory_to_save <- testthat::test_path("..", "testdata/", "") - # run download function - download_data(dataset_name = "smoke", - date_start = date_start, - date_end = date_end, - directory_to_download = directory_to_download, - directory_to_save = directory_to_save, - data_download_acknowledgement = TRUE, - download = FALSE, - remove_command = FALSE, - unzip = FALSE, - remove_zip = FALSE) - # define file path with commands - commands_path <- paste0(directory_to_download, - "hms_smoke_", - gsub("-", "", date_start), - "_", - gsub("-", "", date_end), - "_curl_commands.txt") - # import commands - commands <- read_commands(commands_path = commands_path) - # extract urls - urls <- extract_urls(commands = commands, position = 6) - # check HTTP URL status - url_status <- check_urls(urls = urls, size = 3L, method = "HEAD") - # implement unit tests - test_download_functions(directory_to_save = directory_to_save, - commands_path = commands_path, - url_status = url_status) - # remove file with commands after test - file.remove(commands_path) + data_formats <- c("Shapefile", "KML") + for (d in seq_along(data_formats)) { + # run download function + download_data(dataset_name = "smoke", + date_start = date_start, + date_end = date_end, + data_format = data_formats[d], + directory_to_download = directory_to_download, + directory_to_save = directory_to_save, + data_download_acknowledgement = TRUE, + download = FALSE, + remove_command = FALSE, + unzip = FALSE, + remove_zip = FALSE) + # define file path with commands + commands_path <- paste0(directory_to_download, + "hms_smoke_", + gsub("-", "", date_start), + "_", + gsub("-", "", date_end), + "_curl_commands.txt") + # import commands + commands <- read_commands(commands_path = commands_path) + # extract urls + urls <- extract_urls(commands = commands, position = 6) + # check HTTP URL status + url_status <- check_urls(urls = urls, size = 3L, method = "HEAD") + # implement unit tests + test_download_functions(directory_to_save = directory_to_save, + commands_path = commands_path, + url_status = url_status) + # remove file with commands after test + file.remove(commands_path) + } +}) + +testthat::test_that("download_hms_data error for unzip and directory.", { + testthat::expect_error( + download_data( + dataset_name = "hms", + data_download_acknowledgement = TRUE, + directory_to_save = testthat::test_path("..", "testdata/", ""), + directory_to_download = testthat::test_path("..", "testdata/", ""), + unzip = FALSE, + remove_zip = TRUE + ) + ) }) testthat::test_that("NLCD download URLs have HTTP status 200.", { @@ -1155,7 +1185,7 @@ testthat::test_that("extract_urls returns NULL undefined position.", { "Shapefile/2023/09/hms_smoke20230901.zip" ) urls <- extract_urls(commands = commands) - expect_true( + testthat::expect_true( is.null(urls) ) }) @@ -1166,7 +1196,7 @@ testthat::test_that("check_urls returns NULL undefined size.", { "Shapefile/2023/09/hms_smoke20230901.zip" ) url_status <- check_urls(urls = urls, method = "HEAD") - expect_true( + testthat::expect_true( is.null(url_status) ) }) @@ -1196,11 +1226,11 @@ testthat::test_that("download_hms_data LIVE run.", { remove_zip = TRUE, remove_command = FALSE ) - expect_true( + testthat::expect_true( length(list.files(directory)) == 5 ) commands <- list.files(directory, pattern = ".txt", full.names = TRUE) - expect_true( + testthat::expect_true( file.exists(commands) ) Sys.sleep(1.5) From 4668b8405a9d60c254d44a4464d8822e2df02a6a Mon Sep 17 00:00:00 2001 From: mitchellmanware Date: Tue, 27 Feb 2024 10:27:25 -0500 Subject: [PATCH 06/10] replace 'geos_cf' --- R/download.R | 4 ++-- tests/testthat/test-download_functions.R | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/R/download.R b/R/download.R index e33cd0b9..ce4e37bb 100644 --- a/R/download.R +++ b/R/download.R @@ -15,7 +15,7 @@ #' Please refer to: #' * \link{download_aqs_data}: "aqs", "AQS" #' * \link{download_ecoregion_data}: "ecoregion" -#' * \link{download_geos_cf_data}: "geos" +#' * \link{download_geos_data}: "geos" #' * \link{download_gmted_data}: "gmted", "GMTED" #' * \link{download_koppen_geiger_data}: "koppen", "koppengeiger" #' * \link{download_merra2_data}: "merra2", "merra", "MERRA", "MERRA2" @@ -49,7 +49,7 @@ download_data <- what_to_run <- switch(dataset_name, aqs = download_aqs_data, ecoregion = download_ecoregion_data, - geos = download_geos_cf_data, + geos = download_geos_data, gmted = download_gmted_data, koppen = download_koppen_geiger_data, koppengeiger = download_koppen_geiger_data, diff --git a/tests/testthat/test-download_functions.R b/tests/testthat/test-download_functions.R index b1bb49bf..1a4ae6dd 100644 --- a/tests/testthat/test-download_functions.R +++ b/tests/testthat/test-download_functions.R @@ -1,5 +1,5 @@ -#' @author Mitchell Manware -#' @description Unit test for for checking data download functions. +## test for download functions + testthat::test_that("Error when data_download_acknowledgement = FALSE", { download_datasets <- c("aqs", "ecoregion", "geos", "gmted", "koppen", "koppengeiger", "merra2", "merra", "narr_monolevel", @@ -39,15 +39,15 @@ testthat::test_that("Errors when temporal ranges invalid.", { date_start = "1900-01-01", collection = "aqc_tavg_1hr_g1440x721_v1", data_download_acknowledgement = TRUE, - directory_to_save = "../testdata" + directory_to_save = testthat::test_path("..", "testdata/", "") ) ) expect_error( download_aqs_data( year_start = 1900, data_download_acknowledgement = TRUE, - directory_to_save = "../testdata", - directory_to_download = "../testdata" + directory_to_save = testthat::test_path("..", "testdata/", ""), + directory_to_download = testthat::test_path("..", "testdata/", "") ) ) expect_error( @@ -55,7 +55,7 @@ testthat::test_that("Errors when temporal ranges invalid.", { year_start = 1900, variables = "air.sfc", data_download_acknowledgement = TRUE, - directory_to_save = "../testdata" + directory_to_save = testthat::test_path("..", "testdata/", "") ) ) expect_error( @@ -63,22 +63,22 @@ testthat::test_that("Errors when temporal ranges invalid.", { year_start = 1900, variables = "omega", data_download_acknowledgement = TRUE, - directory_to_save = "../testdata" + directory_to_save = testthat::test_path("..", "testdata/", "") ) ) expect_error( download_merra2_data( date_start = "1900-01-01", collection = "inst1_2d_asm_Nx", - directory_to_save = "../testdata", + directory_to_save = testthat::test_path("..", "testdata/", ""), data_download_acknowledgement = TRUE ) ) expect_error( download_hms_data( date_start = "1900-01-01", - directory_to_save = "../testdata", - directory_to_download = "../testdata", + directory_to_save = testthat::test_path("..", "testdata/", ""), + directory_to_download = testthat::test_path("..", "testdata/", ""), data_download_acknowledgement = TRUE ) ) @@ -642,8 +642,8 @@ testthat::test_that("SEDAC population data types are coerced.", { year <- c("totpop") data_formats <- c("GeoTIFF", "ASCII", "netCDF") data_resolutions <- c("30 second", "2pt5_min") - directory_to_download <- "../testdata/" - directory_to_save <- "../testdata/" + directory_to_download <- testthat::test_path("..", "testdata/", "") + directory_to_save <- testthat::test_path("..", "testdata/", "") for (f in seq_along(data_formats)) { download_data(dataset_name = "sedac_population", year = year, From e6d4732a0791a36752d96e019bcb94c7b41a2f56 Mon Sep 17 00:00:00 2001 From: mitchellmanware Date: Tue, 27 Feb 2024 11:17:52 -0500 Subject: [PATCH 07/10] remove if(download) trigger from GMTED and ecoregion download functions --- R/download.R | 50 +++++++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/R/download.R b/R/download.R index ce4e37bb..1fbe65f7 100644 --- a/R/download.R +++ b/R/download.R @@ -370,19 +370,17 @@ download_ecoregion_data <- function( #### 14. remove download command download_remove_command(commands_txt = commands_txt, remove = remove_command) - if (download) { - #### 15. unzip files - download_unzip( - file_name = download_name, - directory_to_unzip = directory_to_save, - unzip = unzip - ) - #### 16. remove zip files - download_remove_zips( - remove = remove_zip, - download_name = download_name - ) - } + #### 15. unzip files + download_unzip( + file_name = download_name, + directory_to_unzip = directory_to_save, + unzip = unzip + ) + #### 16. remove zip files + download_remove_zips( + remove = remove_zip, + download_name = download_name + ) } # nolint start @@ -643,24 +641,22 @@ download_gmted_data <- function( download = download, system_command = system_command ) - #### 18. Remove command file + #### 17. Remove command file download_remove_command( commands_txt = commands_txt, remove = remove_command ) - if (download) { - #### 17. end if unzip == FALSE - download_unzip( - file_name = download_name, - directory_to_unzip = directory_to_save, - unzip = unzip - ) - #### 19. remove zip files - download_remove_zips( - remove = remove_zip, - download_name = download_name - ) - } + #### 18. end if unzip == FALSE + download_unzip( + file_name = download_name, + directory_to_unzip = directory_to_save, + unzip = unzip + ) + #### 19. remove zip files + download_remove_zips( + remove = remove_zip, + download_name = download_name + ) } # nolint start From 2078a860b99bb7fefeae0ade22eb228d1e9ffd54 Mon Sep 17 00:00:00 2001 From: mitchellmanware Date: Wed, 28 Feb 2024 16:42:31 -0500 Subject: [PATCH 08/10] covariate tests --- R/process.R | 3 +-- tests/testthat/test-calculate_covariates.R | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/R/process.R b/R/process.R index 983d4ee1..99170554 100644 --- a/R/process.R +++ b/R/process.R @@ -475,7 +475,6 @@ process_koppen_geiger <- path, year = NULL ) { - kg_rast <- terra::rast(path) return(kg_rast) } @@ -786,7 +785,7 @@ process_nei <- function( #' @importFrom terra rast #' @export process_sedac_population <- function( - path + path ) { if (substr(path, nchar(path) - 2, nchar(path)) == ".nc") { cat(paste0("netCDF functionality for SEDAC data is under construction.\n")) diff --git a/tests/testthat/test-calculate_covariates.R b/tests/testthat/test-calculate_covariates.R index a80c00e0..164031f5 100644 --- a/tests/testthat/test-calculate_covariates.R +++ b/tests/testthat/test-calculate_covariates.R @@ -81,6 +81,22 @@ testthat::test_that("calc_dummies works well", { }) +testthat::test_that("calc_temporal_dummies errors.", { + withr::local_package("terra") + ncp <- data.frame(lon = -78.8277, lat = 35.95013) + ncp$site_id <- "3799900018810101" + testthat::expect_error( + calc_temporal_dummies( + ncp + ) + ) + testthat::expect_error( + calc_temporal_dummies( + terra::vect(ncp) + ) + ) +}) + testthat::test_that("calc_ecoregion works well", { withr::local_package("terra") withr::local_package("sf") From fe70f1cabbf943a0dffb272f1dd7e3d2137a1c9e Mon Sep 17 00:00:00 2001 From: mitchellmanware Date: Thu, 29 Feb 2024 11:29:46 -0500 Subject: [PATCH 09/10] all paths NULL --- R/download_test_support.R | 2 +- R/process.R | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/R/download_test_support.R b/R/download_test_support.R index d4790069..7d53a900 100644 --- a/R/download_test_support.R +++ b/R/download_test_support.R @@ -7,7 +7,7 @@ #' Check if sample of download URLs have HTTP Status 200 #' @param url Download URL to be checked. -#' @param method httr method to obtain URL (`"HEAD"`` or `"GET"`) +#' @param method httr method to obtain URL (`"HEAD"` or `"GET"`) #' @author Insang Song; Mitchell Manware #' @importFrom httr HEAD #' @importFrom httr GET diff --git a/R/process.R b/R/process.R index 45d1203f..589f930c 100644 --- a/R/process.R +++ b/R/process.R @@ -13,6 +13,7 @@ #' - [`process_nlcd`]: `"nlcd"`, `"NLCD"` #' - [`process_tri`]: `"tri"`, `"TRI"` #' - [`process_nei`]: `"nei"`, `"NEI` +#' - [`process_geos`]: `"geos"` #' - [`process_gmted`]: `"gmted"`, `"GMTED"` #' - [`process_aqs`]: `"aqs"`, `"AQS"` #' - [`process_hms`]: `"hms"`, `"HMS"`, `"smoke"` @@ -76,8 +77,12 @@ process_covariates <- }, error = function(e) { print(e) print(args(what_to_run)) - stop("Please refer to the argument list and -the error message above to rectify the error.\n") + stop( + paste0( + "Please refer to the argument list and the error message above to ", + "rectify the error.\n" + ) + ) }) return(res_covariate) @@ -618,7 +623,7 @@ process_nlcd <- #' @export process_ecoregion <- function( - path + path = NULL ) { ecoreg <- terra::vect(path) ecoreg <- ecoreg[, grepl("^(L2_KEY|L3_KEY)", names(ecoreg))] @@ -1317,7 +1322,7 @@ process_gmted <- function( process_narr <- function( date = c("2023-09-01", "2023-09-01"), variable = NULL, - path) { + path = NULL) { #### directory setup path <- download_sanitize_path(path) #### check for variable @@ -1473,7 +1478,7 @@ process_narr <- function( process_geos <- function(date = c("2018-01-01", "2018-01-01"), variable = NULL, - path) { + path = NULL) { #### directory setup path <- download_sanitize_path(path) #### check for variable From 00b77baf737a5d86dc11687f33f99f4a6f186bea Mon Sep 17 00:00:00 2001 From: mitchellmanware Date: Thu, 29 Feb 2024 11:32:39 -0500 Subject: [PATCH 10/10] update DESCRIPTION + documentation --- DESCRIPTION | 2 +- man/check_url_status.Rd | 2 +- man/process_covariates.Rd | 1 + man/process_ecoregion.Rd | 2 +- man/process_geos.Rd | 6 +++++- man/process_narr.Rd | 6 +++++- 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 300f4eea..7ada206b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: amadeus Title: AMADEUS: A Mechanism/Machine for Data, Environments, and User Setup -Version: 0.1.1 +Version: 0.1.2 Authors@R: c( person("Kyle", "Messier", , "kyle.messier@nih.gov", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9508-9623")), person("Mitchell", "Manware", role = c("aut", "ctb"), comment = c(ORCID = "0009-0003-6440-6106")), diff --git a/man/check_url_status.Rd b/man/check_url_status.Rd index 01e054c2..ebc20a52 100644 --- a/man/check_url_status.Rd +++ b/man/check_url_status.Rd @@ -9,7 +9,7 @@ check_url_status(url, method = c("HEAD", "GET")) \arguments{ \item{url}{Download URL to be checked.} -\item{method}{httr method to obtain URL (\verb{"HEAD"`` or }"GET"`)} +\item{method}{httr method to obtain URL (\code{"HEAD"} or \code{"GET"})} } \value{ logical object diff --git a/man/process_covariates.Rd b/man/process_covariates.Rd index 1c494837..564ea546 100644 --- a/man/process_covariates.Rd +++ b/man/process_covariates.Rd @@ -37,6 +37,7 @@ Process covariates \item \code{\link{process_nlcd}}: \code{"nlcd"}, \code{"NLCD"} \item \code{\link{process_tri}}: \code{"tri"}, \code{"TRI"} \item \code{\link{process_nei}}: \code{"nei"}, \verb{"NEI} +\item \item \code{\link{process_gmted}}: \code{"gmted"}, \code{"GMTED"} \item \code{\link{process_aqs}}: \code{"aqs"}, \code{"AQS"} \item \code{\link{process_hms}}: \code{"hms"}, \code{"HMS"}, \code{"smoke"} diff --git a/man/process_ecoregion.Rd b/man/process_ecoregion.Rd index dea4cf5e..0ebd3a1d 100644 --- a/man/process_ecoregion.Rd +++ b/man/process_ecoregion.Rd @@ -4,7 +4,7 @@ \alias{process_ecoregion} \title{Process EPA Ecoregion shapefiles} \usage{ -process_ecoregion(path) +process_ecoregion(path = NULL) } \arguments{ \item{path}{character(1). Path to Ecoregion Shapefiles} diff --git a/man/process_geos.Rd b/man/process_geos.Rd index 79c6ab3b..dfe90fa9 100644 --- a/man/process_geos.Rd +++ b/man/process_geos.Rd @@ -8,7 +8,11 @@ returns a SpatRast object containing the user-defined variables of interest. Layer names indicate the variable, pressure level, date (YYYYMMDD), and, if applicable, the hour (HHMMSS).} \usage{ -process_geos(date = c("2018-01-01", "2018-01-01"), variable = NULL, path) +process_geos( + date = c("2018-01-01", "2018-01-01"), + variable = NULL, + path = NULL +) } \arguments{ \item{date}{character(2). length of 10. Format "YYYY-MM-DD".} diff --git a/man/process_narr.Rd b/man/process_narr.Rd index 743c65f5..47f47e1b 100644 --- a/man/process_narr.Rd +++ b/man/process_narr.Rd @@ -8,7 +8,11 @@ Function returns a SpatRast object containing the user-defined variable of interest. Layer names indicate the variable, pressure level, and date (YYYYMMDD).} \usage{ -process_narr(date = c("2023-09-01", "2023-09-01"), variable = NULL, path) +process_narr( + date = c("2023-09-01", "2023-09-01"), + variable = NULL, + path = NULL +) } \arguments{ \item{date}{character(2). length of 10 each. Format "YYYY-MM-DD".}