nc_apply: Apply Functions Over Dimensions of a netCDF variable.

View source: R/nctools-main.R

nc_applyR Documentation

Apply Functions Over Dimensions of a netCDF variable.

Description

Apply Functions Over Dimensions of a netCDF variable.

Usage

nc_apply(
  filename,
  varid,
  MARGIN,
  FUN,
  ...,
  output = NULL,
  drop = FALSE,
  newdim = NULL,
  name = NULL,
  longname = NULL,
  units = NULL,
  compression = NA,
  verbose = FALSE,
  force_v4 = TRUE,
  ignore.case = FALSE
)

Arguments

filename

Name of the existing netCDF file to be opened.

varid

What variable to read the data from. Can be a string with the name of the variable or an object of class ncvar4. If set to NA, the function will determine if there is only one variable in the file and, if so, read from that, but if there are multiple variables in the file, an error is generated.

MARGIN

a vector giving the dimensions which the function will be applied over. It can be a character vector selecting dimension names.

FUN

the function to be applied

...

optional arguments to FUN.

output

Name of the file to save results.

drop

Logical. Drop degenered dimensions (i.e. dimensions of length 1)? Not implemented.

newdim

the values to be assigned a the dimension resulting from the application of FUN.

name

new name of the resulting variable. If NULL (by default), the original name is kept.

longname

long name of the resulting variable.

units

units of the resulting variable.

compression

If set to an integer between 1 (least compression) and 9 (most compression), this enables compression for the variable as it is written to the file. Turning compression on forces the created file to be in netcdf version 4 format, which will not be compatible with older software that only reads netcdf version 3 files.

verbose

Print debugging information.

force_v4

If TRUE, then the created output file will always be in netcdf-4 format (which supports more features, but cannot be read by version 3 of the netcdf library). If FALSE, then the file is created in netcdf version 3 format UNLESS the user has requested features that require version 4. Deafult is TRUE.

ignore.case

If TRUE, ignore case in matching dimension names and MARGIN. Default is FALSE.


roliveros-ramos/nctools documentation built on Aug. 13, 2022, midnight