rompy.swan.subcomponents.time.Time#
- pydantic model rompy.swan.subcomponents.time.Time[source]#
Time specification in SWAN.
[time]
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 time 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.
Examples
In [151]: from rompy.swan.subcomponents.time import Time In [152]: from datetime import datetime In [153]: time = Time(time=datetime(1990, 1, 1)) In [154]: print(time.render()) 19900101.000000 In [155]: time = Time(time="2012-01-01T00:00:00", tfmt=2) In [156]: print(time.render()) '01-Jan-12 00:00:00'
- Fields:
- Validators:
- field model_type: Literal['time', 'Time', 'TIME'] = 'time'#
Model type discriminator
- field tfmt: Literal[1, 2, 3, 4, 5, 6] | str = 1#
Format to render time specification
- Validated by:
- field time: datetime [Required]#
Datetime specification