Clock¶
The terrainbento Clock controls the timing of model runs.
Clock sets the run duration and timestep in terrainbento model runs.
-
class
Clock
(start=0.0, step=10.0, stop=100.0)[source]¶ Bases:
object
terrainbento clock.
-
__init__
(start=0.0, step=10.0, stop=100.0)[source]¶ - Parameters
Examples
>>> from terrainbento import Clock
The follow constructs the default clock.
>>> clock = Clock() >>> clock.start 0.0 >>> clock.stop 100.0 >>> clock.step 10.0
User specified parameters may be provided.
>>> clock = Clock(start=0, step=200, stop=2400) >>> clock.start 0.0 >>> clock.stop 2400.0 >>> clock.step 200.0
-
classmethod
from_dict
(params)[source]¶ Construct a Clock from a dictionary.
- Parameters
param (dict-like) –
Examples
>>> from terrainbento import Clock >>> params = {"start": 0, "step": 10, "stop": 100} >>> clock = Clock.from_dict(params) >>> clock.start 0.0 >>> clock.stop 100.0 >>> clock.step 10.0
-
classmethod
from_file
(filelike)[source]¶ Construct a Clock from a yaml file.
- Parameters
filelike (file-like) –
Examples
>>> from io import StringIO >>> from terrainbento import Clock >>> filelike = StringIO(''' ... start: 0 ... step: 10 ... stop: 100 ... ''') >>> clock = Clock.from_file(filelike) >>> clock.start 0.0 >>> clock.stop 100.0 >>> clock.step 10.0
-