- ctdfjorder.CTD.CTD.add_mld(self, method: str = 'potential_density_avg', delta: float | None = 0.05, reference: int | None = 10) None#
Calculates and adds the mixed layer depth (MLD) using the density threshold method.
- Parameters:
method (str, default "potential_density_avg") – The MLD calculation method. Options are “abs_density_avg” or “potential_density_avg”.
delta (float or None, default 0.05) – The change in density or potential density from the reference that would define the MLD in units of \(\frac{kg}{m^3}\).
reference (int) – The reference depth for MLD calculation.
- Raises:
NoSamplesError – When the function is called on a CTD object with no data.
ValueError – When the specified method is invalid.
Notes
The mixed layer depth (MLD) is calculated using the density threshold method, defined as the depth at which the density increases by a specified amount (delta) from the reference density. The reference density is calculated as the mean density up to the reference depth.
The procedure is as follows for the thresholding methods:
Initialize a new column for MLD in the dataset.
For each unique profile identified by profile_id, extract the profile’s data.
Filter the data to include only the samples up to the reference depth.
Calculate the reference density based on the chosen method: - “abs_density_avg”: mean absolute density up to the reference depth. - “potential_density_avg”: mean potential density up to the reference depth.
Identify the MLD as the shallowest depth where the density exceeds the reference density by the specified delta.
Update the profile with the calculated MLD value.
Reintegration of the updated profile into the main dataset.
The MLD equation is given by:
\[\text{MLD} = \min(D + \Delta > D_r)\]where:
\(( D_r )\) is the reference density, defined as the mean density up to the reference depth.
\(( D )\) represents all densities in the profile.
\(( \Delta )\) is the specified change in density (delta).
Examples
ctd_data = CTD('example.csv') ctd_data.add_mld(reference=10, method="potential_density_avg", delta=0.05) # This will add a new column with MLD values to the dataset, calculated using the specified method # and parameters.
See also
add_densitymethod to calculate derived density.
add_potential_densitymethod to calculate derived potential density.