which.nc: "which" for NetCDF arrays

Description Usage Arguments Value Examples

Description

A version of "which" for NetCDF datasets that does not require prior loading of arrays and avoids loading the whole of large arrays at once.

Usage

1
2
which.nc(ncfile, variable, FUN = Negate(is.na), ..., arr.ind = FALSE,
  useNames = TRUE, size.threshold = 1e+07)

Arguments

ncfile

NetCDF connection object

variable

variable name within NetCDF data set

FUN

function to operate on array, which should produce a logical vector or array

...

additional arguments to FUN

arr.ind, useNames

passed to which

size.threshold

how large can the array be before the function performs on chunks?

Value

integer vector (arr.ind = FALSE) or matrix (arr.ind = TRUE), as with 'which'

Examples

1
2
3
4
5
6
7
library(RNetCDF)

mfdata <- open.nc(system.file("rflow_mf_demo.nc", package = "Rflow"))

# find which cells have a well in, by C, R, L reference
unique(which.nc(mfdata, "Wells", `!=`, 0, arr.ind = TRUE)[, 1:3],
       MARGIN = 1L)

CJBarry/Rflow documentation built on June 16, 2019, 12:35 p.m.