nc.put.var.subset.by.axes: Puts a data subset in the place described by the named list...

Description Usage Arguments Details See Also Examples

View source: R/helpers.r

Description

Puts a data subset in the place described by the named list of axes.

Usage

1
2
3
4
5
6
7
8
nc.put.var.subset.by.axes(
  f,
  v,
  dat,
  axis.indices,
  axes.map = NULL,
  input.axes = NULL
)

Arguments

f

An object of class ncdf4 which represents a NetCDF file.

v

A string naming a variable in a file or an object of class ncvar4.

dat

The data to put in the file.

axis.indices

A list consisting of zero or more vectors of indices, named by which axis they refer to (X, Y, T, etc).

axes.map

An optional vector mapping axes to NetCDF dimensions. If not supplied, it will be generated from the file.

input.axes

An optional vector containing the input axis map. If supplied, it will be used to permute the data from the axis order in the input data, to the axis order in the output data.

Details

This function will write data (dat) out to the specified file (f) and variable (v) at the location specified by axis.indices.

See Also

ncdf4.helpers-package

Examples

1
2
3
4
5
6
7
8
## Copy a subset of the data from one location to another.
## Not run: 
f <- nc_open("pr.nc")
dat <- nc.get.var.subset.by.axes(f1, "pr", list(X=1:4, Y=c(1, 3, 5)))
nc.put.var.subset.by.axes(f1, "pr", dat, list(X=5:8, Y=1:3))
nc_close(f)

## End(Not run)

ncdf4.helpers documentation built on Oct. 15, 2021, 5:19 p.m.