Commit 2d6c4b9
fix(waterdata): make parallel_chunks cap a hard ceiling in ChunkPlan._refine
_refine grew the plan with `while self.total < max_chunks`, but with more
than one axis a single split multiplies total by (k+1)/k for the split axis
— it adds the product of the *other* axes, not one — so total could step
*past* the cap (two 8-atom axes at cap 10 landed on 12; three 10-atom axes
at cap 30 landed on 32). That broke the documented "at most n / can't
multiply past it" guarantee the dial exists to provide.
Take a split only when it keeps total within the cap: skip any axis whose
split would overshoot (the increment is per-axis, total // k). The cap is
now a true ceiling — never exceeded — and the plan lands below it when no
whole split hits it exactly (two even axes reach 4, not 5). Single-axis
plans are unchanged (still hit n exactly, or saturate at one atom/chunk).
Docstrings updated (soft cap -> hard ceiling; note the may-undershoot).
Repurpose the many-axes test to a cap the old loop overshot (30, was 32)
and add a parametrized regression over the 2-axis overshoot combos.
Signed-off-by: thodson-usgs <thodson@usgs.gov>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 28a23e2 commit 2d6c4b9
3 files changed
Lines changed: 87 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
231 | 234 | | |
232 | 235 | | |
233 | 236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | | - | |
| 333 | + | |
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | | - | |
340 | | - | |
341 | | - | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
342 | 343 | | |
343 | 344 | | |
344 | 345 | | |
| |||
502 | 503 | | |
503 | 504 | | |
504 | 505 | | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
512 | 519 | | |
513 | 520 | | |
514 | 521 | | |
515 | 522 | | |
516 | | - | |
| 523 | + | |
517 | 524 | | |
518 | 525 | | |
519 | | - | |
| 526 | + | |
| 527 | + | |
520 | 528 | | |
521 | 529 | | |
522 | 530 | | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
527 | 543 | | |
528 | 544 | | |
529 | 545 | | |
530 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
531 | 550 | | |
532 | 551 | | |
533 | 552 | | |
534 | 553 | | |
535 | 554 | | |
536 | | - | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
537 | 558 | | |
538 | 559 | | |
539 | 560 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2237 | 2237 | | |
2238 | 2238 | | |
2239 | 2239 | | |
2240 | | - | |
2241 | | - | |
2242 | | - | |
2243 | | - | |
2244 | | - | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
2245 | 2249 | | |
2246 | | - | |
| 2250 | + | |
2247 | 2251 | | |
2248 | 2252 | | |
2249 | 2253 | | |
2250 | 2254 | | |
2251 | 2255 | | |
2252 | | - | |
2253 | | - | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
2254 | 2286 | | |
2255 | 2287 | | |
2256 | 2288 | | |
| |||
0 commit comments