Skip to content

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

Open
brianpm wants to merge 30 commits into
NCAR:mainfrom
brianpm:main
Open

Fix baseline_hist_locs set to None causing TypeError (#422)#441
brianpm wants to merge 30 commits into
NCAR:mainfrom
brianpm:main

Conversation

@brianpm

@brianpm brianpm commented Feb 26, 2026

Copy link
Copy Markdown
Collaborator

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.

justin-richling and others added 30 commits August 30, 2024 16:21
Pull these checks and calculations out of `adf-diag.py` to clean that file up.
Now call the `adf_derive.py` script for derived variables
Pull these checks and calculations out of `adf-diag.py` to clean that file up.
Now call the `adf_derive.py` script for derived variables
This is now being generated in `adf_derive.py`
Handle empty dict if no git info is available
Sometimes the climo file generation hangs, this seems to consistently fix the issue
Bring in climo file hanging during creation fix
Fix `None` for `fils` in `load_reference_climo_da`
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.

3 participants