Commit f972bdd
FIX: Zero out bg_weights at height levels with NaN interpolated background
When the sounding doesn't cover the full vertical extent of the grid,
interp1d (bounds_error=False) returns NaN for out-of-range levels.
Previously bg_weights was never zeroed at those levels, so the background
constraint was applied using NaN wind values, corrupting the cost function.
Fix by masking bg_weights wherever u_back or v_back is NaN after
interpolation, and replacing NaN values in u_back/v_back with 0 so
they don't propagate through cost function arithmetic.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 3e54a96 commit f972bdd
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
505 | 514 | | |
506 | 515 | | |
507 | 516 | | |
| |||
0 commit comments