Skip to content

Stop test runs writing derived weather models into the repo - #814

Open
jlmaurer wants to merge 2 commits into
dbekaert:devfrom
jlmaurer:pr/test_fixture_tmpdir
Open

Stop test runs writing derived weather models into the repo#814
jlmaurer wants to merge 2 commits into
dbekaert:devfrom
jlmaurer:pr/test_fixture_tmpdir

Conversation

@jlmaurer

@jlmaurer jlmaurer commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Problem

Running the test suite rewrites files inside the repository.

combine_weather_files writes the time-interpolated weather model next to its inputs:

https://github.com/dbekaert/RAiDER/blob/dev/tools/RAiDER/cli/raider.py#L845

weather_model_file = wfiles[0].parent / (...)
ds_out.to_netcdf(weather_model_file)

That is reasonable for a real weather-model cache, but the test fixtures point that cache at tracked directories, so every run with -interp center_time or -interp azimuth_time_grid deposits derived files into the working tree:

  • test/gunw_test_data/weather_files/GMAO_*_timeInterp_*.nctwo tracked files overwritten, showing up as binary diffs in git status that are easy to commit by accident.
  • test/gunw_azimuth_test_data/weather_files/HRRR_*_timeInterp*.ncfour files, ~41 MB each (~165 MB) written into the tree on every run and invisible to git status, because .gitignore:29 hides that directory.

Checksumming all 24 tracked .nc files before and after a full pytest -m "not long" run confirms exactly two tracked files change, both _timeInterp_; the other 22 are read-only.

The two overwritten GMAO files are pure byproducts:

  • they are derived from the four tracked input files in the same directory;
  • no test references them — conftest.py lists only the inputs;
  • deleting both and running pytest test/test_GUNW.py regenerates them and passes.

They also churn without any change in the science. Comparing the committed copy against a regenerated one, the delay values are bit-identical; the whole 1.80 MB → 2.20 MB size difference is wet/hydro widening from float32 to float64 (2 × 394400 − 2 × 197200 = 394400 bytes, matching exactly), because the interpolation weights are numpy float64 scalars. A numpy promotion-behaviour difference alone produces a 400 KB binary diff.

Changes

  1. Untrack the two derived GMAO _timeInterp_ files (git rm --cached; the files stay on disk) and add .gitignore rules for *_timeInterp_*.nc / *_timeInterpAziGrid_*.nc.

  2. Stop the tests writing into the repo at all. A new _linked_weather_files helper in test/conftest.py symlinks the tracked input files into a session-scoped scratch directory and hands the tests those paths. Since the delay workflow never calls .resolve(), wfiles[0].parent is the scratch directory, so the derived output lands there instead. Symlinks mean nothing is copied — this matters for the 128 MB of HRRR inputs.

    Applied to all three weather-file fixtures: weather_model_dict_for_gunw_integration_test, weather_model_dict_for_azimuth_time_test, and weather_model_dict_for_center_time_test.

Verification

With every derived file deleted from both fixture directories beforehand:

pytest test/test_GUNW.py -m "not long" -k "not availability_check"

passes, and neither fixture directory receives any _timeInterp_ / _timeInterpAziGrid_ output afterwards. git status is clean.

(test_hrrr_availability_check_using_gunw_ids is deselected above only because it hits live HRRR servers and fails with a socket timeout on this network; it is unrelated to these changes.)

Not included

The four tracked 32 MB HRRR input files under test/gunw_azimuth_test_data/weather_files/ are left alone here. They are already matched by .gitignore:29 but tracked anyway, and unlike the derived products they cannot simply be removed — test_azimuth_timing_interp_against_center_time_interp needs them. Fixing that requires a way to fetch them, which is out of scope for this PR. Tracked separately in #815.

combine_weather_files writes the time-interpolated model next to its inputs
(wfiles[0].parent), which is right for a real weather-model cache but means
the test fixtures -- which point that cache at tracked directories -- deposit
derived files into the working tree on every run:

  * test/gunw_test_data/weather_files/GMAO_*_timeInterp_*.nc overwrites two
    tracked files, producing binary diffs that are easy to commit by accident;
  * test/gunw_azimuth_test_data/weather_files/HRRR_*_timeInterp*.nc drops
    ~165 MB into the tree invisibly, since .gitignore hides that directory.

The two GMAO products are pure byproducts: derived from the tracked inputs
beside them, referenced by no test, and regenerated when deleted. They also
churn without any change in the science -- comparing a committed copy against
a regenerated one, the delays are bit-identical and the entire 1.80 -> 2.20 MB
difference is wet/hydro widening from float32 to float64 because the
interpolation weights are numpy float64 scalars.

Untrack them, ignore the derived name patterns, and route the three
weather-file fixtures through a scratch directory of symlinks. Nothing is
copied (the HRRR inputs are 128 MB), the links read through transparently,
and since the delay workflow never resolves paths, wfiles[0].parent is the
scratch directory, so the output lands there instead.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
jlmaurer added a commit to jlmaurer/RAiDER-1 that referenced this pull request Aug 15, 2026
The processed fixtures store precomputed wet/hydro refractivity and
wet_total/hydro_total, and the tests that assert delay values read those
stored cubes rather than recomputing them. They therefore encoded the old
k1*P/T refractivity and trapezoid quadrature, and would have kept passing
unchanged while silently asserting superseded numbers.

Recompute the derived cubes from each fixture's own stored t/p/e. Every step
that produces t/p/e is untouched here, so this reproduces exactly what the
current pipeline would write for the same raw input, with no re-download.

The reconstruction was checked before anything was overwritten: recomputing
wet, whose formula is unchanged, reproduced the stored values bit-exactly, as
did recomputing hydro under the old k1*P/T form -- confirming both that the
stored t/p/e are the true inputs and that the fixtures carried the old
physics.

All four fixtures behind golden values are native model-level grids, so the
shift is dominated by the virtual-temperature correction rather than the
quadrature change, and it scales with water vapour as expected: the surface
hydrostatic delay drops 1.2 mm over dry HRRR CONUS and 4.95 mm over
equatorial Brazil.

The four 33.7 MB HRRR inputs under gunw_azimuth_test_data are deliberately
left alone: no golden value depends on them, regenerating would add ~135 MB
of binary churn, and dbekaert#815 proposes untracking them entirely.
The derived GMAO _timeInterp_ products are left alone too; dbekaert#814 untracks them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant