loc_index: Find the closest indices into a dimension for a given set of...

View source: R/nc.R

loc_indexR Documentation

Find the closest indices into a dimension for a given set of values

Description

This is useful to convert real dimensional values to array indices for making data requests. The index assigned is always the dimensional step closest.

Usage

loc_index(x, value, what = "lon", make_rle = FALSE)

Arguments

x

ncdf4 object

value

vector of one of values (numeric for lon, lat, lev and POSIXct for time)

what

character, the name of the dimension

make_rle

logical, if TRUE use the first and last elements of value (which may also be the first) to construct [start, length] encodings

Value

numeric vector if either indices closest to requested locations or two element [start, length] vector if rle = TRUE


BigelowLab/nam218grads documentation built on Oct. 4, 2022, 2:01 a.m.