-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
59 lines (44 loc) · 1.72 KB
/
Copy pathREADME.Rmd
File metadata and controls
59 lines (44 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# ctreesR
<!-- badges: start -->
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
<!-- badges: end -->
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
```r
# 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
```{r 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)
```