cf.s¶
-
cf.
s
(duration=1, month=1, day=1, hour=0, minute=0, second=0)[source]¶ Return a time duration of seconds in a
cf.TimeDuration
object.cf.s()
is equivalent tocf.TimeDuration(1, 'second')
.New in version 1.0.
- Parameters
- duration: number, optional
The number of hours in the time duration.
- month, day, hour, minute, second:
int
, optional The default date-time elements for defining the start and end of a time interval based on this time duration. See
cf.TimeDuration
andcf.TimeDuration.interval
for details.- Parameter example:
cf.s(hour=6)
is equivalent tocf.TimeDuration(1, 'seconds', hour=6)
.
- Returns
TimeDuration
The new
cf.TimeDuration
object.
Examples
>>> cf.s() <CF TimeDuration: PT1S (Y-M-D h:m:s)> >>> cf.s().interval(cf.dt(1999, 12, 1)) (cftime.DatetimeGregorian(1999-12-01 00:00:00), cftime.DatetimeGregorian(1999-12-01 00:00:01)) >>> cf.s(30) <CF TimeDuration: PT30S (Y-M-D h:m:s)> >>> cf.s(0.5) <CF TimeDuration: PT0.5S (Y-M-D h:m:s)> >>> cf.s(12.25) <CF TimeDuration: PT12.25S (Y-M-D h:m:s)> >>> cf.s(2.5, year=1999, hour=12) cf.s(30, month=2, hour=12) <CF TimeDuration: PT30S (Y-M-D h:m:s)> >>> cf.s(0) <CF TimeDuration: PT0S (Y-M-D h:m:s)>