src.toolbox.steps.custom.interpolate_data#

Class definition for deriving CTD variables.

Classes#

InterpolateVariables

A processing step for interpolating data.

Module Contents#

class src.toolbox.steps.custom.interpolate_data.InterpolateVariables[source]#

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

A processing step for interpolating data.

This class processes data to interpolate missing values and fill gaps in variables using time-based interpolation. It supports quality control handling and optional diagnostic visualization.

Inherits from BaseStep and processes data stored in the context dictionary.

Parameters:
  • name (str) – Name identifier for this step instance.

  • parameters (dict, optional) – Configuration parameters for the interpolation step.

  • diagnostics (bool, optional) – Whether to generate diagnostic visualizations. Default is False.

  • context (dict, optional) – Processing context dictionary.

step_name[source]#

Identifier for this processing step. Set to “Interpolate Data”.

Type:

str

Examples

Example config usage:

- name: "Interpolate Data"
  parameters:
    qc_handling_settings: {
      flag_filter_settings: {
        "PRES": [3, 4, 9],
        "LATITUDE": [3, 4, 9],
        "LONGITUDE": [3, 4, 9]
      },
      reconstruction_behaviour: "replace",
      flag_mapping: { 3: 8, 4: 8, 9: 8 }
    }
  diagnostics: false
step_name = 'Interpolate Data'[source]#
required_variables = ['TIME'][source]#
provided_variables = [][source]#
run()[source]#

Execute the interpolation workflow.

This method performs the following steps:

  1. Filters data based on quality control flags

  2. Converts xarray data to a Polars DataFrame

  3. Interpolates missing values using time as the reference dimension

  4. QC and data reconstruction based on user specification

  5. Updates QC flags for interpolated values

  6. Generates diagnostic plots if enabled

Returns:

The updated context dictionary containing the interpolated dataset under the “data” key.

Return type:

dict

generate_diagnostics()[source]#

Generate diagnostic plots comparing original and interpolated data.

Creates a side-by-side comparison visualization showing the first variable in filter_settings before and after interpolation.

This method uses the Tkinter backend for interactive display.

Return type:

None