Description Usage Arguments Details Author(s) References See Also Examples
timestring
produces properly formatted
strings for the time-fields of, say, query.iris
,
acceptable to IRIS WS.
ISOdatetime.j
produces a POSIXct
object
using the Julian date (day of year), or from an appropriately
formatted character string
in tstr
(as produced by timestring
).
1 2 3 4 5 6 7 | timestring(year, day, hour = 0, min = 0, sec = 0, tz = "UTC",
month = NULL)
ISOtimestring(tstr, tz = "UTC")
ISOdatetime.j(year, day, hour = 0, min = 0, sec = 0, tz = "UTC",
month = NULL, tstr = NULL)
|
year |
numeric; the full year A.D. (e.g., 2012 not 12) |
day |
numeric; the day, either of-the-year, or of-the-month (see |
hour |
numeric; the hour of the day (less than 100) |
min |
numeric; the minute (less than 100) |
sec |
numeric; fractional seconds (less than 100; will be truncated to 6 decimal places) |
tz |
character; the timezone |
month |
numeric; the month of the year.
If this is |
tstr |
character; an alternative wat of specifying a datetime,
e.g., |
An IRIS WS time-string can be formatted in two ways:
(1a) using year-month-day, (e.g., '1997-01-31T12:04:32.123'
) or
(2) using year-day (e.g.,'1997.031T12:04:32.123'
),
where the string after 'T' corresponds to hour:minute:fractional-seconds.
The string can also be of the form (1b)
'1997-01-31'
(in this case '00:00:00'
is assumed), but
we have found this format can lead to query failures.
In this program the string is always returned in format (2):
<year>.<day>T<hour>:<min>:<sec>
sec
may be fractional, but is formatted with sprintf
(02.06f
) so
values less than 1 microsecond will be truncated (not rounded).
Note that IRIS WS accepts values for hour, minute, and second which are less than 100. Return data will have times adjusted to account for values in excess of the normal limits (i.e., 24, 60, 60).
The functionality of ISOdatetime.j
is roughly equivalent to
ISOdatetime
, but is somewhat more flexible.
AJ Barbour
[1] http://service.iris.edu/irisws/timeseries/1/
Other Utilities: irisws-package
,
irisws-queryconstruction
,
irisws-wadl
, query.iris
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## Not run:
#
# Specify the month
timestring(2012, 15, 32, 12, 12.222, month=12)
# [1] "2012.350T32:12:12.222000"
#
# or not
timestring(2012, 15, 32, 12, 12.222)
# [1] "2012.015T32:12:12.222000"
#
# some errors:
try(timestring(2012, 15, 32, 100, 12.222)) # min too large
try(timestring(2012, 75755, 32, 12, 12.222)) # day too large
try(timestring(2012, 15, 32, 100, 12.222, 13)) # month too large
# etc...
#
ISOdatetime.j(tstr=timestring(2010,111,sec=0.12123))
# or use the wrapper
ISOtimestring(timestring(2010,111,sec=0.12123))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.