src.toolbox.steps.custom.variables.salinity#

Classes#

Functions#

running_average_nan(→ numpy.ndarray)

Estimate running average mean

compute_optimal_lag(profile_data, filter_window_size, ...)

Calculate the optimal conductivity time lag relative to temperature to reduce salinity spikes for each glider profile.

Module Contents#

src.toolbox.steps.custom.variables.salinity.running_average_nan(arr: numpy.ndarray, window_size: int) numpy.ndarray[source]#

Estimate running average mean

src.toolbox.steps.custom.variables.salinity.compute_optimal_lag(profile_data, filter_window_size, time_col)[source]#

Calculate the optimal conductivity time lag relative to temperature to reduce salinity spikes for each glider profile. Mimimize the standard deviation of the difference between a lagged CNDC and a high-pass filtered CNDC. The optimal lag is returned. The lag is chosen from -2 to 2s every 0.1s. This correction should reduce salinity spikes that result from the misalignment between conductivity and temperature sensors and from the difference in sensor response times. This correction is described in Woo (2019) but the mimimization is done between salinity and high-pass filtered salinity (as done by RBR, https://bitbucket.org/rbr/pyrsktools/src/master/pyrsktools) instead of comparing downcast vs upcast.

Woo, L.M. (2019). Delayed Mode QA/QC Best Practice Manual Version 2.0. Integrated Marine Observing System. DOI: 10.26198/5c997b5fdc9bd (http://dx.doi.org/ 10.26198/5c997b5fdc9bd).

Parameters:
  • self.tsr (xarray.Dataset with raw CTD dataset for one single profile, which should contain:) –

    • TIME_CTD, sci_ctd41cp_timestamp, [numpy.datetime64]

    • PRES: pressure [dbar]

    • CNDC: conductivity [S/m]

    • TEMP: in-situ temperature [de C]

  • windowLength (Window length over which the high-pass filter of conductivity is applied, 21 by default.)

Returns:

self.tsr

Return type:

with lags.

class src.toolbox.steps.custom.variables.salinity.AdjustSalinity[source]#

Bases: toolbox.steps.base_step.BaseStep, toolbox.utils.qc_handling.QCHandlingMixin

step_name = 'Salinity Adjustment'[source]#
run()[source]#

Apply the thermal-lag correction for Salinity presented in Morrison et al 1994. The temperature is estimated inside the conductivity cell to estimate Salinity. This is based on eq.5 of Morrison et al. (1994), which doesn’t require to know the sensitivity of temperature to conductivity (eq.2 of Morrison et al. 1994). No attempt is done yet to minimize the coefficients alpha/tau in T/S space, as in Morrison et al. (1994) or Garau et al. (2011). The fixed coefficients (alpha and tau) presented in Morrison et al. (1994) are used. These coefficients should be valid for pumped SeaBird CTsail as described in Woo (2019) by using their flow rate in the conductivity cell. This function should further be adapted to unpumped CTD by taking into account the glider velocity through the water based on the pitch angle or a hydrodynamic flight model.

Woo, L.M. (2019). Delayed Mode QA/QC Best Practice Manual Version 2.0. Integrated Marine Observing System. DOI: 10.26198/5c997b5fdc9bd (http://dx.doi.org/10.26198/5c997b5fdc9bd).

generate_diagnostics()[source]#
correct_ct_lag()[source]#

For the full deployment, calculate the optimal conductivity time lag relative to temperature to reduce salinity spikes for each glider profile. If more than 300 profiles are present, the optimal lag is estimated every 10 profiles. Display the optimal conductivity time lag calculated for each profile, estimate the median of this lag, and apply this median lag to corrected variables (CNDC_ADJ/PSAL_ADJ). This correction should reduce salinity spikes that result from the misalignment between conductivity and temperature sensors and from the difference in sensor response times.

Parameters:
  • self.tsr (xarray.Dataset with raw CTD dataset, which should contain:) –

    • PROFILE_NUMBER

    • TIME_CTD, sci_ctd41cp_timestamp, [numpy.datetime64]

    • PRES: pressure [dbar]

    • CNDC: conductivity [mS/cm]

    • TEMP: in-situ temperature [de C]

  • windowLength (Window length over which the high-pass filter of conductivity is applied, 21 by default.)

Returns:

self.tsr

Return type:

with tau and prof_i.

correct_thermal_lag()[source]#
display_CTLag()[source]#
display_adj_profiles()[source]#
Display profiles for ~20 mid profiles of:
  1. PSAL: raw salinity

  2. PSAL_ADJ: salinity corrected from CTlag

  3. PSAL_ADJ: salinity with the thermal lag correction

  4. difference between raw and ADJ (CTlag + thermal lag correction) salinity and temperature