crop_caim: Crop a canopy image

View source: R/crop_caim.R

crop_caimR Documentation

Crop a canopy image

Description

Extracts a rectangular region of interest (ROI) from a canopy image. This function complements read_caim() and read_caim_raw().

Usage

crop_caim(r, upper_left = NULL, width = NULL, height = NULL)

Arguments

r

terra::SpatRaster.

upper_left

numeric vector of length two. Pixel coordinates of the upper-left corner of the ROI, in the format c(column, row).

width, height

numeric vector of length one. Size (in pixels) of the rectangular ROI to read.

Value

terra::SpatRaster object containing the same layers and values as r but restricted to the selected ROI, preserving all other properties.

Note

rcaiman uses terra without geographic semantics: rasters are kept with unit resolution (cell size = 1) and a standardized extent ext(0, ncol, 0, nrow) with CRS EPSG:7589.

Examples

caim <- read_caim()
ncell(caim)
caim <- crop_caim(caim, c(231,334), 15, 10)
ncell(caim)

rcaiman documentation built on Sept. 9, 2025, 5:42 p.m.