Estimate the graph size during a rechunk computation.
(old_chunks, new_chunks)
| 416 | |
| 417 | |
| 418 | def estimate_graph_size(old_chunks, new_chunks): |
| 419 | """Estimate the graph size during a rechunk computation.""" |
| 420 | # Estimate the number of intermediate blocks that will be produced |
| 421 | # (we don't use intersect_chunks() which is much more expensive) |
| 422 | crossed_size = reduce( |
| 423 | mul, |
| 424 | ( |
| 425 | (len(oc) + len(nc) - 1 if oc != nc else len(oc)) |
| 426 | for oc, nc in zip(old_chunks, new_chunks) |
| 427 | ), |
| 428 | ) |
| 429 | return crossed_size |
| 430 | |
| 431 | |
| 432 | def divide_to_width(desired_chunks, max_width): |
no outgoing calls
no test coverage detected