rompy.swan.subcomponents.time.NONSTATIONARY#

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

Nonstationary time specification.

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

In [143]: nonstat = NONSTATIONARY(
   .....:     tbeg="2012-01-01T00:00:00",
   .....:     tend="2012-02-01T00:00:00",
   .....:     delt="PT1H",
   .....:     dfmt="hr",
   .....: )
   .....: 

In [144]: print(nonstat.render())
NONSTATIONARY tbeg=20120101.000000 delt=1.0 HR tend=20120201.000000

In [145]: from datetime import datetime, timedelta

In [146]: nonstat = NONSTATIONARY(
   .....:     tbeg=datetime(1990, 1, 1),
   .....:     tend=datetime(1990, 1, 7),
   .....:     delt=timedelta(minutes=30),
   .....:     tfmt=1,
   .....:     dfmt="min",
   .....:     suffix="tbl",
   .....: )
   .....: 

In [147]: print(nonstat.render())
NONSTATIONARY tbegtbl=19900101.000000 delttbl=30.0 MIN tendtbl=19900107.000000

Show JSON schema
{
   "title": "NONSTATIONARY",
   "description": "Nonstationary time specification.\n\n.. code-block:: text\n\n    NONSTATIONARY [tbeg] [delt] SEC|MIN|HR|DAY [tend]\n\nNote\n----\nDefault values for the time specification fields are provided for the case where\nthe user wants to set times dynamically after instantiating this subcomponent.\n\nExamples\n--------\n\n.. ipython:: python\n    :okwarning:\n\n    from rompy.swan.subcomponents.time import NONSTATIONARY\n    nonstat = NONSTATIONARY(\n        tbeg=\"2012-01-01T00:00:00\",\n        tend=\"2012-02-01T00:00:00\",\n        delt=\"PT1H\",\n        dfmt=\"hr\",\n    )\n    print(nonstat.render())\n    from datetime import datetime, timedelta\n    nonstat = NONSTATIONARY(\n        tbeg=datetime(1990, 1, 1),\n        tend=datetime(1990, 1, 7),\n        delt=timedelta(minutes=30),\n        tfmt=1,\n        dfmt=\"min\",\n        suffix=\"tbl\",\n    )\n    print(nonstat.render())",
   "type": "object",
   "properties": {
      "model_type": {
         "default": "nonstationary",
         "description": "Model type discriminator",
         "enum": [
            "nonstationary",
            "NONSTATIONARY"
         ],
         "title": "Model Type",
         "type": "string"
      },
      "tbeg": {
         "default": "1970-01-01T00:00:00",
         "description": "Start time",
         "format": "date-time",
         "title": "Tbeg",
         "type": "string"
      },
      "delt": {
         "default": "PT1H",
         "description": "Time interval",
         "format": "duration",
         "title": "Delt",
         "type": "string"
      },
      "tfmt": {
         "anyOf": [
            {
               "enum": [
                  1,
                  2,
                  3,
                  4,
                  5,
                  6
               ],
               "type": "integer"
            },
            {
               "type": "string"
            }
         ],
         "default": 1,
         "description": "Format to render time specification",
         "title": "Tfmt"
      },
      "dfmt": {
         "default": "sec",
         "description": "Format to render time interval specification",
         "enum": [
            "sec",
            "min",
            "hr",
            "day"
         ],
         "title": "Dfmt",
         "type": "string"
      },
      "suffix": {
         "default": "",
         "description": "Suffix to prepend to argument names when rendering",
         "title": "Suffix",
         "type": "string"
      },
      "tend": {
         "default": "1970-01-02T00:00:00",
         "description": "End time",
         "format": "date-time",
         "title": "Tend",
         "type": "string"
      }
   },
   "additionalProperties": false
}

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['nonstationary', 'NONSTATIONARY'] = 'nonstationary'#

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.