ctdfjorder.CTD.CTD.remove_upcasts(self) None#

Removes upcasts by dropping rows where pressure decreases from one sampling event to the next.

Raises:

NoSamplesError – When the function is called on a CTD object with no data.

Notes

An upcast in CTD (Conductivity, Temperature, Depth) profiles occurs when the sensor package is moved upward through the water column, causing a decrease in pressure readings. This method identifies and removes such events by ensuring pressure monotonically increases within each profile.

The procedure is as follows:

  1. It then computes the difference in pressure between consecutive rows within the profile.

  2. Rows where the pressure difference is not positive are removed, indicating a non-increasing pressure (i.e., an upcast or no movement).

  3. The cleaned profile is then reintegrated into the main dataset, replacing the original data.

Let \(p_i\) be the pressure at the \(i\)-th sampling event. The condition for retaining a data point is given by:

\[\Delta p_i = p_{i} - p_{i-1} > 0 \quad \text{for} \quad i = 1, 2, \ldots, N\]

where \(N\) is the total number of sampling events in the profile. Rows not satisfying this condition are considered upcasts and are removed.

Examples

ctd_data = CTD('example.csv')
ctd_data.remove_upcasts()
# This will clean the dataset by removing upcasts, ensuring all profiles have monotonically
# increasing pressure readings.

See also

CTD

To initialize an object