Skip to content

Commit

Permalink
Parse with packaging version
Browse files Browse the repository at this point in the history
  • Loading branch information
bjlittle committed Sep 4, 2020
1 parent a9c9fa1 commit b77c18a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/iris/quickplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
"""

import packaging

import cf_units
from matplotlib import __version__ as mpl_version
from matplotlib import __version__ as _mpl_version
import matplotlib.pyplot as plt

import iris.config
Expand Down Expand Up @@ -49,7 +51,9 @@ def _title(cube_or_coord, with_units):
units = units.symbol
if units.is_time_reference():
# iris.plot uses matplotlib.dates.date2num, which is fixed to the below unit.
if mpl_version >= "3.3":
if packaging.version.parse(
_mpl_version
) >= packaging.version.parse("3.3"):
days_since = "1970-01-01"
else:
days_since = "0001-01-01"
Expand Down

0 comments on commit b77c18a

Please sign in to comment.