Learn R Programming

M3 (version 0.4)

get.datetime.seq: Read in a sequence of date-time steps from a Models3-formatted file.

Description

Read the date-time steps in the Models3-formatted file. Put these into R's datetime format.

Usage

get.datetime.seq(file)

Value

Vector of sequence of datetimes included in the Models3-formatted file, in POSIXct format.

Arguments

file

File name of Models3-formatted file which contains the date-time information of interest.

Author

Jenise Swall

Warning

This code assumes that the time step is not negative. For instance, the Models3 I/OAPI does allow for negative time steps, but these negative time steps will NOT be handled properly by this function. For more information about Models3 date-time conventions, see
https://www.cmascenter.org/ioapi/documentation/all_versions/html/DATETIME.html.

Details

This function relies on the R package ncdf4 to read information from Models3-formatted files, since the Models3 format is built on netCDF
(https://www.unidata.ucar.edu/software/netcdf/).

References

Information about the Models3 date-time conventions is available at
https://www.cmascenter.org/ioapi/documentation/all_versions/html/DATETIME.html.

See Also

Examples

Run this code
## As mentioned in notes above, user will not typically call
## this function directly.

## Find the path to a demo file with lambert conic conformal projection.
lcc.file <- system.file("extdata/ozone_lcc.ncf", package="M3")

## Get vector containing date-times available in this file.
datetime.seq <- get.datetime.seq(lcc.file)

Run the code above in your browser using DataLab