Skip L2 processing if no good times are found#2775
Skip L2 processing if no good times are found#2775vmartinez-cu wants to merge 6 commits intoIMAP-Science-Operations-Center:devfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements early exit from L2 processing when no good times are found in the L1B input dataset, addressing issue #2372. The solution uses a factory method pattern to validate data before processing and returns an empty list instead of creating invalid output files.
Changes:
- Added a factory class method
HistogramL2.create()that checks for good times before instantiation - Refactored
HistogramL2.__init__()to accept pre-filtered data, removing validation logic from the constructor - Updated
glows_l2()to handle None return from factory method and log warnings appropriately
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| imap_processing/glows/l2/glows_l2_data.py | Added factory method create() for validation and filtering; refactored constructor to accept only good data; fixed spelling in error message |
| imap_processing/glows/l2/glows_l2.py | Updated to use factory method; added logging for no-good-times case; returns empty list when appropriate |
| imap_processing/tests/glows/test_glows_l2.py | Added test case for HistogramL2.create() returning None when no good times exist |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
maxinelasp
left a comment
There was a problem hiding this comment.
I think this implementation method is confusing - could you remove the class method and rework the logic slightly?
| bad_time_flag_occurrences: np.ndarray | ||
|
|
||
| def __init__(self, l1b_dataset: xr.Dataset, pipeline_settings: PipelineSettings): | ||
| def __init__(self, good_l1b_data: xr.Dataset): |
There was a problem hiding this comment.
PipelineSettings has other data in it that needs to be used for future L2 functionality, so it still needs to be included in this init
There was a problem hiding this comment.
Didn't know about future L2 functionality. Can you expand on that?
…gramL2 object. Returns if no good data exists
…d so an empty list is returned
…an L1B dataset with no good times
…and check for empty data in glows_l2.py for appropriate output
ecf3753 to
2f62665
Compare
|
Updates made and ready for review |
|
and nice work!!! |
This PR updates L2 processing to exit processing early and return an empty list if no good times are found in the l1b input dataset.
File changes
glows_l2_data.py - added a factory class method that checks if good times exist before proceeding with creating the l2 histogram data class. If no good times are found, it returns None
glows_l2.py - updated call to the histogram data class to use new class method to create the instance
Testing
Closes #2372