Convert time vectors in netCDF files to Julian days since a certain origin

Share:

Description

This function automatically converts time vectors in netCDF files to a standardized Gregorian calendar

Usage

1
2
convertDateR2Ncdf(ncdf.obj, date.vec = "auto", origin = "1800-01-01", 
    write.to.ncdf = TRUE)

Arguments

ncdf.obj

character string or netCDF connection: netCDF file for which to convert the dates

date.vec

POSIXct vector: date vectors for the time dimension. If set to 'auto', this is tried to be extracted from the netCDF file

origin

character string: origin to be used for the time vector. This start of the Gregorian calendar should be kept to avoid possible mistakes due to flawed conversions.

write.to.ncdf

logical: whether to write the time vector to the netCDF file.

Details

This function sets a time vector in a netCDF file to a standardized format which is readable by most software. It transfers the time vector to days since the start of the Gregorian calendar.

Value

(invisibly): the time vector. Additionally the time vector is written to the respective file.

Author(s)

Jannis v. Buttlar

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