Skip to content

CTD_adjusted#237

Open
lauryntalbot wants to merge 12 commits intoc-proof:mainfrom
lauryntalbot:CTD-adjusted-tests
Open

CTD_adjusted#237
lauryntalbot wants to merge 12 commits intoc-proof:mainfrom
lauryntalbot:CTD-adjusted-tests

Conversation

@lauryntalbot
Copy link
Copy Markdown

added CTD_adjusted.py, tests and documentation

@lauryntalbot
Copy link
Copy Markdown
Author

Summary

This PR adds a new CTD post-processing workflow for generating adjusted timeseries and gridded products, including thermal lag and CT lag corrections.

The workflow produces _adjusted NetCDF outputs following standard pyglider processing.


Code Changes

pyglider/ncprocess.py

  • Updated make_gridfiles to support:
    • maskfunction
    • max_gap

pyglider/utils.py

  • Added functions required for CTD adjustment workflow:
    • flag_conductivity_in_depth_space
    • interpolate_over_salinity_NANs
    • apply_thermal_lag
    • flag_CTD_data
    • adjust_CTD
    • maskQC4
  • Removed deprecated gappy_fill_vertical

pyglider/process_adjusted.py

  • Added new processing script to:
    • flag CTD data
    • apply CT lag (dTdC) and thermal lag (alpha, tau)
    • generate adjusted timeseries and gridded outputs

Documentation Updates

docs/adjust_CTD.md

  • Added detailed documentation for:
    • CTD adjustment workflow
    • thermal lag correction
    • user-configurable parameters

docs/index.md

  • Added reference to adjust_CTD.md

Tests

Added tests validating the workflow for multiple glider platforms:

  • tests/test_process_adjusted_slocum.py
  • tests/test_process_adjusted_seaexplorer.py

These tests:

  • run the full process_adjusted workflow
  • validate output variables, values, and metadata

Test Data

YAML inputs

  • tests/example-data/example-slocum/adjusted.yml
  • tests/example-data/example-seaexplorer/adjusted.yml

Expected outputs

  • Slocum:
    • tests/expected/example-slocum/L0-timeseries/dfo-rosie713-20190615_adjusted.nc
    • tests/expected/example-slocum/L0-gridfiles/dfo-rosie713-20190615_grid_adjusted.nc
  • SeaExplorer:
    • tests/expected/example-seaexplorer/L0-timeseries/dfo-eva035-20190718_adjusted.nc
    • tests/expected/example-seaexplorer/L0-gridfiles/dfo-eva035-20190718_grid_adjusted.nc

Notes

  • Thermal lag correction is applied when alpha and tau are provided
  • CT lag correction is applied when dTdC is non-zero
  • Workflow supports YAML-defined constants or function arguments
  • Tests confirm consistent behaviour across both Slocum and SeaExplorer datasets

@jklymak
Copy link
Copy Markdown
Member

jklymak commented Apr 30, 2026

@lauryntalbot what is the status here? I should be able to review tomorrow

Comment thread docs/adjust_CTD.md

sal_adj.attrs = ts.salinity.attrs.copy()

if dTdC is not None:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this all in the docs? I'm confused.

Comment thread docs/adjust_CTD.md
Parameters
----------
ds: DataArray
Timeseries of mission data
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, this should not be in the docs?

Comment thread docs/adjust_CTD.md
fn: float
Sampling frequency of the sensor

alpha : float
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants