VO Tables#
Reading/writing from/to VO table
files is supported with format='votable'
. In most cases, existing VO
tables should be automatically identified as such based on the header of the
file, but if not, or if writing to disk, then the format should be explicitly
specified.
Examples#
If a VO table file contains only a single table, then it can be read in with:
>>> t = Table.read('aj285677t3_votable.xml')
If more than one table is present in the file, an error will be raised,
unless the table ID is specified via the table_id=
argument:
>>> t = Table.read('catalog.xml')
Traceback (most recent call last):
...
ValueError: Multiple tables found: table id should be set via the table_id= argument. The available tables are twomass, spitzer
>>> t = Table.read('catalog.xml', table_id='twomass')
To write to a new file, the ID of the table should also be specified (unless
t.meta['ID']
is defined):
>>> t.write('new_catalog.xml', table_id='updated_table', format='votable')
When writing, the compression=True
argument can be used to force
compression of the data on disk, and the overwrite=True
argument can be
used to overwrite an existing file.