NEP 4.3.0
NetCDF Expansion Pack
Loading...
Searching...
No Matches
expected_output Directory Reference

Detailed Description

This directory contains expected CDL (Common Data Language) output files for the example programs that remain in NEP: cache_tuning and chunking_performance in examples/performance/. These files serve as regression test baselines to ensure examples continue producing correct output across code changes.

The expected files for the generic NetCDF teaching examples moved with those examples to the NetCDF Developer's Handbook repository in v4.3.0.

Purpose

CDL files are human-readable text representations of NetCDF file structure and data, generated by the ncdump utility. By comparing example program output against these baseline CDL files, we can:

File Naming Convention

Expected CDL files follow the pattern: <example_name>_<variant>_expected.cdl

How Tests Work

The cache_tuning_validate and chunking_performance_validate_* CTest tests:

  1. Run the example program (via a DEPENDS test or inline)
  2. Generate CDL from the output NetCDF file(s) using ncdump (through validate_cdl.sh, generated from ../validate_cdl.sh.in)
  3. Compare the generated CDL with the expected CDL file
  4. Report success if they match, failure if they differ

When to Regenerate Baselines

Regenerate expected CDL files when:

Do NOT regenerate for:

How to Regenerate Baselines

# Build and run the example
cd build/examples/performance
./cache_tuning
./chunking_performance
# Generate new baselines
ncdump -h -s cache_test.nc > ../../examples/expected_output/cache_tuning_expected.cdl
for f in contiguous time_optimized spatial_optimized balanced; do
ncdump chunk_${f}.nc > ../../examples/expected_output/chunking_performance_${f}_expected.cdl
done

Verifying Correctness

Before committing regenerated baselines, manually verify:

  1. Dimensions: Correct names and sizes
  2. Variables: Correct names, types, and dimensions
  3. Attributes: Correct names and values (global and variable)
  4. Structure: Overall file structure is logical

Troubleshooting

CDL Format Changes

If NetCDF library updates change CDL formatting:

  1. Regenerate all baselines with the new format
  2. Document the change in commit message
  3. Verify the actual NetCDF file structure is unchanged (only formatting differs)

References