get_array

function of dascore.proc.coords source

get_array(
    self: Patch ,
    name: str | None[str, None] = None,
    require_sorted: bool = False,
    require_evenly_sampled: bool = False,
)-> ‘BaseCoord’

Get an array associated with patch data or a coordinate.

Parameters

Parameter Description
name The name of the coordinate to fetch. If None return patch data.
require_sorted If True, require the coordinate to be sorted or raise Error.
require_evenly_sampled If True, require the coordinate to be evenly sampled or raise Error.

Raises

CoordError if the coordinate does not exist or does not meet the imposed requirements.

Examples

import dascore as dc
patch = dc.get_example_patch()

# Get the patch data array.
data = patch.get_array()  # same as patch.data

# Get an array of distance values
distance_array = patch.get_array("distance")

# Get an array of time values. Raise an error if they arent sorted.
time_array = patch.get_array("time", require_sorted=True)

See Also

Patch.get_coord