Fix baseline_hist_locs set to None causing TypeError (#422)#441
Open
Fix baseline_hist_locs set to None causing TypeError (#422)#441
Conversation
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.
Addresses issue: baseline_hist_locs set to None #422
Problem
In adf_info.py, when baseline_ts_done is True, the first branch sets baseline_hist_locs = None. The second branch then unconditionally called any(baseline_hist_locs), which raises TypeError: 'NoneType' object is not iterable. Even when baseline_ts_done is False, if cam_hist_loc is not provided in the config, the same crash occurs.
Changes in lib/adf_info.py
Changed if any(baseline_hist_locs): to elif baseline_hist_locs and any(baseline_hist_locs): — makes the two year-finding branches mutually exclusive (matching the intended logic) and guards against None when neither time series nor history files are configured.
Removed a duplicate file_list = sorted(...) glob call that executed before the is_dir() check; the same call already existed after the check.
Removed a redundant base_nickname assignment block that was inside the history-files branch but was immediately overwritten by the identical block that runs unconditionally just below it.