Skip to content

Commit

Permalink
Outline get_power() with better comments
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhsparks committed Dec 9, 2024
1 parent 55dac2e commit b4453d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions R/get_power.R
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ get_power <- function(community = c("ag", "re", "sb"),
dates <- NULL
}

# check user inputs for validity ---------------------------------------------
# see internal_functions.R for these functions prefixed with "."
.check_inputs(
lonlat = lonlat,
Expand All @@ -230,7 +231,8 @@ get_power <- function(community = c("ag", "re", "sb"),
)
lonlat_identifier <- .check_lonlat(lonlat, pars)
dates <- .check_dates(dates, lonlat, temporal_api)
# submit query -------------------------------------------------------------

# submit query ---------------------------------------------------------------
query_list <- .build_query(
community,
lonlat_identifier,
Expand All @@ -253,6 +255,7 @@ get_power <- function(community = c("ag", "re", "sb"),

response$raise_for_status()

# extract query results and return to user -----------------------------------
# create meta object
power_data <- readr::read_lines(I(response$parse("UTF8")))

Expand Down Expand Up @@ -311,7 +314,7 @@ get_power <- function(community = c("ag", "re", "sb"),
return(power_data)
}

# functions internal to get_power() -----
# subfunctions internal to get_power() -----------------------------------------

#' Check Dates for Validity When Querying API
#'
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
"applicationCategory": "Tools",
"isPartOf": "https://ropensci.org",
"keywords": ["NASA", "meteorological-data", "weather", "global", "weather-data", "meteorology", "NASA-POWER", "agroclimatology", "earth-science", "data-access", "climate-data", "r", "nasa-power", "nasa", "agroclimatology-data", "weather-variables", "rstats", "r-package"],
"fileSize": "499.323KB",
"fileSize": "499.527KB",
"citation": [
{
"@type": "ScholarlyArticle",
Expand Down

0 comments on commit b4453d4

Please sign in to comment.