v0.2.1 - Enhanced SinfoParser
🎉 Release v0.2.1 - Enhanced SinfoParser
This release significantly enhances the SinfoParser to provide comprehensive parsing of all CDO sinfo output sections, making it easier to programmatically access climate data metadata.
✨ New Features
Complete Sinfo Output Parsing
- Metadata Extraction: Parse file format, institute, source, and variable field headers
- Grid Coordinates: Full grid information with automatic spatial resolution calculation
- Extracts grid type, dimensions, and coordinate ranges
- Automatically calculates
lon_resolutionandlat_resolution(e.g., 0.25 degrees)
- Vertical Coordinates: Parse vertical axis information (surface, pressure, hybrid levels)
- Time Coordinates: Comprehensive temporal data extraction
- Total timesteps, reference time, units, and calendar
- Complete list of all timestep values
- Automatic temporal resolution calculation (detects hourly, 6-hourly, daily, monthly intervals)
- Handles both regular and irregular time series
Enhanced Variable Parsing
- Support for both modern sinfo format (Institut/Source/Steptype) and legacy format (Date/Time)
- Robust type conversion for numeric fields
- Graceful handling of malformed data
📊 Example Usage
from python_cdo_wrapper import CDO, parse_cdo_output
cdo = CDO()
output = cdo("sinfo", input="data.nc")
parsed = parse_cdo_output("sinfo", output)
# Access grid resolution
print(parsed["grid"]["lon_resolution"]) # 0.25
print(parsed["grid"]["lat_resolution"]) # 0.25
# Access time resolution
print(parsed["time"]["time_resolution"]["interval"]) # "1 day"
print(parsed["time"]["time_resolution"]["regular"]) # True
# Access all timesteps
print(parsed["time"]["timesteps"][:5]) # First 5 timesteps🔧 Improvements
- Added 12 comprehensive test cases for sinfo parsing
- Improved parser robustness and error handling
- Better documentation with detailed docstrings
Backward Compatibility
Fully backward compatible - all existing code continues to work without changes.
Installation
pip install --upgrade python-cdo-wrapperFull Changelog: V0.2.0...V0.2.1