ecpet.ecfile module¶
EC-PeT File Operations Module¶
File handling utilities for Campbell Scientific TOA5 data logger files and eddy-covariance data processing workflows. Provides efficient reading, writing, and validation of TOA5 format files commonly used in meteorological and flux tower measurements.
- The module handles:
File discovery with pattern matching and glob support
TOA5 format validation and header parsing
Efficient timestamp extraction from large files
File integrity verification with MD5 checksums
Campbell Scientific formatting conventions
Time range analysis across multiple files
- ecpet.ecfile.find(path, names)¶
Find files matching patterns in specified directory.
- Parameters:
- Returns:
List of filenames in TOA5 format
- Return type:
Supports direct filenames, glob patterns, and directory listings. Returns only files that pass TOA5 format validation.
- ecpet.ecfile.toa5_check(filename)¶
Check if file is in Campbell Scientific TOA5 format.
- ecpet.ecfile.toa5_get_header(filename)¶
Extract header information from TOA5 file.
- Parameters:
filename (str) – Path to TOA5 file
- Returns:
Dictionary containing header information
- Return type:
Returns station name, logger info, column names, units, and sampling info. Column names have parentheses replaced with underscores.
- ecpet.ecfile.toa5_get_hash(filename)¶
Calculate MD5 hash of TOA5 file.
- ecpet.ecfile.toa5_get_times(filename, count=False)¶
Extract first and last timestamps from TOA5 file.
- Parameters:
- Returns:
List with [first_time, last_time] or [first_time, last_time, count]
- Return type:
Uses efficient file seeking to find last timestamp without reading entire file.
- ecpet.ecfile.get_time_range(d, fl)¶
Determine overall time range from list of TOA5 files.
- ecpet.ecfile.toa5_put_header(file, header)¶
Write TOA5 header information to file.
- Parameters:
Creates 4-line TOA5 header with station info, column names, units, and sampling.