nc.conform.data: Conform data to dimension order and structure of output

Description Usage Arguments Details Value Note Examples

View source: R/helpers.r

Description

Conform data to dimension order and structure of output.

Usage

1
2
3
4
5
6
7
8
nc.conform.data(
  f.input,
  f.output,
  v.input,
  v.output,
  dat.input,
  allow.dim.subsets = FALSE
)

Arguments

f.input

The input file (an object of class ncdf4)

f.output

The output file (an object of class ncdf4)

v.input

The input variable (a string naming a variable in a file or an object of class ncvar4).

v.output

The output variable (a string naming a variable in a file or an object of class ncvar4).

dat.input

The input data to be reordered to match the output file's ordering.

allow.dim.subsets

Whether to allow the conforming process to subset the data.

Details

Sometimes files come in in different latitude (up is north, up is south), longitude (0 to 360 vs -180 to 180), and temporal schemes. The purpose of this function is to make data from one scheme comparable to data from another. It takes a given input file, variable, and slab of data and permutes the data such that the dimension order and the index order matches the order in the output file and variable.

Value

The data permuted to match the output file's ordering and optionally clipped to the extent of the output.

Note

This function currently isn't useful for conforming subsets of output data.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Get data from one file and conform it to the dimension order of another.
## Not run: 
f1 <- nc_open("pr.nc")
f2 <- nc_open("pr2.nc", write=TRUE)
dat <- nc.get.var.subset.by.axes(f1, "pr")
new.dat <- nc.conform.data(f2, f1, "pr", "pr", dat)
nc_close(f1)
nc_close(f2)

## End(Not run)

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