Skip to content

Commit

Permalink
Fix dimensionless unit formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
juntyr authored Oct 8, 2024
1 parent 7873725 commit b86f890
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/earthkit/plots/metadata/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ def format_units(units, exponential_notation=False):
>>> format_units("kg m-2")
"$kg m^{-2}$"
"""
latex_str = f"{_pintify(units):~L}"
units = earthkit.plots.metadata.units._pintify(units)
if units.dimensionless:
return "dimensionless"
latex_str = f"{units:~L}"
if exponential_notation:
raise NotImplementedError("Exponential notation is not yet supported.")
return f"${latex_str}$"

0 comments on commit b86f890

Please sign in to comment.