Generalize ARCH_CYC to work with single cycle or list of cycles#4583
Closed
RussTreadon-NOAA wants to merge 17 commits intoNOAA-EMC:developfrom
Closed
Generalize ARCH_CYC to work with single cycle or list of cycles#4583RussTreadon-NOAA wants to merge 17 commits intoNOAA-EMC:developfrom
RussTreadon-NOAA wants to merge 17 commits intoNOAA-EMC:developfrom
Conversation
- Added Union and Tuple to typing imports - Added _normalize_arch_cyc helper method for DRY ARCH_CYC normalization - Refactored _arch_warm_start_increments with better validation and docstrings - Refactored _arch_warm_restart_ics with improved error handling and case-insensitive RUN matching - Replaced magic number 24 with HOURS_PER_DAY constant - Enhanced docstrings with complete parameter and return documentation - Improved variable names for clarity (cycle_hours, adjusted_cycle_hours) - Added comprehensive error handling with descriptive messages - Used .startswith() for more robust GDAS detection - All changes validated with tests Co-authored-by: RussTreadon-NOAA <[email protected]>
…hods Refactor archive methods for robustness and consistency
…_vars.py Co-authored-by: RussTreadon-NOAA <[email protected]>
…yc-usage Generalize ARCH_CYC to support multiple cycle hours
Contributor
There was a problem hiding this comment.
Pull request overview
This PR generalizes the ARCH_CYC configuration parameter to support both single integer cycles and lists of cycles, allowing users to archive warm start restarts at multiple cycle hours (e.g., "0 12" for both 0Z and 12Z).
Changes:
- Extended ARCH_CYC parsing in
archive_tar_vars.pyto handle integers, strings (space-separated), lists, and tuples - Added
_normalize_arch_cyc()helper method inarchive.pywith robust type validation and error handling - Updated
_arch_warm_start_increments()and_arch_warm_restart_ics()methods to iterate over lists of cycle hours instead of checking single values - Enhanced documentation with detailed numpy-style docstrings explaining parameters, returns, and the GDAS IC lag behavior
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| ush/python/pygfs/utils/archive_tar_vars.py | Added inline ARCH_CYC parsing logic (lines 418-426) and updated archive timing boolean logic to use in and any() checks for list membership (lines 437, 448) |
| ush/python/pygfs/task/archive.py | Added _normalize_arch_cyc() method with type validation, enhanced _arch_warm_start_increments() and _arch_warm_restart_ics() with improved error handling and list-based cycle hour checks, added comprehensive numpy-style docstrings |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Contributor
Author
|
@copilot open a new pull request to apply changes based on the comments in this thread |
1 similar comment
Contributor
Author
|
@copilot open a new pull request to apply changes based on the comments in this thread |
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.
Description
The changes in this PR allow
ARCH_CYCto be either a single integer cycle or a list of integer cycles.Resolves #4565
Type of change
Change characteristics
How has this been tested?
Checklist