Skip to contents

Get the relative or absolute path to a branch of the cronus database.

Usage

get_branch(
  dir = NULL,
  region = NULL,
  sector = NULL,
  provider = NULL,
  product = NULL,
  variable = NULL
)

create_db(
  dir = NULL,
  region = NULL,
  sector = NULL,
  provider = NULL,
  product = NULL,
  variable = NULL
)

print_tree()

Arguments

dir

character. The database parent directory.

region

Region The region of interest.

sector

character. The sector of interest.

provider

character. The provider of interest.

product

character. The product of interest.

variable

character. The variable of interest.

Value

  • get_branch() returns a list containing the path (absolute or relative, depending on whether the parent directory was provided or not), as well as all the arguments provided and those that could be extrapolated from them.

  • create_db() creates the directory specified, get_branch()$path, and returns the path invisibly.

  • print_tree() prints the database structure in a Sector - Provider - Product tree form.

Examples

if (FALSE) {
region <- Region(name = "nebraska", type = "us state",
                 div = c(country = "United States", state = "Nebraska"))

list_cropmaps <- get_branch(dir = getwd(), region = region, product = "cropmaps")
list_cropmaps$dir
list_cropmaps$region
list_cropmaps$sector
list_cropmaps$provider
list_cropmaps$product
list_cropmaps$variable
list_cropmaps$path

path_cropmaps <- create_db(dir = getwd(), region = region, product = "cropmaps")
}