UnrecognizedUnit¶
- class astropy.units.UnrecognizedUnit(st, doc=None, format=None, namespace=None)[source]¶
Bases:
IrreducibleUnitA unit that did not parse correctly. This allows for round-tripping it as a string, but no unit operations actually work on it.
- Parameters:
- st
python:str The name of the unit.
- st
Methods Summary
get_format_name(format)Get a name for this unit that is specific to a particular format.
is_equivalent(other[, equivalencies])Returns
Trueif this unit is equivalent toother.is_unity()Returns
Trueif the unit is unscaled and dimensionless.to_string([format])Output the unit in the given format as a string.
Methods Documentation
- get_format_name(format)[source]¶
Get a name for this unit that is specific to a particular format.
Uses the dictionary passed into the
formatkwarg in the constructor.- Parameters:
- format
python:str The name of the format
- format
- Returns:
- name
python:str The name of the unit for the given format.
- name
- is_equivalent(other, equivalencies=None)[source]¶
Returns
Trueif this unit is equivalent toother.- Parameters:
- other
Unit,python:str, orpython:tuple The unit to convert to. If a tuple of units is specified, this method returns true if the unit matches any of those in the tuple.
- equivalencies
python:listofpython:tuple A list of equivalence pairs to try if the units are not directly convertible. See Equivalencies. This list is in addition to possible global defaults set by, e.g.,
set_enabled_equivalencies. UseNoneto turn off all equivalencies.
- other
- Returns:
- bool
- to_string(format=None)[source]¶
Output the unit in the given format as a string.
- Parameters:
- format
astropy.units.format.Baseinstance orpython:str The name of a format or a formatter object. If not provided, defaults to the generic format.
- format