-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
explore.R is the exploration layer for users who are new to the WRI catalog.
Its purpose is to help people understand what’s available before they move on to querying with list_layers() and retrieval with get_layer().
- list_domains()
Lines 1 to 11 in f191448
#' List available WRI domains #' #' @returns Character vector of domain names #' @export #' #' @examples #' list_domains() list_domains <- function() { layers <- list_layers() sort(unique(layers$domain[!is.na(layers$domain)])) } - list_layer_types()
Lines 14 to 24 in f191448
#' List available layer types #' #' @returns Character vector of layer type names #' @export #' #' @examples #' list_layer_types() list_layer_types <- function() { layers <- list_layers() sort(unique(layers$layer_type[!is.na(layers$layer_type)])) } - list_data_types()
Lines 27 to 37 in f191448
#' List available data types #' #' @returns Character vector of data type names #' @export #' #' @examples #' list_data_types() list_data_types <- function() { layers <- list_layers() sort(unique(layers$data_type[!is.na(layers$data_type)])) } - search_layers()
Lines 40 to 57 in f191448
#' Search for layers by name pattern #' #' @param pattern Character. Pattern to search for in layer IDs (case-insensitive) #' #' @returns Data frame of matching layers #' @export #' #' @examples #' # Find all layers with "fire" in the name #' search_layers("fire") #' #' # Find asthma-related layers #' search_layers("asthma") search_layers <- function(pattern) { layers <- list_layers() matches <- grepl(pattern, layers$id, ignore.case = TRUE) layers[matches, ] } - catalog_summary()
Lines 60 to 85 in f191448
#' Print catalog summary #' #' @returns NULL (prints summary to console) #' @export #' #' @examples #' catalog_summary() catalog_summary <- function() { layers <- list_layers() cat("\n=== WRI Data Catalog Summary ===\n\n") cat("Total layers: ", nrow(layers), "\n") cat("Hosted on KNB: ", sum(layers$is_hosted), "\n") cat("Local only: ", sum(!layers$is_hosted), "\n\n") cat("Domains (", length(unique(layers$domain[!is.na(layers$domain)])), "):\n", sep = "") cat(" ", paste(sort(unique(layers$domain[!is.na(layers$domain)])), collapse = ", "), "\n\n") cat("Layer types (", length(unique(layers$layer_type[!is.na(layers$layer_type)])), "):\n", sep = "") cat(" ", paste(sort(unique(layers$layer_type[!is.na(layers$layer_type)])), collapse = ", "), "\n\n") cat("Data types (", length(unique(layers$data_type)), "):\n", sep = "") cat(" ", paste(sort(unique(layers$data_type)), collapse = ", "), "\n\n") invisible(NULL) }
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels