rompy.swan.components.lockup.COMPUTE_NONSTAT#
- pydantic model rompy.swan.components.lockup.COMPUTE_NONSTAT[source]#
Multiple SWAN nonstationary computations.
COMPUTE NONSTATIONARY [tbegc] [deltc] SEC|MIN|HR|DAY [tendc] HOTFILE 'fname' ->FREE|UNFORMATTED COMPUTE NONSTATIONARY [tbegc] [deltc] SEC|MIN|HR|DAY [tendc] HOTFILE 'fname' ->FREE|UNFORMATTED . .
This component can be used to define multiple nonstationary compute commands and write intermediate results as hotfiles between then.
Note
The field times is optional to allow for the case where the user wants to set times dynamically after instantiating this component.
Examples
In [1]: from rompy.swan.subcomponents.time import NONSTATIONARY In [2]: from rompy.swan.components.lockup import COMPUTE_NONSTAT In [3]: times = NONSTATIONARY( ...: tbeg="1990-01-01T00:00:00", ...: tend="1990-02-01T00:00:00", ...: delt="PT1H", ...: dfmt="hr", ...: ) ...: In [4]: comp = COMPUTE_NONSTAT(times=times) In [5]: print(comp.render()) COMPUTE NONSTATIONARY tbegc=19900101.000000 deltc=1.0 HR tendc=19900201.000000 In [6]: comp = COMPUTE_NONSTAT( ...: times=times, ...: hotfile=dict(fname="hotfile.swn", format="free"), ...: hottimes=["1990-02-01T00:00:00"], ...: ) ...: In [7]: print(comp.render()) COMPUTE NONSTATIONARY tbegc=19900101.000000 deltc=1.0 HR tendc=19900201.000000 HOTFILE fname='hotfile_19900201T000000.swn' FREE In [8]: comp = COMPUTE_NONSTAT( ...: times=times, ...: initstat=True, ...: hotfile=dict(fname="hotfile", format="free"), ...: hottimes=[6, 12, 18, -1], ...: ) ...: In [9]: print(comp.render()) COMPUTE STATIONARY time=19900101.000000 COMPUTE NONSTATIONARY tbegc=19900101.000000 deltc=1.0 HR tendc=19900101.060000 HOTFILE fname='hotfile_19900101T060000' FREE COMPUTE NONSTATIONARY tbegc=19900101.060000 deltc=1.0 HR tendc=19900101.120000 HOTFILE fname='hotfile_19900101T120000' FREE COMPUTE NONSTATIONARY tbegc=19900101.120000 deltc=1.0 HR tendc=19900101.180000 HOTFILE fname='hotfile_19900101T180000' FREE COMPUTE NONSTATIONARY tbegc=19900101.180000 deltc=1.0 HR tendc=19900201.000000 HOTFILE fname='hotfile_19900201T000000' FREE
Show JSON schema
{ "title": "COMPUTE_NONSTAT", "description": "Multiple SWAN nonstationary computations.\n\n.. code-block:: text\n\n COMPUTE NONSTATIONARY [tbegc] [deltc] SEC|MIN|HR|DAY [tendc]\n HOTFILE 'fname' ->FREE|UNFORMATTED\n COMPUTE NONSTATIONARY [tbegc] [deltc] SEC|MIN|HR|DAY [tendc]\n HOTFILE 'fname' ->FREE|UNFORMATTED\n .\n .\n\nThis component can be used to define multiple nonstationary compute commands and\nwrite intermediate results as hotfiles between then.\n\nNote\n----\nThe field `times` is optional to allow for the case where the user wants to set\ntimes dynamically after instantiating this component.\n\nExamples\n--------\n\n.. ipython:: python\n :okwarning:\n\n from rompy.swan.subcomponents.time import NONSTATIONARY\n from rompy.swan.components.lockup import COMPUTE_NONSTAT\n times = NONSTATIONARY(\n tbeg=\"1990-01-01T00:00:00\",\n tend=\"1990-02-01T00:00:00\",\n delt=\"PT1H\",\n dfmt=\"hr\",\n )\n comp = COMPUTE_NONSTAT(times=times)\n print(comp.render())\n comp = COMPUTE_NONSTAT(\n times=times,\n hotfile=dict(fname=\"hotfile.swn\", format=\"free\"),\n hottimes=[\"1990-02-01T00:00:00\"],\n )\n print(comp.render())\n comp = COMPUTE_NONSTAT(\n times=times,\n initstat=True,\n hotfile=dict(fname=\"hotfile\", format=\"free\"),\n hottimes=[6, 12, 18, -1],\n )\n print(comp.render())", "type": "object", "properties": { "model_type": { "default": "nonstat", "description": "Model type discriminator", "enum": [ "nonstat", "NONSTAT" ], "title": "Model Type", "type": "string" }, "times": { "$ref": "#/$defs/NONSTATIONARY", "description": "Compute times" }, "hotfile": { "anyOf": [ { "$ref": "#/$defs/HOTFILE" }, { "type": "null" } ], "default": null, "description": "Write results to restart files" }, "hottimes": { "anyOf": [ { "items": { "format": "date-time", "type": "string" }, "type": "array" }, { "items": { "type": "integer" }, "type": "array" } ], "default": [], "description": "Times to write hotfiles, can be a list of datetimes or times indices", "title": "Hottimes" }, "suffix": { "default": "_%Y%m%dT%H%M%S", "description": "Time-template suffix to add to hotfile fname", "title": "Suffix", "type": "string" }, "initstat": { "default": false, "description": "Run a STATIONARY computation at the initial time prior to the NONSTATIONARY computation(s) to prescribe initial conditions", "title": "Initstat", "type": "boolean" } }, "$defs": { "HOTFILE": { "additionalProperties": false, "description": "Write intermediate results.\n\n.. code-block:: text\n\n HOTFILE 'fname' ->FREE|UNFORMATTED\n\nThis command can be used to write the entire wave field at the end of a computation\nto a so-called hotfile, to be used as initial condition in a subsequent SWAN run\n(see command `INITIAL HOTSTART`). This command must be entered immediately after a\n`COMPUTE` command.\n\nThe user may choose the format of the hotfile to be written either as free or\nunformatted. If the free format is chosen, then this format is identical to the\nformat of the files written by the `SPECOUT` command (option `SPEC2D`). This\nhotfile is therefore an ASCII file which is human readable.\n\nAn unformatted (or binary) file usually requires less space on your computer than\nan ASCII file. Moreover, it can be readed by a subsequent SWAN run much faster than\nan ASCII file. Especially, when the hotfile might become a big file, the choice for\nunformatted is preferable. Note that your compiler and OS should follow the same\nABI (Application Binary Interface) conventions (e.g. word size, endianness), so\nthat unformatted hotfiles may transfer properly between different OS or platforms.\nThis implies that the present and subsequent SWAN runs do not have to be carried\nout on the same operating system (e.g. Windows, Linux) or on the same computer,\nprovided that distinct ABI conventions have been followed.\n\nNote\n----\nFor parallel MPI runs, more than one hotfile will be generated depending on the\nnumber of processors (`fname-001`, `fname-002`, etc).\n\nExamples\n--------\n\n.. ipython:: python\n :okwarning:\n\n from rompy.swan.components.lockup import HOTFILE\n hotfile = HOTFILE(fname=\"hotfile.swn\")\n print(hotfile.render())\n hotfile = HOTFILE(fname=\"hotfile.dat\", format=\"unformatted\")\n print(hotfile.render())", "properties": { "model_type": { "default": "hotfile", "description": "Model type discriminator", "enum": [ "hotfile", "HOTFILE" ], "title": "Model Type", "type": "string" }, "fname": { "description": "Name of the file to which the wave field is written", "format": "path", "title": "Fname", "type": "string" }, "format": { "anyOf": [ { "enum": [ "free", "unformatted" ], "type": "string" }, { "type": "null" } ], "default": null, "description": "Choose between free (SWAN ASCII) or unformatted (binary) format", "title": "Format" } }, "required": [ "fname" ], "title": "HOTFILE", "type": "object" }, "NONSTATIONARY": { "additionalProperties": false, "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())", "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" } }, "title": "NONSTATIONARY", "type": "object" } }, "additionalProperties": false }
- Fields:
- Validators:
- field initstat: bool = False#
Run a STATIONARY computation at the initial time prior to the NONSTATIONARY computation(s) to prescribe initial conditions
- Validated by:
- field model_type: Literal['nonstat', 'NONSTAT'] = 'nonstat'#
Model type discriminator
- Validated by:
- field times: NONSTATIONARY [Optional]#
Compute times
- Validated by: