Extract shared HRRR virtual base (move-only refactor, no new datasets)#743
Draft
mrshll wants to merge 2 commits into
Draft
Extract shared HRRR virtual base (move-only refactor, no new datasets)#743mrshll wants to merge 2 commits into
mrshll wants to merge 2 commits into
Conversation
…paths
Byte-for-byte copies of forecast_48_hour_virtual/{template_config,region_job}.py
at their new shared locations, with no edits, so the following commit's diff
shows exactly what the extraction changes relative to the shipped code.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSMv3HgaxKHdUaLk56bXxt
…alRegionJob Edit the verbatim copies from the previous commit into the shared form: forecast_virtual_template_config.py keeps the full variable catalog, coordinate builders, and encoding factories unchanged and turns the class head into NoaaHrrrForecastVirtualTemplateConfig with per-variant hooks (forecast_length, dataset-identity attributes via _dataset_attributes, expected-forecast-length values/statistics, _catalog_data_vars, and dims-driven vertical coordinates); forecast_virtual_region_job.py renames the coord and job classes to the shared NoaaHrrrForecastVirtual* names and adds the hrrr_virtual_chunk_containers factory. The 48-hour dataset becomes thin subclasses with unchanged public class names and module paths, and its checked-in template regenerates byte-identically. The single-polling-job operational_update_jobs, previously duplicated line-for-line by this dataset and GEFS 10-day spatial, moves to common VirtualRegionJob parameterized by an operational_update_window classvar; GEFS sets its 24h window and example_virtual's stub becomes a classvar teaching note. A construction-time guard rejects a virtual dataset whose region job uses the default update factory without declaring the window. Cache the HRRR latitude/longitude grid computation, which every HRRR dataset shares and each template build requests once per zarr group. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PSMv3HgaxKHdUaLk56bXxt
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.
Summary
Move-only refactor extracting a shared HRRR virtual base from the shipped
noaa-hrrr-forecast-48-hour-virtual, structured for byte-fidelity review. No new datasets — those stack on top in #740.Copy-then-edit structure
Two commits, deliberately:
Copy 48-hour virtual template config and region job to shared module paths— byte-for-bytecpof the two files tonoaa/hrrr/forecast_virtual_template_config.pyandforecast_virtual_region_job.py, zero edits.Extract shared HRRR virtual base; hoist windowed update jobs to VirtualRegionJob— the actual refactor. Because commit 1 is verbatim, this commit's diff on the 2,100-line catalog file is just +100/−76 — the ~1,900 lines of variable definitions, factories, and filters are provably untouched.What the edit commit does
NoaaHrrrForecastVirtualTemplateConfigbase with per-variant hooks (forecast_length,_dataset_attributes, expected-forecast-length values/statistics,_catalog_data_vars, dims-driven vertical coordinates); the 48-hour dataset becomes thin subclasses with unchanged public class names, module path, and template location.NoaaHrrrForecastVirtualSourceFileCoord/NoaaHrrrForecastVirtualRegionJob; the single-polling-joboperational_update_jobs— previously duplicated line-for-line by this dataset and GEFS 10-day spatial — moves to commonVirtualRegionJobparameterized by anoperational_update_windowclassvar. GEFS migrates onto it (sets its 24h window);example_virtual's stub becomes a classvar teaching note; a construction-time guard rejects a virtual dataset using the default update factory without a declared window.docs/virtual_datasets.mdimplementer contract updated; ruffRUF012per-file-ignore glob widened for the shared module name.Verification
uv run main noaa-hrrr-forecast-48-hour-virtual update-templateregenerates the checked-in template with zero diff on this branch.Stack
#740 (18-hour + 48-hour-fast datasets) is based on this branch.
🤖 Generated with Claude Code
Generated by Claude Code