Skip to main content
`Ctrl`+`K`

# set_enabled_aliases

astropy.units.set_enabled_aliases(aliases)

  Set aliases for units.

  This is useful for handling alternate spellings for units, or misspelled units in files one is trying to read.

  Parameters:
    aliases `python:dict` of `python:str`, `Unit`

      The aliases to set. The keys must be the string aliases, and values must be the `astropy.units.Unit` that the alias will be mapped to.

  Raises:
    `ValueError`

      If the alias already defines a different unit.

  Examples

  To temporarily allow for a misspelled ‘Angstroem’ unit:

      >>> from astropy import units as u
      >>> with u.set_enabled_aliases({'Angstroem': u.Angstrom}):
      ...     print(u.Unit("Angstroem", parse_strict="raise") == u.Angstrom)
      True