Skip to content

Add gnarly NetCDF fixtures and tests for CF violation detection#5

Open
lukegre wants to merge 1 commit into
mainfrom
claude/create-netcdf-test-files-2CRqY
Open

Add gnarly NetCDF fixtures and tests for CF violation detection#5
lukegre wants to merge 1 commit into
mainfrom
claude/create-netcdf-test-files-2CRqY

Conversation

@lukegre
Copy link
Copy Markdown
Owner

@lukegre lukegre commented Apr 2, 2026

Eight deliberately broken NetCDF files cover the most realistic failure
modes encountered in the wild:

lat_upside_down.nc — latitude descending 90→-90, no coord attrs
lon_offset_wrong_labels — lon labelled -180→180 with units='degrees_west',
invalid cell_method 'accumulation'
bad_var_names.nc — dims named d0/d1/d2, vars named var1/field_2/X,
no units/standard_name/long_name anywhere
wrong_dim_order.nc — (lon, depth, lat, time) instead of (T,Z,Y,X)
missing_units.nc — numeric vars and all coords missing units,
numeric time with no reference epoch
missing_lon_slices.nc — three persistent NaN longitude bands (0-30°,
150-180°, 330-355°) across all times
bad_time_units.nc — 'parsecs since the Big Bang', bare 'days',
negative-year epoch, calendar='martian'
kitchen_sink.nc — all violations combined in one pathological file

The accompanying test_gnarly_fixtures.py has 50 tests across 8 classes,
exercising HeuristicCheck, OceanCoverCheck, and TimeCoverCheck against
each fixture with precise per-violation assertions.

Also adds !tests/data/*.nc to .gitignore so the binary fixtures are tracked,
and a make_gnarly_fixtures.py script to regenerate them.

https://claude.ai/code/session_01EA1f5cC3TivpMT6xaCt7hk

Eight deliberately broken NetCDF files cover the most realistic failure
modes encountered in the wild:

  lat_upside_down.nc      — latitude descending 90→-90, no coord attrs
  lon_offset_wrong_labels — lon labelled -180→180 with units='degrees_west',
                            invalid cell_method 'accumulation'
  bad_var_names.nc        — dims named d0/d1/d2, vars named var1/field_2/X,
                            no units/standard_name/long_name anywhere
  wrong_dim_order.nc      — (lon, depth, lat, time) instead of (T,Z,Y,X)
  missing_units.nc        — numeric vars and all coords missing units,
                            numeric time with no reference epoch
  missing_lon_slices.nc   — three persistent NaN longitude bands (0-30°,
                            150-180°, 330-355°) across all times
  bad_time_units.nc       — 'parsecs since the Big Bang', bare 'days',
                            negative-year epoch, calendar='martian'
  kitchen_sink.nc         — all violations combined in one pathological file

The accompanying test_gnarly_fixtures.py has 50 tests across 8 classes,
exercising HeuristicCheck, OceanCoverCheck, and TimeCoverCheck against
each fixture with precise per-violation assertions.

Also adds !tests/data/*.nc to .gitignore so the binary fixtures are tracked,
and a make_gnarly_fixtures.py script to regenerate them.

https://claude.ai/code/session_01EA1f5cC3TivpMT6xaCt7hk
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