Skip to content

LDF updates: config and divide by 0 - #514

Merged
wwieder merged 4 commits into
NCAR:ldf-native-grid-merge-mainfrom
wwieder:ldf-native-grid-merge-main
Nov 11, 2026
Merged

wwieder merged 4 commits into
NCAR:ldf-native-grid-merge-mainfrom
wwieder:ldf-native-grid-merge-main

Conversation

@wwieder

@wwieder wwieder commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

Hey, @richling-ucar the previous PR didn't make it onto the ldf branch.
I also realized the regular lat-lon plots suffered from divide by zero issues. This is fixed (by claude) now.

@wwieder
wwieder merged commit d5c49dc into NCAR:ldf-native-grid-merge-main Nov 11, 2026
@wwieder

wwieder commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator Author

I merged this (so we can use the config file in the tutorial), but would appreciate a check on the divide by zero suggestion claude and I made.

@richling-ucar

richling-ucar commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

@wwieder Great, this has been an issue so thanks for trying to tackle it.

The divide-by-zero change was right: one path for lat/lon and native grids, and a zero baseline now gives NaN instead of a warning or inf.

Only problem I saw was with rel_tol =None(what atmosphere used), only exact zeros were blanked. Tiny non-zero baselines still tended to blow up the percent panel; SHFLX vs OAFlux had a mean of about −1e11 %.

I built on your changes, array_diff(percent=True) now uses pct_change, which blanks cells where |baseline| is under 1% of the area-mean |baseline| (the same rule for atm and lnd). The panel header now shows the % change of the area means instead of the mean of the per-cell %.

The current version of this dev branch now has an added layer, but didn't change your code.

Thanks!

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.

2 participants