rompy.swan.subcomponents.time.TimeRangeClosed#

pydantic model rompy.swan.subcomponents.time.TimeRangeClosed[source]#

Regular times with a closed boundary.

[tbeg] [delt] SEC|MIN|HR|DAY [tend]

Note

Default values for the time specification fields are provided for the case where the user wants to set times dynamically after instantiating this subcomponent.

Examples

In [157]: from rompy.swan.subcomponents.time import TimeRangeClosed

In [158]: from datetime import datetime, timedelta

In [159]: times = TimeRangeClosed(
   .....:     tbeg=datetime(1990, 1, 1),
   .....:     tend=datetime(1990, 1, 7),
   .....:     delt=timedelta(minutes=30),
   .....:     dfmt="min",
   .....: )
   .....: 

In [160]: print(times.render())
tbeg=19900101.000000 delt=30.0 MIN tend=19900107.000000

In [161]: times = TimeRangeClosed(
   .....:     tbeg="2012-01-01T00:00:00",
   .....:     tend="2012-02-01T00:00:00",
   .....:     delt="PT1H",
   .....:     tfmt=2,
   .....:     dfmt="hr",
   .....:     suffix="blk",
   .....: )
   .....: 

In [162]: print(times.render())
tbegblk='01-Jan-12 00:00:00' deltblk=1.0 HR tendblk='01-Feb-12 00:00:00'
Fields:
field delt: timedelta = datetime.timedelta(seconds=3600)#

Time interval

field dfmt: Literal['sec', 'min', 'hr', 'day'] = 'sec'#

Format to render time interval specification

field model_type: Literal['closed', 'CLOSED'] = 'closed'#

Model type discriminator

field suffix: str = ''#

Suffix to prepend to argument names when rendering

field tbeg: datetime = datetime.datetime(1970, 1, 1, 0, 0)#

Start time

field tend: datetime = datetime.datetime(1970, 1, 2, 0, 0)#

End time

field tfmt: Literal[1, 2, 3, 4, 5, 6] | str = 1#

Format to render time specification

cmd() str[source]#

Render subcomponent cmd.