Convert netCDF time vector to POSIXct R date object

Share:

Description

This function converts a time vector from a netCDF file or a vector of Julian days (or seconds, minutes, hours) since a specified origin into a POSIXct R vector.

Usage

1
2
3
convertDateNcdf2R(time.source, units = "days", origin = as.POSIXct("1800-01-01", 
    tz = "UTC"), time.format = c("%Y-%m-%d", "%Y-%m-%d %H:%M:%S", 
    "%Y-%m-%d %H:%M", "%Y-%m-%d %Z %H:%M", "%Y-%m-%d %Z %H:%M:%S"))

Arguments

time.source

numeric vector or netCDF connection: either a number of time units since origin or a netCDF file connection, In the latter case, the time vector is extracted from the netCDF file, This file, and especially the time variable, has to follow the CF netCDF conventions.

units

character string: units of the time source. If the source is a netCDF file, this value is ignored and is read from that file.

origin

POSIXct object: Origin or day/hour zero of the time source. If the source is a netCDF file, this value is ignored and is read from that file.

time.format

Value

POSIXct vector: time vector in native R format

Author(s)

Jannis v. Buttlar

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.