Coverage for /home/sadie/cfunits/cfunits/__init__.py : 79%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1'''A python interface to UNIDATA's UDUNITS-2 package with CF extensions
3Store, combine and compare physical units and convert numeric values
4to different units.
6Units are as defined in UNIDATA's UDUNITS-2 package , except for
7reference time units (such as 'days since 2000-12-1' in the
8'proleptic_gregorian' calendar), which are handled by the `cftime`
9python package.
11In addition, some units are either new to, modified from, or removed
12from the standard UDUNITS-2 database in order to be more consistent
13with the CF conventions.
15'''
17__Conventions__ = 'CF-1.8'
18__author__ = 'David Hassell'
19__author__ = 'David Hassell'
20__date__ = '2020-07-24'
21__version__ = '3.2.9'
22__cf_version__ = '1.8'
24from distutils.version import LooseVersion
25import platform
27try:
28 import cftime
29except ImportError as error1:
30 raise ImportError(error1)
32# Check the version of python
33_minimum_vn = '3.5'
34if LooseVersion(platform.python_version()) < LooseVersion(_minimum_vn):
35 raise RuntimeError(
36 "Bad python version: cfunits requires python version {} or later. "
37 "Got {}".format(
38 _minimum_vn, platform.python_version()))
40# Check the version of cftime
41_minimum_vn = '1.2.1'
42if LooseVersion(cftime.__version__) < LooseVersion(_minimum_vn):
43 raise ValueError(
44 "Bad cftime version: cfunits requires cftime>={}. Got {} at {}".format(
45 _minimum_vn, cftime.__version__, cftime.__file__))
47from .units import Units