Skip to content

Commit 45ef80e

Browse files
committed
dev
1 parent 1e03f99 commit 45ef80e

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

cf/mixin/fielddomain.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
bounds_combination_mode,
1919
normalize_slice,
2020
)
21-
from ..query import Query, wi
21+
from ..query import Query, wi, wo
2222
from ..units import Units
2323

2424
logger = logging.getLogger(__name__)
@@ -455,8 +455,8 @@ def _indices(self, config, data_axes, ancillary_mask, kwargs):
455455
if debug:
456456
logger.debug(" 1-d CASE 2:") # pragma: no cover
457457

458-
value0, value1 = value.value
459-
if value1 < value0:
458+
arg0, arg1 = value.value
459+
if arg0 > arg1:
460460
# Query has swapped operands (i.e. arg0 >
461461
# arg1) => Create a new equivalant Query
462462
# that has the arg0 < arg1. E.g. for a
@@ -470,10 +470,13 @@ def _indices(self, config, data_axes, ancillary_mask, kwargs):
470470
period = item.period()
471471
value = value.copy()
472472
value.set_condition_units(period.Units)
473-
value0, value1 = value.value
474-
n = ((value0 - value1) / period).ceil()
475-
value1 = value1 + n * period
476-
value = wi(value0, value1)
473+
arg0, arg1 = value.value
474+
n = ((arg0 - arg1) / period).ceil()
475+
arg1 = arg1 + n * period
476+
if value.operator == "wi":
477+
value = wi(arg0, arg1)
478+
else:
479+
value = wo(arg0, arg1)
477480

478481
size = item.size
479482
if item.increasing:

0 commit comments

Comments
 (0)