-
Notifications
You must be signed in to change notification settings - Fork 22
Lo L1c GoodTime Filter Fix #2758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,7 +87,13 @@ def lo_l1c(sci_dependencies: dict, anc_dependencies: list) -> list[xr.Dataset]: | |
| logical_source = "imap_lo_l1c_pset" | ||
| l1b_de = sci_dependencies["imap_lo_l1b_de"] | ||
| l1b_goodtimes_only = filter_goodtimes(l1b_de, anc_dependencies) | ||
| # TODO: Need to handle case where no good times are found | ||
|
|
||
| # Handle case where no good times are found; if we don't bail | ||
| # here, then later background rates determination will fail | ||
| if l1b_goodtimes_only["epoch"].size == 0: | ||
| logging.warning("No good times found for L1B DE dataset.") | ||
| return [] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will cause L1C to succeed but produce no L1C file. Is that the desired behavior? Or should it raise an exception so that we see the job failed?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's an excellent question that I was hoping someone would raise--it seems to me to be a philosophy/approach that the SDC needs to adopt for all instruments. I wasn't sure if this scenario had been seen or thought of before, so I was fishing for direction here... For now, this works as you indicate--I've tested with flight data that on certain days has no GoodTimes (so far?).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there handling in place for returning an empty list?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've tested it and it works--no CDF product is created. See reply below for more info. |
||
|
|
||
| # Set the pointing start and end times based on the first epoch | ||
| pointing_start_met, pointing_end_met = get_pointing_times( | ||
| ttj2000ns_to_met(l1b_goodtimes_only["epoch"][0].item()) | ||
|
|
@@ -228,7 +234,7 @@ def filter_goodtimes(l1b_de: xr.Dataset, anc_dependencies: list) -> xr.Dataset: | |
| l1b_de : xarray.Dataset | ||
| Filtered L1B Direct Event dataset. | ||
| """ | ||
| # the goodtimes are currently the only ancillary file needed for L1C processing | ||
| # The goodtimes are one of several ancillary files needed for L1C processing | ||
| goodtimes_table_df = lo_ancillary.read_ancillary_file( | ||
| next(str(s) for s in anc_dependencies if "good-times" in str(s)) | ||
| ) | ||
|
|
@@ -1063,8 +1069,8 @@ def set_background_rates( | |
| # TODO: This assumes that the backgrounds will never change mid-pointing. | ||
| # Is that a safe assumption? | ||
| pointing_bg_df = background_df[ | ||
| (background_df["GoodTime_start"] <= pointing_start_met) | ||
| & (background_df["GoodTime_end"] >= pointing_end_met) | ||
| (background_df["GoodTime_start"] < pointing_end_met) | ||
| & (background_df["GoodTime_end"] > pointing_start_met) | ||
| ] | ||
|
|
||
| # convert the bin start and end resolution from 6 degrees to 0.1 degrees | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will you please add test coverage for this if block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do.