rompy.swan.subcomponents.time.TimeRangeOpen#

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

Regular times with an open boundary.

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

Time is rendered in one of the following formats:

  • 1: ISO-notation 19870530.153000

  • 2: (as in HP compiler) ‘30-May-87 15:30:00’

  • 3: (as in Lahey compiler) 05/30/87.15:30:00

  • 4: 15:30:00

  • 5: 87/05/30 15:30:00’

  • 6: as in WAM 8705301530

Note

The tbeg field can be specified as:

  • existing datetime object

  • int or float, assumed as Unix time, i.e. seconds (if >= -2e10 or <= 2e10) or milliseconds (if < -2e10 or > 2e10) since 1 January 1970.

  • ISO 8601 time string.

Note

The tdelta field can be specified as:

  • existing timedelta object

  • int or float, assumed as seconds

  • ISO 8601 duration string, following formats work:

    • [-][DD ][HH:MM]SS[.ffffff]

    • [±]P[DD]DT[HH]H[MM]M[SS]S (ISO 8601 format for timedelta)

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 [163]: from rompy.swan.subcomponents.time import TimeRangeOpen

In [164]: from datetime import datetime, timedelta

In [165]: times = TimeRangeOpen(
   .....:     tbeg=datetime(1990, 1, 1), delt=timedelta(minutes=30), dfmt="min"
   .....: )
   .....: 

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

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

In [168]: print(times.render())
tbegblk='01-Jan-12 00:00:00' deltblk=1.0 HR
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['open', 'OPEN'] = 'open'#

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 tfmt: Literal[1, 2, 3, 4, 5, 6] | str = 1#

Format to render time specification

cmd() str[source]#

Render subcomponent cmd.