Skip to content

Commit 883283d

Browse files
committed
o Warn if step size is < 0.1
1 parent e62d2a2 commit 883283d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

uxarray/core/dataarray.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,11 @@ def zonal_mean(self, lat=(-90, 90, 10), conservative: bool = False, **kwargs):
568568
start, end, step = lat
569569
if step <= 0:
570570
raise ValueError("Step size must be positive.")
571+
if step < 0.1:
572+
warnings.warn(
573+
f"Very small step size ({step}°) may lead to performance issues...",
574+
UserWarning, stacklevel=2
575+
)
571576
num_points = int(round((end - start) / step)) + 1
572577
latitudes = np.linspace(start, end, num_points)
573578
latitudes = np.clip(latitudes, -90, 90)
@@ -610,6 +615,11 @@ def zonal_mean(self, lat=(-90, 90, 10), conservative: bool = False, **kwargs):
610615
raise ValueError(
611616
"Step size must be positive for conservative averaging."
612617
)
618+
if step < 0.1:
619+
warnings.warn(
620+
f"Very small step size ({step}°) may lead to performance issues...",
621+
UserWarning, stacklevel=2
622+
)
613623
num_points = int(round((end - start) / step)) + 1
614624
edges = np.linspace(start, end, num_points)
615625
edges = np.clip(edges, -90, 90)

0 commit comments

Comments
 (0)