-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
abdc1d4
commit 27d0043
Showing
9 changed files
with
114 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
^README\.Rmd$ | ||
^LICENSE\.md$ | ||
^\.github$ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(get_key) | ||
export(plot) | ||
importFrom(terra,plot) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,59 @@ | ||
#' Get Soil Moisture Integration and Prediction System (SMIPS) Data | ||
#' | ||
#' Soil Moisture Integration and Prediction System (\acronym{SMIPS}) | ||
#' | ||
#' Soil Moisture Integration and Prediction System (\acronym{SMIPS}) v1.0. | ||
#' | ||
#' @param collection A character vector of the data collection to be queried, | ||
#' on of: | ||
#' * SMIndex | ||
#' * bucket1 | ||
#' * bucket2 | ||
#' * deepD | ||
#' * runoff | ||
#' * totalbucket | ||
#' Defaults to \dQuote{totalbucket}. | ||
#' @param dates A date to query, _e.g._, `date = 2017-12-31`, both `Character` or | ||
#' `Date` classes are accepted. | ||
#' | ||
#' @return A [terra::rast] object | ||
|
||
#' @references <https://portal.tern.org.au/metadata/TERN/d1995ee8-53f0-4a7d-91c2-ad5e4a23e5e0https://geonetwork.tern.org.au/geonetwork/srv/eng/catalog.search#/metadata/d1995ee8-53f0-4a7d-91c2-ad5e4a23e5e0> | ||
get_smips <- function(start_date, end_date) { | ||
get_smips <- function(collection = "totalbucket", | ||
dates, | ||
api_key = get_key()) { | ||
|
||
dates <- lubridate::ymd(dates) | ||
url_dates <- gsub("-", "", dates) | ||
approved_collections <- c("totalbucket", | ||
"SMIndex", | ||
"bucket1", | ||
"bucket2", | ||
"deepD", | ||
"runnoff") | ||
collection <- rlang::arg_match(collection, approved_collections) | ||
|
||
collection_url <- data.table::fcase( | ||
collection == "totalbucket", | ||
paste0("smips_totalbucket_mm_", url_dates, ".tif"), | ||
collection == "SMIndex", | ||
paste0("smips_smi_perc_", url_dates, ".tif"), | ||
collection == "bucket1", | ||
paste0("smips_bucket1_mm_", url_dates, ".tif"), | ||
collection == "bucket2", | ||
paste0("smips_bucket2_mm_", url_dates, ".tif"), | ||
collection == "deepD", | ||
paste0("smips_deepD_mm_", url_dates, ".tif"), | ||
collection == "runoff", | ||
paste0("smips_runoff_mm_", url_dates, ".tif") | ||
) | ||
|
||
r <- terra::rast(paste0("/vsicurl/https://", | ||
paste0('apikey:', api_key), | ||
"@data.tern.org.au/model-derived/smips/v1_0/", | ||
collection, | ||
"/", | ||
lubridate::year(dates), | ||
"/", | ||
collection_url)) | ||
return(r) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#' @importFrom terra plot | ||
#' @export | ||
terra::plot |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters