rompy.swan.components.lockup.COMPUTE_STAT#
- pydantic model rompy.swan.components.lockup.COMPUTE_STAT[source]#
Multiple SWAN stationary computations.
COMPUTE STATIONARY [time] HOTFILE 'fname' ->FREE|UNFORMATTED COMPUTE STATIONARY [time] COMPUTE STATIONARY [time] HOTFILE 'fname' ->FREE|UNFORMATTED . .
This component can be used to define multiple stationary 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 STATIONARY, NONSTATIONARY In [2]: from rompy.swan.components.lockup import COMPUTE_STAT In [3]: time = STATIONARY(time="1990-01-01T00:00:00") In [4]: comp = COMPUTE_STAT(times=time) In [5]: print(comp.render()) COMPUTE STATIONARY time=19900101.000000 In [6]: times = NONSTATIONARY( ...: tbeg="1990-01-01T00:00:00", ...: tend="1990-01-01T03:00:00", ...: delt="PT1H", ...: ) ...: In [7]: comp = COMPUTE_STAT(times=times) In [8]: print(comp.render()) COMPUTE STATIONARY time=19900101.000000 COMPUTE STATIONARY time=19900101.010000 COMPUTE STATIONARY time=19900101.020000 COMPUTE STATIONARY time=19900101.030000 In [9]: hotfile = dict(fname="./hotfile.swn") In [10]: hottimes=["1990-01-01T03:00:00"] In [11]: comp = COMPUTE_STAT(times=times, hotfile=hotfile, hottimes=hottimes) In [12]: print(comp.render()) COMPUTE STATIONARY time=19900101.000000 COMPUTE STATIONARY time=19900101.010000 COMPUTE STATIONARY time=19900101.020000 COMPUTE STATIONARY time=19900101.030000 HOTFILE fname='hotfile_19900101T030000.swn' In [13]: comp = COMPUTE_STAT(times=times, hotfile=hotfile, hottimes=[2, -1]) In [14]: print(comp.render()) COMPUTE STATIONARY time=19900101.000000 COMPUTE STATIONARY time=19900101.010000 COMPUTE STATIONARY time=19900101.020000 HOTFILE fname='hotfile_19900101T020000.swn' COMPUTE STATIONARY time=19900101.030000 HOTFILE fname='hotfile_19900101T030000.swn'
- Fields:
- Validators:
hotfile_with_hottimes
»all fields
- field hottimes: list[datetime] | list[int] = []#
Times to write hotfiles, can be a list of datetimes or times indices
- Validated by:
- field model_type: Literal['stat', 'STAT'] = 'stat'#
Model type discriminator
- Validated by:
- field suffix: str = '_%Y%m%dT%H%M%S'#
Time-template suffix to add to hotfile fname
- Validated by:
- field times: STATIONARY | NONSTATIONARY [Optional]#
Compute times
- Validated by:
- validator timestamp_to_datetime » hottimes[source]#
Ensure pandas.Timestamp entries are coerced into datatime.
- property hotids: list#
List time ids at which to write hotfiles.