gavo.imp.astropyucd module

This file contains routines to verify the correctness of UCD strings.

MD, 2021: I’m forking this here to develop it a bit. The main changes ought to go back to astropy when this has stabilised.

gavo.imp.astropyucd.check_ucd(ucd, check_controlled_vocabulary=False, has_colon=False)[source]

Returns False if ucd is not a valid `unified content descriptor`_.

Parameters

ucdstr

The UCD string

check_controlled_vocabularybool, optional

If True, then each word in the UCD will be verified against the UCD1+ controlled vocabulary, (as required by the VOTable specification version 1.2), otherwise not.

has_colonbool, optional

If True, the UCD may contain a colon (as defined in earlier versions of the standard).

Returns

valid : bool

gavo.imp.astropyucd.parse_ucd(ucd, check_controlled_vocabulary=True, has_colon=False)[source]

Parse the UCD into its component parts.

Parameters

ucdstr

The UCD string

check_controlled_vocabularybool, optional

If True, then each word in the UCD will be verified against the UCD1+ controlled vocabulary, (as required by the VOTable specification version 1.2), otherwise not.

has_colonbool, optional

If True, the UCD may contain a colon (as defined in earlier versions of the standard).

Returns

partslist

The result is a list of tuples of the form:

(namespace, word)

If no namespace was explicitly specified, namespace will be returned as 'ivoa' (i.e., the default namespace).

Raises

ValueError : ucd is invalid