veros_method decorator

veros.veros_method(function=None, **kwargs)[source]

Decorator that injects the current backend as variable np into the wrapped function.

Note

This decorator should be applied to all functions that make use of the computational backend (even when subclassing veros.Veros). The first argument to the decorated function must be a Veros instance.

Example

>>> from veros import Veros, veros_method
>>>
>>> class MyModel(Veros):
>>>     @veros_method
>>>     def set_topography(self):
>>>         self.kbot[...] = np.random.randint(0, self.nz, size=self.kbot.shape)