RAnEn::ncvar_get_times is a convenient function to read Times from a already open NetCDF file connection. It echos the API of ncdf4:ncvar_get but it differs in that it checks for any reading imprecision and corrects for small errors.

ncvar_get_times(
  nc,
  var_name,
  origin = "1970-01-01",
  tz = "UTC",
  to_posix = T,
  epsilon = 1e-05
)

Arguments

nc

An object of class ncdf4 (as returned by either function nc_open or function nc_create), indicating what file to read from.

var_name

The variable name for Times

origin

The origin used for converting to POSIX time

tz

The time zone

to_posix

Whether to convert times to POSIX

epsilon

The maximum reading error to correct. Otherwise, an error is thrown.

Value

A vector of times

Author

Weiming Hu weiming@psu.edu