Skip to content

Fix baseline_hist_locs set to None causing TypeError (#422)#441

Open
brianpm wants to merge 2 commits intoNCAR:mainfrom
brianpm:main
Open

Fix baseline_hist_locs set to None causing TypeError (#422)#441
brianpm wants to merge 2 commits intoNCAR:mainfrom
brianpm:main

Conversation

@brianpm
Copy link
Collaborator

@brianpm brianpm commented Feb 26, 2026

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant