FIX: Handle midnight wrap-around in the column plotting suite - #41
Merged
Conversation
A RadCLss file holds the radar volumes for a single processing day, but the first volume of that day routinely starts a few minutes before midnight, so time[0] falls on the previous calendar day. Both plotting functions anchored their 24 hour window on time[0] floored to midnight, which selected the wrong day entirely. In create_radclss_columns the window is a .sel(time=slice(...)), so the data was discarded rather than merely clipped: nsaradclssC1.c0.20260713 .235803.nc plotted 2 of its 1440 times. 5 of the 12 RadCLss files on hand were affected, at both NSA and BNF. It went unnoticed because the test fixture starts exactly at 00:00:00. Replace the anchoring with _daily_time_window(), which takes the day from the timestamp the bulk of the samples fall on and then widens the window to keep the pre-midnight leader and any post-midnight tail, so no data is dropped. The derived day agrees with the authoritative -b processing day recorded in each file's command_line attribute for all 12 files tested. Also give the reflectivity panel of the rainfall timeseries the same xlim as the rain rate and accumulation panels, which previously had none and so never aligned, and report the product day in its suptitle. Adds six regression tests built on a synthetic wrap-around dataset that mirrors the NSA file; the two end-to-end tests were confirmed to fail against the pre-fix code. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes a plotting issue where times were cut off if the radclss file begins before midnight.