Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed May 16, 2022
1 parent a68e0f3 commit 6298bb7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions yt/fields/field_info_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,11 +473,19 @@ def alias(
if units is None:
# We default to CGS here, but in principle, this can be pluggable
# as well.
u = Unit(self[original_name].units, registry=self.ds.unit_registry)
if u.dimensions is not dimensionless:
units = str(self.ds.unit_system[u.dimensions])

# self[original_name].units may be set to `None` at this point
# to signal that units should be autoset later
oru = self[original_name].units
if oru is None:
units = None
else:
units = self[original_name].units
u = Unit(oru, registry=self.ds.unit_registry)
if u.dimensions is not dimensionless:
units = str(self.ds.unit_system[u.dimensions])
else:
units = oru

self.field_aliases[alias_name] = original_name
function = TranslationFunc(original_name)
if deprecate is not None:
Expand Down

0 comments on commit 6298bb7

Please sign in to comment.