Routines¶
Routines are standalone, array-in / array-out processing functions. Each accepts
array-like inputs – a scalar, a 1-D sequence (list or tuple), or a NumPy array,
depending on what the routine needs – plus optional scalar parameters, and returns
NumPy arrays; inputs are converted with numpy.asarray internally, so you need
not build NumPy arrays yourself. Each routine documents (and validates) the exact
input shape it expects. Each routine lives in its own versioned file, so it can
be lifted into another project as a standalone module. A routine relies on the standard scientific stack (NumPy,
SciPy, TEOS-10/GSW) where possible. If a routine needs a more specialised
package, that package does not ship with pyRSKtools, so you can install it
separately.
Note
Calling a routine. Import it from pyrsktools.routines:
from pyrsktools.routines import correcttempADCcal
temperature_corrected, mask = correcttempADCcal(temperature, time)
correcttempADCcal¶
- pyrsktools.routines.correcttempADCcal(temperature: Vector, time: Vector) Tuple[NDArray, NDArray]¶
Remove the periodic A2D self-calibration outliers from a temperature vector.
Version: 1.0.0
- Parameters:
temperature¶ – 1-D vector of temperature samples in degrees C (a list, tuple, or 1-D numpy array).
time¶ – matching 1-D vector of sample times in seconds (same length as
temperature). Elapsed or absolute both work: the routine phase-locks on the 60-s self-cal cycle, so it only needs the 60-s periodicity and a consistent phase – not an absolute wall-clock reference. The intervals must be the true sample spacing.
- Returns:
tuple –
(temperature_corrected, mask)– both are 1-Dnumpy.ndarraythe same length as the inputs.temperature_corrected(float) is the cleaned series (still a valid temperature, a drop-in replacement) andmask(bool) is True for the samples that were actually corrected. A detected run that was skipped (no finite neighbour, or the whole series) or whose interpolated proposal clamped to no change is excluded, somask.sum()is the number of samples genuinely modified. If the periodic self-cal signature cannot be confirmed (the file does not exhibit it, or is too short to verify), the series is returned unchanged with an all-Falsemask– the routine never fabricates a correction.- Raises:
ValueError – if the inputs are not matched 1-D vectors (a scalar or a 2-D/N-D input, or two different lengths), or if
timedecreases.
Example:
>>> from pyrsktools import routines >>> temperature_corrected, mask = routines.correcttempADCcal(temperature, time)