Coverage for src/swiift/api/utils.py: 0%

1 from __future__ import annotations

2

3 import typing

4

5 import numpy as np

6

7 from ..lib import dr

8

9 if typing.TYPE_CHECKING:

10 from ..model.model import DiscreteSpectrum, FloatingIce, Ocean

11

12

13 def compute_free_surface_wavenumbers(

14 ocean: Ocean, spectrum: DiscreteSpectrum, gravity: float

15) -> np.ndarray:

16 solver = dr.FreeSurfaceSolver.from_ocean(ocean, spectrum, gravity)

17 wavenumbers = solver.compute_wavenumbers(real=True)

18 return wavenumbers

19

20

21 def compute_elastic_mass_loading_wavenumbers(

22 ice: FloatingIce, spectrum: DiscreteSpectrum, gravity: float

23) -> np.ndarray:

24 solver = dr.ElasticMassLoadingSolver.from_floating(ice, spectrum, gravity)

25 wavenumbers = solver.compute_wavenumbers(real=True)

26 return wavenumbers