Skip to content

Composite units with strange unicode symbols do not work #17010

@mhvk

Description

@mhvk

Description

One can use units like "M⊙" work but "M⊙/yr" does not. The problem is special-casing of non-composite units (which does work), but in composite units it appears the solar symbol is not recognized as being part of the M.

Expected behavior

I'd expect composite units to work as well.

How to Reproduce

import astropy.units as u
u.Unit("M⊙/yr")
ValueError: 'M⊙/yr' did not parse as unit: At col 0, M is not a valid unit. Did you mean m? If this is meant to be a custom unit, define it with 'u.def_unit'. To have it recognized inside a file reader or other code, enable it with 'u.add_enabled_units'. For details, see https://docs.astropy.org/en/latest/units/combining_and_defining.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions