Skip to content

Commit 3acbdf0

Browse files
committed
dummy_size_1_dimension
1 parent 730c47a commit 3acbdf0

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

cf/regrid/regrid.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,13 @@ class Grid:
8585
cyclic: Any = None
8686
# The regridding method.
8787
method: str = ""
88-
# If True then, for 1-d regridding, the esmpy weights are generated
89-
# for a 2-d grid for which one of the dimensions is a size 2 dummy
90-
# dimension.
88+
# If True then, for Cartesian 1-d conservative regridding, the
89+
# esmpy weights are generated for a 2-d grid for which one of the
90+
# dimensions is a size 1 dummy dimension.
91+
dummy_size_1_dimension: bool = False
92+
# If True then, for Cartesian 1-d non-conservative regridding, the
93+
# esmpy weights are generated for a 2-d grid for which one of the
94+
# dimensions is a size 2 dummy dimension.
9195
dummy_size_2_dimension: bool = False
9296
# Whether or not the grid is a structured grid.
9397
is_grid: bool = False
@@ -1668,6 +1672,7 @@ def Cartesian_grid(f, name=None, method=None, axes=None, z=None, ln_z=None):
16681672

16691673
bounds = get_bounds(method, coords, mesh_location)
16701674

1675+
dummy_size_1_dimension = False
16711676
dummy_size_2_dimension = False
16721677
if not (mesh_location or featureType) and len(coords) == 1:
16731678
# Create a dummy axis because esmpy doesn't like creating
@@ -1678,6 +1683,7 @@ def Cartesian_grid(f, name=None, method=None, axes=None, z=None, ln_z=None):
16781683
# size 1
16791684
coords.append(np.array([0.0]))
16801685
bounds.append(np.array([data]))
1686+
dummy_size_1_dimension = True
16811687
else:
16821688
# For linear regridding the extra dimension must be size 2
16831689
coords.append(data)
@@ -1708,6 +1714,7 @@ def Cartesian_grid(f, name=None, method=None, axes=None, z=None, ln_z=None):
17081714
coords=coords,
17091715
bounds=bounds,
17101716
cyclic=cyclic,
1717+
dummy_size_1_dimension=dummy_size_1_dimension,
17111718
dummy_size_2_dimension=dummy_size_2_dimension,
17121719
is_mesh=is_mesh,
17131720
is_locstream=is_locstream,
@@ -3526,6 +3533,7 @@ def partitions(grid, grid_partitions, return_n=False):
35263533
if (
35273534
grid_partitions == 1
35283535
or grid.name == "source"
3536+
or grid.dummy_size_1_dimension
35293537
or grid.dummy_size_2_dimension
35303538
):
35313539
# One partition

0 commit comments

Comments
 (0)