Skip to content

Commit 5decf3f

Browse files
committed
report requested dst_grid_partitions
1 parent 6a7f15a commit 5decf3f

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

cf/regrid/regrid.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,9 @@ def regrid(
638638
esmpy_regrid_operator = [] if return_esmpy_regrid_operator else None
639639

640640
# Find the actual number of partitions
641+
requested_dst_grid_partitions = dst_grid_partitions
641642
dst_grid_partitions = partitions(
642-
dst_grid, dst_grid_partitions, return_n=True
643+
dst_grid, requested_dst_grid_partitions, return_n=True
643644
)
644645

645646
# Create regrid weights
@@ -654,6 +655,7 @@ def regrid(
654655
esmpy_regrid_operator=esmpy_regrid_operator,
655656
weights_file=weights_file,
656657
dst_grid_partitions=dst_grid_partitions,
658+
requested_dst_grid_partitions=requested_dst_grid_partitions,
657659
)
658660

659661
if return_esmpy_regrid_operator:
@@ -2455,6 +2457,7 @@ def create_esmpy_weights(
24552457
esmpy_regrid_operator=None,
24562458
weights_file=None,
24572459
dst_grid_partitions=1,
2460+
requested_dst_grid_partitions=1,
24582461
):
24592462
"""Create the `esmpy` regridding weights.
24602463
@@ -2510,7 +2513,14 @@ def create_esmpy_weights(
25102513
.. versionadded:: 3.15.2
25112514
25122515
dst_grid_partitions: `int`, optional
2513-
The number of destination grid partitions.
2516+
The actual number of destination grid partitions to be
2517+
used.
2518+
2519+
.. versionadded:: NEXTVERSION
2520+
2521+
requested_dst_grid_partitions: `int` or `str`, optional
2522+
The requested number of destination grid
2523+
partitions. Either an integer, or ``'maximum'``.
25142524
25152525
.. versionadded:: NEXTVERSION
25162526
@@ -2581,11 +2591,12 @@ def create_esmpy_weights(
25812591
logger.debug(
25822592
"Calculating weights ...\n\n"
25832593
"Number of destination grid partitions: "
2584-
f"{dst_grid_partitions}\n"
2594+
f"{dst_grid_partitions} "
2595+
f"({requested_dst_grid_partitions!r} requested)\n"
25852596
"Free memory before weights creation: "
25862597
f"{free_memory() / 2**30} GiB\n"
25872598
"Maximum RSS before weights creation: "
2588-
f"{maxrss * 1000/ 2**30} GiB\n"
2599+
f"{maxrss * 1000 / 2**30} GiB\n"
25892600
) # pragma: no cover
25902601

25912602
# Create the weights using ESMF
@@ -2692,7 +2703,7 @@ def create_esmpy_weights(
26922703
f"Partition {i}: Time taken by ESMF to create weights: "
26932704
f"{time() - start_time} s\n"
26942705
f"Partition {i}: Maximum RSS after ESMF weights creation: "
2695-
f"creation: {maxrss * 1000/ 2**30} GiB"
2706+
f"creation: {maxrss * 1000 / 2**30} GiB"
26962707
) # pragma: no cover
26972708
start_time = time() # pragma: no cover
26982709

0 commit comments

Comments
 (0)