nc.get.time.series: Returns time axis data as PCICt for a file

Description Usage Arguments Details Value Note References Examples

View source: R/helpers.r

Description

Returns time axis data as PCICt for a file.

Usage

1
2
3
4
5
6
7
nc.get.time.series(
  f,
  v,
  time.dim.name,
  correct.for.gregorian.julian = FALSE,
  return.bounds = FALSE
)

Arguments

f

The file (an object of class ncdf4)

v

Optionally, the variable to look for a time dimension on.

time.dim.name

Optionally, the time dimension name.

correct.for.gregorian.julian

Specific workaround for Gregorian-Julian calendar transitions in non-proleptic Gregorian calendars

return.bounds

Whether to return the time bounds as an additional attribute

Details

Retrieving time data from a NetCDF file in an intelligible format is a non-trivial problem. The PCICt package solves part of this problem by allowing for 365- and 360-day calendars. This function complements it by returns time data for a file as PCICt, doing all necessary conversions.

Value

A vector of PCICt objects, optionally with bounds

Note

If the file was opened with readunlim=FALSE, it will read in the time values from the file; otherwise, it will retrieve the time values from the ncdf4 class' data structures.

References

http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#time-coordinate

Examples

1
2
3
4
5
6
7
## Get time series from file
## Not run: 
f <- nc_open("pr.nc")
ts <- nc.get.time.series(f)
nc_close(f)

## End(Not run)

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