Skip to content

Commit 0a21cb4

Browse files
committed
catch coordinate size <= 1, fix log typo
1 parent 06f9722 commit 0a21cb4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

yt_xarray/accessor/_xr_to_yt.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ def _process_selection(self, xr_ds):
137137
coord_da = getattr(xr_ds, c) # the full coordinate data array
138138

139139
# check if coordinate values are increasing
140-
rev_ax = coord_da[1] <= coord_da[0]
141-
reverse_axis.append(bool(rev_ax.values))
140+
if coord_da.size > 1:
141+
rev_ax = coord_da[1] <= coord_da[0]
142+
reverse_axis.append(bool(rev_ax.values))
142143

143144
# store the global ranges
144145
global_dims.append(coord_da.size)
@@ -281,7 +282,7 @@ def interp_validation(self, geometry):
281282

282283
elif geometry in ("geographic", "internal_geographic"):
283284
msg = (
284-
" Geodetic geometry bounds exceeded: yt_xarray will interpolate"
285+
" Geodetic geometry bounds exceeded: yt_xarray will interpolate."
285286
)
286287
# check if still within bounds, if not, require interpolation
287288
for idim, dim in enumerate(self.selected_coords):
@@ -297,7 +298,7 @@ def interp_validation(self, geometry):
297298
# should be OK to pad cells
298299
ytxr_log.info(
299300
" Geodetic geometry on uniform grid within geodetic "
300-
"bounds: yt_xarray will interpolate"
301+
"bounds: yt_xarray will not interpolate."
301302
)
302303
return False, self.selected_shape, bbox
303304

0 commit comments

Comments
 (0)