cf.s

cf.s(duration=1, year=None, 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 to cf.TimeDuration(1, 'second').

See also

cf.Y, cf.M, cf.D, cf.h, cf.m

New in version 1.0.

Parameters:
duration : number, optional

The number of hours in the time duration. Must be non-negative.

year, month, day, hour, minute, second : ints, optional

The default date-time elements for defining the start and end of a time interval based on this time duration. See cf.TimeDuration and cf.TimeDuration.interval for details.

Example:

cf.s(hour=6) is equivalent to cf.TimeDuration(1, 'seconds', hour=6).

Returns:
out : cf.TimeDuration

The new cf.TimeDuration object.

Examples:
>>> cf.s()   
<CF TimeDuration: 1 second (from Y-01-01 00:00:00)>
>>> cf.s().interval(1999, 12, 1)
(<CF Datetime: 1999-12-01 00:00:00>, datetime.datetime(1999, 12, 1, 0, 0, 1))
>>> cf.s(30)
<CF TimeDuration: 30 seconds (from Y-01-01 00:00:00)>
>>> cf.s(0.5)
<CF TimeDuration: 0.5 seconds (from Y-01-01 00:00:00)>
>>> cf.s(12.25)
<CF TimeDuration: 12.25 seconds (from Y-01-01 00:00:00)>
>>> cf.s(2.5, year=1999, hour=12)
<CF TimeDuration: 2.5 seconds (from 1999-01-01 12:00:00)>
>>> cf.s(0)
<CF TimeDuration: 0 seconds (from Y-01-01 00:00:00)>

Previous topic

cf.m

Next topic

cf.ATOL

This Page