map_sonic2tracer

Module for synchronizing sonic anemometer and tracer gas analyzer files.

This module provides functionality to match sonic anemometer and tracer gas analyzer files based on their timestamps, ensuring that flux calculations only proceed when both measurements are available. It handles:

  • Parsing of standardized filename formats

  • Half-hourly period matching

  • Filtering of unpaired measurements

Author

B. Heinesch University of Liege, Gembloux Agro-Bio Tech

Functions

map_sonic2tracer

Filter sonic files to keep only those with matching tracer files.

parse_datetime_sonic

Parse datetime from sonic anemometer filename.

parse_datetime_tracer

Parse datetime from tracer gas analyzer filename.

map_sonic2tracer.parse_datetime_sonic(filename)[source]

Parse datetime from sonic anemometer filename.

Parameters:

filename (str) – Filename in format ‘GHS50_YYYY_MM_DD__HH_MM_SS.hdf5’

Returns:

Parsed datetime object

Return type:

datetime

map_sonic2tracer.parse_datetime_tracer(filename)[source]

Parse datetime from tracer gas analyzer filename.

Parameters:

filename (str) – Filename in format ‘K2_BE-Vie_YYYY_TOF4000_YYYY_MM_DD__HH_MM_SS.h5’

Returns:

Parsed datetime object

Return type:

datetime

map_sonic2tracer.map_sonic2tracer(all_sonic_files_list, all_tracer_files_list)[source]

Filter sonic files to keep only those with matching tracer files.

This function examines sonic anemometer files and keeps only those that have corresponding tracer gas analyzer files within the same half-hour period. This ensures data synchronization for flux calculations.

Parameters:
  • all_sonic_files_list (dict) –

    Dictionary of sonic files containing: - name : list

    Filenames

    • pathlist

      Full paths to files

    • prefixlist

      File prefixes

    • datelist

      File dates

  • all_tracer_files_list (dict) – Dictionary of tracer files with same structure

Returns:

Filtered sonic files dictionary containing only entries with matching tracer files. Maintains same structure as input dictionary.

Return type:

dict

Notes

The matching process: 1. For sonic files at MM=00, looks for tracer files between MM=00-29 2. For sonic files at MM=30, looks for tracer files between MM=30-59 3. Files must match exactly in year, month, day, and hour