We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9519d0d commit 8afa1efCopy full SHA for 8afa1ef
yt/fields/derived_field.py
@@ -517,12 +517,15 @@ def wrapped(field, data):
517
other_units = self.ds.get_unit_from_registry(other.units)
518
519
else:
520
+ # Special case when passing (value, "unit") tuple
521
+ if isinstance(other, tuple) and len(other) == 2:
522
+ other = self.ds.quan(*other)
523
524
def wrapped(field, data):
525
return op(self(data), other)
526
527
other_name = str(other)
- other_units = self.ds.get_unit_from_registry(getattr(other, "units", "1"))
528
+ other_units = getattr(other, "units", self.ds.get_unit_from_registry("1"))
529
530
if op in (operator.add, operator.sub, operator.eq):
531
assert my_units.same_dimensions_as(other_units)
0 commit comments