API reference

Core functionality

mantaray.ray_tracing(x0, y0, kx0, ky0, duration: float, step_size: float, bathymetry: str, current: str) Dataset[source]

Ray tracing for multiple initial conditions

For a given set of initial conditions, progapage those multiple rays in parallel and return the projections for each ray

Parameters

x0Sequence[float]

Initial x position of the ray

y0Sequence[float]

Initial y position of the ray

kx0Sequence[float]

Initial wavenumber, x component

ky0Sequence[float]

Initial wavenumber, y component

durationfloat

Duration of the simulation

step_sizefloat

Time step for the simulation

bathymetrystr

Path to a netCDF file containing the bathymetry file. It is expected x and y dimensions as floats and depth (x, y) as a float, where depth is zero at surface and positive downwards.

currentstr

Paths to a netCDF file containing the current field. It is expected to have x and y dimensions as floats and u(x,y) and v(x,y) as floats.

Returns

xr.Dataset :

A dataset containing the time evolution of multiple rays.

mantaray.single_ray(x0: float, y0: float, kx0: float, ky0: float, duration: float, step_size: float, bathymetry: str, current: str) Dataset[source]

Propagate a single ray without considering the effect of currents

Parameters

x0float

Initial x position of the ray

y0float

Initial y position of the ray

kx0float

Initial wavenumber, x component

ky0float

Initial wavenumber, y component

durationfloat

Duration of the simulation

step_sizefloat

Time step for the simulation

bathymetrystr

Path to a netCDF file containing the bathymetry file. It is expected to have x and y dimensions as floats and depth (x, y) as a float, where depth is zero at surface and positive downwards.

currentstr

Paths to a netCDF file containing the current field. It is expected to have x and y dimensions as floats and u(x,y) and v(x,y) as floats.

Return

xr.Dataset :

A dataset containing the time evolution of the ray

Examples

>>> mantaray.single_ray(-1000, 0, 0.01, 0, 10, 2, "island.nc")

Support

mantaray.support.plot_ray_tracing(ray_bundle: Dataset, *, bathymetry: Dataset | None = None, current: Dataset | None = None) tuple[Figure, Axes][source]

Plot the ray bundle using matplotlib. Optionally plot bathymetry or current.

Parameters

ray_bundlexarray.Dataset

An xarray dataset containing the rays, time steps, x, y, kx, and ky, values

bathymetryxarray.Dataset, optional

The path to the bathymetry file to plot

currentxarray.Dataset, optional

The path of the current file to plot

Returns

tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]

The created figure and axes. See matplotlib documentation for plt.subplots() return type.