Skip to content

belian-earth/ctreesR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ctreesR

Lifecycle: experimental

A thin reticulate-backed wrapper for reading the CTrees aboveground biomass Zarr cube from Arraylake into a terra::SpatRaster. Note this is not the best way to use these data we should work towards arraylake R bindings, but this is a stopgap for now.

Installation

# install.packages("pak")
pak::pak("belian-earth/ctreesR")

The Arraylake repository must be supplied: pass it as session_auth(repo = "org/repo"), set options(ctreesR.repo = ...), or set the CTREES_REPO environment variable (e.g. in ~/.Renviron). The package does not ship a default repo.

Arraylake credentials are resolved in this order:

  1. The token argument to session_auth() (an Earthmover account API key, e.g. session_auth(token = "ema_...")).
  2. The EARTHMOVER_KEY environment variable. Use this in non-interactive deployments (containers, Shiny apps) where no browser is available.
  3. The OAuth token cached at ~/.arraylake/token.json by arraylake auth login. This is the default for interactive use.

Usage

library(ctreesR)

session <- session_auth()
ctrees  <- open_ctrees(session)

bbx <- c( -73.2,-8.0, -72.1, -7.1)
bzr <- read_ctrees(ctrees, bbox = bbx, year_start = 2025, year_end = 2025)
terra::plot(bzr, range=c(0, 350), fill_range=TRUE)

About

Thin reticulate-backed wrapper for accessing the CTrees aboveground biomass Zarr cube hosted on Arraylake.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors