cfunits.Units.reason_notvalid

Units.reason_notvalid

The reason that units are considered invalid.

If the units are valid then the reason is an empty string.

See also

isvalid

Examples

>>> u = Units('km')
>>> u.isvalid
True
>>> u.reason_notvalid
''
>>> u = Units('Bad Units')
>>> u.isvalid
False
>>> u.reason_notvalid
"Invalid units: 'Bad Units'; Not recognised by UDUNITS"
>>> u = Units('days since 2000-1-1', calendar='Bad Calendar')
>>> u.isvalid
False
>>> u.reason_notvalid
"Invalid calendar='Bad Calendar'; calendar must be one of ['standard', 'gregorian', 'proleptic_gregorian', 'noleap', 'julian', 'all_leap', '365_day', '366_day', '360_day'], got 'bad calendar'"