| str2nct | R Documentation |
Time indicators in netcdf use numbers of elapsed time units since a
reference time. (Convertion used by CF standard.) str2nct evaluates
the elapsed time of a date with respect to a reference time and generates
a netcdf representation of the input character string(s). Currently
available time units are number of minutes, hours, days, months, or years.
nct2str makes the reverse conversion.
str2nct(str, t.unit, format = "%Y%m%d%H%M",
t.ref = "190001010000", format.ref = "%Y%m%d%H%M")
nct2str(nct, nct.unit, format="%Y%m%d%H%M")
str |
A character string (or a vector of strings) specifying the date. |
t.unit |
The desired time unit. Currently available are:
|
format |
The format of the input/output date string. Here we use conventions
as in |
t.ref |
The time reference to use. A character string. |
format.ref |
The format of the time reference. |
nct |
A netcdf time specification, typically a vector of integers, indicating the number of seconds, days etc. elabsed since a reference time. |
nct.unit |
The netcdf time unit used in the specification of argument
|
str2nct always returns integer numbers. So for example if t.unit="M"
str ist truncated to the first 6 digits and the elabsed number of
months is determined for the month of the date.
Note that the elapsed time starts with 0 if str is the same
like t.ref.
A single value or a vector with the elapsed time(s). The output has
an attribute with name since.lab. This is the character string
that can be used as the units attribute for time in the netcdf file.
Christoph Frei
Rdate2str
ts <- c("200706010000","200606020000","200606030000")
ts.ref="200001010000"
hh <- str2nct(str=ts,t.unit="D",t.ref=ts.ref)
hh
nct2str(nct=hh,nct.unit=attr(hh,"since.lab"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.