astropy.io.votable.exceptions
#
Contents
-
-
W11: The gref attribute on LINK is deprecated in VOTable 1.1
W12: ‘x’ element must have at least one of ‘ID’ or ‘name’ attributes
W19: The fields defined in the VOTable do not match those in the embedded FITS file
W21: astropy.io.votable is designed for VOTable version 1.1, 1.2, 1.3, and 1.4, but this file is x
W22: The DEFINITIONS element is deprecated in VOTable 1.1. Ignoring
W24: The VO catalog database is for a later version of astropy.io.votable
W31: NaN given in an integral field without a specified null value
W36: null value ‘x’ does not match field datatype, setting to 0
W41: An XML namespace is specified, but is incorrect. Expected ‘x’, got ‘y’
W44: VALUES element with ref attribute has content (‘element’)
W46: char or unicode value is too long for specified length of x
W52: The BINARY2 format was introduced in VOTable 1.3, but this file is declared as version ‘1.2’
W53: VOTABLE element must contain at least one RESOURCE element.
W54: The TIMESYS element was introduced in VOTable 1.4, but this file is declared as version ‘1.3’
W55: FIELD () has datatype=”char” but contains non-ASCII value ()
W56: The fields defined in the VOTable do not match those in the embedded PARQUET file
-
E01: Invalid size specifier ‘x’ for a char/unicode field (in field ‘y’)
E02: Incorrect number of elements in array. Expected multiple of x, got y
E20: Data has more columns than are defined in the header (x)
E21: Data has fewer columns (x) than are defined in the header (y)
E24: Attempt to write non-ASCII value () to FIELD () which has datatype=”char”
E26: Mapping block can not be set in a RESOURCE with type=result
-
VOTable exceptions and warnings.
Warnings#
Note
Most of the following warnings indicate violations of the VOTable specification. They should be reported to the authors of the tools that produced the VOTable file.
To control the warnings emitted, use the standard Python
warnings
module and the astropy.io.votable.exceptions.conf.max_warnings
configuration item. Most of these are of the type VOTableSpecWarning
.
W01: Array uses commas rather than whitespace#
Array uses commas rather than whitespace.
The VOTable spec states:
If a cell contains an array or complex number, it should be encoded as multiple numbers separated by whitespace.
Many VOTable files in the wild use commas as a separator instead, and
astropy.io.votable
can support this convention depending on the Verifying VOTables setting.
astropy.io.votable
always outputs files using only spaces, regardless of how they were input.
W02: x attribute ‘y’ is invalid. Must be a standard XML id#
Nonstandard XML id.
XML ids must match the following regular expression:
^[A-Za-z_][A-Za-z0-9_\.\-]*$The VOTable 1.1 says the following:
According to the XML standard, the attribute
ID
is a string beginning with a letter or underscore (_
), followed by a sequence of letters, digits, or any of the punctuation characters.
(dot),-
(dash),_
(underscore), or:
(colon).However, this is in conflict with the XML standard, which says colons may not be used. VOTable 1.1’s own schema does not allow a colon here. Therefore,
astropy.io.votable
disallows the colon.VOTable 1.2 corrects this error in the specification.
W03: Implicitly generating an ID from a name ‘x’ -> ‘y’#
Implicitly generating an ID from a name.
The VOTable 1.1 spec says the following about
name
vs.ID
onFIELD
andVALUE
elements:
ID
andname
attributes have a different role in VOTable: theID
is meant as a unique identifier of an element seen as a VOTable component, while thename
is meant for presentation purposes, and need not to be unique throughout the VOTable document. TheID
attribute is therefore required in the elements which have to be referenced, but in principle any element may have anID
attribute. … In summary, theID
is different from thename
attribute in that (a) theID
attribute is made from a restricted character set, and must be unique throughout a VOTable document whereas names are standard XML attributes and need not be unique; and (b) there should be support in the parsing software to look up references and extract the relevant element with matchingID
.It is further recommended in the VOTable 1.2 spec:
While the
ID
attribute has to be unique in a VOTable document, thename
attribute need not. It is however recommended, as a good practice, to assign unique names within aTABLE
element. This recommendation means that, between aTABLE
and its corresponding closingTABLE
tag,name
attributes ofFIELD
,PARAM
and optionalGROUP
elements should be all different.Since
astropy.io.votable
requires a unique identifier for each of its columns,ID
is used for the column name when present. However, whenID
is not present, (since it is not required by the specification)name
is used instead. However,name
must be cleansed by replacing invalid characters (such as whitespace) with underscores.Note
This warning does not indicate that the input file is invalid with respect to the VOTable specification, only that the column names in the record array may not match exactly the
name
attributes specified in the file.
W04: content-type ‘x’ must be a valid MIME content type#
The content-type
attribute must use MIME content-type syntax as
defined in RFC 2046.
The current check for validity is somewhat over-permissive.
W05: ‘x’ is not a valid URI#
The attribute must be a valid URI as defined in RFC 2396.
W06: Invalid UCD ‘x’: explanation#
This warning is emitted when a ucd
attribute does not match
the syntax of a unified content descriptor.
If the VOTable version is 1.2 or later, the UCD will also be checked to ensure it conforms to the controlled vocabulary defined by UCD1+.
W07: Invalid astroYear in x: ‘y’#
Invalid astroYear.
As astro year field is a Besselian or Julian year matching the regular expression:
^[JB]?[0-9]+([.][0-9]*)?$Defined in this XML Schema snippet:
<xs:simpleType name="astroYear"> <xs:restriction base="xs:token"> <xs:pattern value="[JB]?[0-9]+([.][0-9]*)?"/> </xs:restriction> </xs:simpleType>
W08: ‘x’ must be a str or bytes object#
To avoid local-dependent number parsing differences, astropy.io.votable
may require a string or unicode string where a numeric type may
make more sense.
W09: ID attribute not capitalized#
The VOTable specification uses the attribute name ID
(with
uppercase letters) to specify unique identifiers. Some
VOTable-producing tools use the more standard lowercase id
instead. astropy.io.votable
accepts id
and emits this warning if
verify
is 'warn'
.
W10: Unknown tag ‘x’. Ignoring#
The parser has encountered an element that does not exist in the
specification, or appears in an invalid context. Check the file
against the VOTable schema (with a tool such as xmllint. If the file validates
against the schema, and you still receive this warning, this may
indicate a bug in astropy.io.votable
.
W11: The gref attribute on LINK is deprecated in VOTable 1.1#
Earlier versions of the VOTable specification used a gref
attribute on the LINK
element to specify a GLU reference. New files should
specify a glu:
protocol using the href
attribute.
Since astropy.io.votable
does not currently support GLU references, it
likewise does not automatically convert the gref
attribute to
the new form.
W12: ‘x’ element must have at least one of ‘ID’ or ‘name’ attributes#
In order to name the columns of the Numpy record array, each
FIELD
element must have either an ID
or name
attribute
to derive a name from. Strictly speaking, according to the
VOTable schema, the name
attribute is required. However, if
name
is not present by ID
is, and verify
is not 'exception'
,
astropy.io.votable
will continue without a name
defined.
W13: ‘x’ is not a valid VOTable datatype, should be ‘y’#
Invalid VOTable datatype.
Some VOTable files in the wild use non-standard datatype names. These are mapped to standard ones using the following mapping:
string -> char unicodeString -> unicodeChar int16 -> short int32 -> int int64 -> long float32 -> float float64 -> double unsignedInt -> long unsignedShort -> intTo add more datatype mappings during parsing, use the
datatype_mapping
keyword toastropy.io.votable.parse
.
W15: x element missing required ‘name’ attribute#
The name
attribute is required on every FIELD
element.
However, many VOTable files in the wild omit it and provide only
an ID
instead. In this case, when verify
is not 'exception'
astropy.io.votable
will copy the name
attribute to a new ID
attribute.
W17: x element contains more than one DESCRIPTION element#
A DESCRIPTION
element can only appear once within its parent
element.
According to the schema, it may only occur once (1.1, 1.2)
However, it is a proposed extension to VOTable 1.2.
W18: TABLE specified nrows=x, but table contains y rows#
The number of rows explicitly specified in the nrows
attribute
does not match the actual number of rows (TR
elements) present
in the TABLE
. This may indicate truncation of the file, or an
internal error in the tool that produced it. If verify
is not
'exception'
, parsing will proceed, with the loss of some performance.
W19: The fields defined in the VOTable do not match those in the embedded FITS file#
The column fields as defined using FIELD
elements do not match
those in the headers of the embedded FITS file. If verify
is not
'exception'
, the embedded FITS file will take precedence.
W20: No version number specified in file. Assuming 1.1#
If no version number is explicitly given in the VOTable file, the parser assumes it is written to the VOTable 1.1 specification.
W21: astropy.io.votable is designed for VOTable version 1.1, 1.2, 1.3, and 1.4, but this file is x#
Unknown issues may arise using astropy.io.votable
with VOTable files
from a version other than 1.1, 1.2, 1.3, or 1.4.
W22: The DEFINITIONS element is deprecated in VOTable 1.1. Ignoring#
Version 1.0 of the VOTable specification used the DEFINITIONS
element to define coordinate systems. Version 1.1 now uses
COOSYS
elements throughout the document.
W23: Unable to update service information for ‘x’#
Raised when the VO service database can not be updated (possibly due to a network outage). This is only a warning, since an older and possible out-of-date VO service database was available locally.
W24: The VO catalog database is for a later version of astropy.io.votable#
The VO catalog database retrieved from the www is designed for a
newer version of astropy.io.votable
. This may cause problems or limited
features performing service queries. Consider upgrading astropy.io.votable
to the latest version.
W25: ‘service’ failed with: …#
A VO service query failed due to a network error or malformed arguments. Another alternative service may be attempted. If all services fail, an exception will be raised.
W26: ‘child’ inside ‘parent’ added in VOTable X.X#
The given element was not supported inside of the given element until the specified VOTable version, however the version declared in the file is for an earlier version. These attributes may not be written out to the file.
W27: COOSYS deprecated in VOTable 1.2#
The COOSYS
element was deprecated in VOTABLE version 1.2 in
favor of a reference to the Space-Time Coordinate (STC) data
model (see utype
and the IVOA note referencing STC in VOTable.
W28: ‘attribute’ on ‘element’ added in VOTable X.X#
The given attribute was not supported on the given element until the specified VOTable version, however the version declared in the file is for an earlier version. These attributes may not be written out to the file.
W29: Version specified in non-standard form ‘v1.0’#
Some VOTable files specify their version number in the form “v1.0”, when the only supported forms in the spec are “1.0”.
W30: Invalid literal for float ‘x’. Treating as empty.#
Some VOTable files write missing floating-point values in non-standard ways,
such as “null” and “-”. If verify
is not 'exception'
, any
non-standard floating-point literals are treated as missing values.
W31: NaN given in an integral field without a specified null value#
Since NaN’s can not be represented in integer fields directly, a null value must be specified in the FIELD descriptor to support reading NaN’s from the tabledata.
W32: Duplicate ID ‘x’ renamed to ‘x_2’ to ensure uniqueness#
Each field in a table must have a unique ID. If two or more fields have the same ID, some will be renamed to ensure that all IDs are unique.
From the VOTable 1.2 spec:
The
ID
andref
attributes are defined as XML typesID
andIDREF
respectively. This means that the contents ofID
is an identifier which must be unique throughout a VOTable document, and that the contents of theref
attribute represents a reference to an identifier which must exist in the VOTable document.
W33: Column name ‘x’ renamed to ‘x_2’ to ensure uniqueness#
Each field in a table must have a unique name. If two or more fields have the same name, some will be renamed to ensure that all names are unique.
W34: ‘x’ is an invalid token for attribute ‘y’#
The attribute requires the value to be a valid XML token, as defined by XML 1.0.
W35: ‘x’ attribute required for INFO elements#
The name
and value
attributes are required on all INFO
elements.
W36: null value ‘x’ does not match field datatype, setting to 0#
If the field specifies a null
value, that value must conform
to the given datatype
.
W37: Unsupported data format ‘x’#
The 3 datatypes defined in the VOTable specification and supported by
astropy.io.votable
are TABLEDATA
, BINARY
, and FITS
.
In addition, astropy.io.votable
also supports PARQUET
serialization, which is
a candidate for addition to the VOTable specification.
W38: Inline binary data must be base64 encoded, got ‘x’#
The only encoding for local binary data supported by the VOTable specification is base64.
W39: Bit values can not be masked#
Bit values do not support masking. This warning is raised upon setting masked data in a bit column.
W40: ‘cprojection’ datatype repaired#
This is a terrible hack to support Simple Image Access Protocol results from NOIRLab Astro Data Archive. It creates a field for the coordinate projection type of type “double”, which actually contains character data. We have to hack the field to store character data, or we can’t read it in. A warning will be raised when this happens.
W41: An XML namespace is specified, but is incorrect. Expected ‘x’, got ‘y’#
An XML namespace was specified on the VOTABLE
element, but the
namespace does not match what is expected for a VOTABLE
file.
The VOTABLE
namespace is:
http://www.ivoa.net/xml/VOTable/vX.X
where “X.X” is the version number.
Some files in the wild set the namespace to the location of the VOTable schema, which is not correct and will not pass some validating parsers.
W42: No XML namespace specified#
The root element should specify a namespace.
The
VOTABLE
namespace is:http://www.ivoa.net/xml/VOTable/vX.Xwhere “X.X” is the version number.
W43: element ref=’x’ which has not already been defined#
Referenced elements should be defined before referees.
From the VOTable 1.2 spec:
In VOTable1.2, it is further recommended to place the ID attribute prior to referencing it whenever possible.
W44: VALUES element with ref attribute has content (‘element’)#
VALUES
elements that reference another element should not have
their own content.
From the VOTable 1.2 spec:
The
ref
attribute of aVALUES
element can be used to avoid a repetition of the domain definition, by referring to a previously definedVALUES
element having the referencedID
attribute. When specified, theref
attribute defines completely the domain without any other element or attribute, as e.g.<VALUES ref="RAdomain"/>
W45: content-role attribute ‘x’ invalid#
Invalid content-role attribute.
W46: char or unicode value is too long for specified length of x#
The given char or unicode string is too long for the specified field length.
W47: Missing arraysize indicates length 1#
If no arraysize is specified on a char field, the default of ‘1’ is implied, but this is rarely what is intended.
W48: Unknown attribute ‘attribute’ on element#
The attribute is not defined in the specification.
W49: Empty cell illegal for integer fields.#
Prior to VOTable 1.3, the empty cell was illegal for integer fields.
If a “null” value was specified for the cell, it will be used for the value, otherwise, 0 will be used.
W50: Invalid unit string ‘x’#
Invalid unit string as defined in the Units in the VO, Version 1.0 (VOTable version >= 1.4) or Standards for Astronomical Catalogues, Version 2.0 (version < 1.4).
Consider passing an explicit unit_format
parameter if the units
in this file conform to another specification.
W51: Value ‘x’ is out of range for a n-bit integer field#
The integer value is out of range for the size of the field.
W52: The BINARY2 format was introduced in VOTable 1.3, but this file is declared as version ‘1.2’#
The BINARY2 format was introduced in VOTable 1.3. It should not be present in files marked as an earlier version.
W53: VOTABLE element must contain at least one RESOURCE element.#
The VOTABLE element must contain at least one RESOURCE element.
W54: The TIMESYS element was introduced in VOTable 1.4, but this file is declared as version ‘1.3’#
The TIMESYS element was introduced in VOTable 1.4. It should not be present in files marked as an earlier version.
W55: FIELD () has datatype=”char” but contains non-ASCII value ()#
When non-ASCII characters are detected when reading
a TABLEDATA value for a FIELD with datatype="char"
, we
can issue this warning.
W56: The fields defined in the VOTable do not match those in the embedded PARQUET file#
The column fields as defined using FIELD
elements do not match
those in the headers of the embedded PARQUET file. If verify
is not
'exception'
, the embedded PARQUET file will take precedence.
Exceptions#
Note
This is a list of many of the fatal exceptions emitted by astropy.io.votable
when the file does not conform to spec. Other exceptions may be
raised due to unforeseen cases or bugs in astropy.io.votable
itself.
E01: Invalid size specifier ‘x’ for a char/unicode field (in field ‘y’)#
Invalid size specifier for a field.
The size specifier for a
char
orunicode
field must be only a number followed, optionally, by an asterisk. Multi-dimensional size specifiers are not supported for these datatypes.Strings, which are defined as a set of characters, can be represented in VOTable as a fixed- or variable-length array of characters:
<FIELD name="unboundedString" datatype="char" arraysize="*"/>A 1D array of strings can be represented as a 2D array of characters, but given the logic above, it is possible to define a variable-length array of fixed-length strings, but not a fixed-length array of variable-length strings.
E02: Incorrect number of elements in array. Expected multiple of x, got y#
Incorrect number of elements in array.
The number of array elements in the data does not match that specified in the FIELD specifier.
E03: ‘x’ does not parse as a complex number#
Complex numbers should be two values separated by whitespace.
E04: Invalid bit value ‘x’#
A bit
array should be a string of ‘0’s and ‘1’s.
E05: Invalid boolean value ‘x’#
Invalid boolean value.
E06: Unknown datatype ‘x’ on field ‘y’#
Unknown datatype on a field.
The supported datatypes are:
double, float, bit, boolean, unsignedByte, short, int, long, floatComplex, doubleComplex, char, unicodeCharThe following non-standard aliases are also supported, but in these case W13 will be raised:
string -> char unicodeString -> unicodeChar int16 -> short int32 -> int int64 -> long float32 -> float float64 -> double unsignedInt -> long unsignedShort -> intTo add more datatype mappings during parsing, use the
datatype_mapping
keyword toastropy.io.votable.parse
.
E08: type must be ‘legal’ or ‘actual’, but is ‘x’#
The type
attribute on the VALUES
element must be either
legal
or actual
.
E09: ‘x’ must have a value attribute#
The MIN
, MAX
and OPTION
elements must always have a
value
attribute.
E10: ‘datatype’ attribute required on all ‘FIELD’ elements#
From VOTable 1.1 and later, FIELD
and PARAM
elements must have
a datatype
field.
E11: precision ‘x’ is invalid#
The precision attribute is meant to express the number of significant
digits, either as a number of decimal places (e.g. precision="F2"
or
equivalently precision="2"
to express 2 significant figures
after the decimal point), or as a number of significant figures
(e.g. precision="E5"
indicates a relative precision of 10-5).
It is validated using the following regular expression:
[EF]?[1-9][0-9]*
E12: width must be a positive integer, got ‘x’#
The width attribute is meant to indicate to the application the number of characters to be used for input or output of the quantity.
E13: Invalid arraysize attribute ‘x’#
Invalid arraysize attribute.
From the VOTable 1.2 spec:
A table cell can contain an array of a given primitive type, with a fixed or variable number of elements; the array may even be multidimensional. For instance, the position of a point in a 3D space can be defined by the following:
<FIELD ID="point_3D" datatype="double" arraysize="3"/>and each cell corresponding to that definition must contain exactly 3 numbers. An asterisk (*) may be appended to indicate a variable number of elements in the array, as in:
<FIELD ID="values" datatype="int" arraysize="100*"/>where it is specified that each cell corresponding to that definition contains 0 to 100 integer numbers. The number may be omitted to specify an unbounded array (in practice up to =~2×10⁹ elements).
A table cell can also contain a multidimensional array of a given primitive type. This is specified by a sequence of dimensions separated by the
x
character, with the first dimension changing fastest; as in the case of a simple array, the last dimension may be variable in length. As an example, the following definition declares a table cell which may contain a set of up to 10 images, each of 64×64 bytes:<FIELD ID="thumbs" datatype="unsignedByte" arraysize="64×64×10*"/>
E14: value attribute is required for all PARAM elements#
All PARAM
elements must have a value
attribute.
E15: ID attribute is required for all COOSYS elements#
All COOSYS
elements must have an ID
attribute.
Note that the VOTable 1.1 specification says this attribute is optional, but its corresponding schema indicates it is required.
In VOTable 1.2, the
COOSYS
element is deprecated.
E16: Invalid system attribute ‘x’#
Incorrect system
attribute on COOSYS element.
The
system
attribute must be one of the following:'eq_FK4', 'eq_FK5', 'ICRS', 'ecl_FK4', 'ecl_FK5', 'galactic', 'supergalactic', 'xy', 'barycentric', 'geo_app'References: 1.1
E17: extnum must be a positive integer#
extnum
attribute must be a positive integer.
E18: type must be ‘results’ or ‘meta’, not ‘x’#
The type
attribute of the RESOURCE
element must be one of
“results” or “meta”.
E19: File does not appear to be a VOTABLE#
Raised either when the file doesn’t appear to be XML, or the root element is not VOTABLE.
E20: Data has more columns than are defined in the header (x)#
The table had only x fields defined, but the data itself has more columns than that.
E21: Data has fewer columns (x) than are defined in the header (y)#
The table had x fields defined, but the data itself has only y columns.
E22: ID attribute is required for all TIMESYS elements#
All TIMESYS
elements must have an ID
attribute.
E23: Invalid timeorigin attribute ‘x’#
The timeorigin
attribute on the TIMESYS
element must be
either a floating point literal specifying a valid Julian Date,
or, for convenience, the string “MJD-origin” (standing for 2400000.5)
or the string “JD-origin” (standing for 0).
References: 1.4
E24: Attempt to write non-ASCII value () to FIELD () which has datatype=”char”#
Non-ASCII unicode values should not be written when the FIELD datatype="char"
,
and cannot be written in BINARY or BINARY2 serialization.
E25: No FIELDs are defined; DATA section will be ignored.#
A VOTable cannot have a DATA section without any defined FIELD; DATA will be ignored.
E26: Mapping block can not be set in a RESOURCE with type=result#
The mapping block can only be set in a type=meta RESOURCE.
Exception Utilities#
- class astropy.io.votable.exceptions.Conf[source]#
Configuration parameters for
astropy.io.votable.exceptions
.- max_warnings#
Number of times the same type of warning is displayed before being suppressed
- astropy.io.votable.exceptions.warn_or_raise(warning_class, exception_class=None, args=(), config=None, pos=None, stacklevel=1)[source]#
Warn or raise an exception, depending on the verify setting.
- astropy.io.votable.exceptions.vo_raise(exception_class, args=(), config=None, pos=None)[source]#
Raise an exception, with proper position information if available.
- astropy.io.votable.exceptions.vo_reraise(exc, config=None, pos=None, additional='')[source]#
Raise an exception, with proper position information if available.
Restores the original traceback of the exception, and should only be called within an “except:” block of code.
- astropy.io.votable.exceptions.vo_warn(warning_class, args=(), config=None, pos=None, stacklevel=1)[source]#
Warn, with proper position information if available.
- astropy.io.votable.exceptions.parse_vowarning(line)[source]#
Parses the vo warning string back into its parts.
- class astropy.io.votable.exceptions.VOWarning(args, config=None, pos=None)[source]#
Bases:
AstropyWarning
The base class of all VO warnings and exceptions.
Handles the formatting of the message with a warning or exception code, filename, line and column number.
- class astropy.io.votable.exceptions.VOTableChangeWarning(args, config=None, pos=None)[source]#
Bases:
VOWarning
,SyntaxWarning
A change has been made to the input XML file.
- class astropy.io.votable.exceptions.VOTableSpecWarning(args, config=None, pos=None)[source]#
Bases:
VOWarning
,SyntaxWarning
The input XML file violates the spec, but there is an obvious workaround.
- class astropy.io.votable.exceptions.UnimplementedWarning(args, config=None, pos=None)[source]#
Bases:
VOWarning
,SyntaxWarning
A feature of the VOTABLE spec is not implemented.
- class astropy.io.votable.exceptions.IOWarning(args, config=None, pos=None)[source]#
Bases:
VOWarning
,RuntimeWarning
A network or IO error occurred, but was recovered using the cache.
- class astropy.io.votable.exceptions.VOTableSpecError(args, config=None, pos=None)[source]#
Bases:
VOWarning
,ValueError
The input XML file violates the spec and there is no good workaround.