class TimeSeriesInterpolationMode
The TimeSeriesInterpolationMode class represents the interpolation modes available for an Unspecified time series output from the Code - Time series operator.
When the result_type method specifies an UNSPECIFIED_TIME_SERIES output, it must return a tuple containing a MeasurementType and a TimeSeriesInterpolationMode. Standard time series data types have inherent interpolation modes and do not require a mode to be specified separately.
TimeSeriesInterpolationMode is not an attribute of the TimeSeriesMeasurement class.
The TimeSeriesInterpolationMode class is available from the Echoview Python package.
For information about the default source file generated using New, see Understanding the default Echoview Python source file: Code - Time series.
Example
In this example, result_type() specifies an Unspecified time series output with a LINEAR interpolation mode. For each matched Operand 1 ping, eval() returns the maximum sample value from that ping and a GOOD TimeSeriesStatus.
from typing import List, Union import echoview as ev import numpy as np class Operator(ev.OperatorBase): def result_type(self, inputs: List[ev.MeasurementType]) -> Union[tuple[ev.MeasurementType, ev.TimeSeriesInterpolationMode], ev.MeasurementType]: return ev.MeasurementType.UNSPECIFIED_TIME_SERIES, ev.TimeSeriesInterpolationMode.LINEAR def eval(self, inputs: List[ev.OperandInput]): # Access the matched ping from Operand 1 (index 0) first_input = inputs[0] return np.max(first_input.measurement.data), ev.TimeSeriesStatus.GOOD
See also: Example for new Python source file under a Code - Time series virtual variable.
Attributes
|
Attribute |
Description |
LINEAR |
Linearly interpolates between measurements. Suitable for continuous values such as depth, temperature, and height. |
CIRCULAR_0_TO_360 |
Interpolates circular values using a range of 0° to 360°. Suitable for values such as heading. |
CIRCULAR_MINUS_180_TO_180 |
Interpolates circular values using a range of −180° to 180°. Suitable for values such as pitch and roll. |
STEPPED |
Uses the previous measurement’s value until the next measurement. Suitable for discrete values such as counts. |
DB |
Converts decibel values to the linear domain, interpolates them linearly, and converts the result back to decibels. |
Note: The no-data value for these interpolation modes is -9.9e+37.
See also
OperandInput class
TimeSeriesMeasurement class
MeasurementType class
TimeSeriesStatus class
About the Code operators
Using the Code* operators