Package gavo :: Package formats :: Module votablewrite
[frames] | no frames]

Module votablewrite

source code

Generating VOTables from internal data representations.

This is glue code to the more generic GAVO votable library. In particular, it governs the application of base.SerManagers and their column descriptions (which are what is passed around as colDescs in this module to come up with VOTable FIELDs and the corresponding values.

You should access this module through formats.votable.

Classes
  Error
  VOTableContext
A context object for writing VOTables.
Functions
 
defineField(ctx, element, colDesc)
adds attributes and children to element from colDesc.
source code
 
makeFieldFromColumn(ctx, colType, rscCol)
returns a VOTable colType for a rscdef column-type thing.
source code
 
makeTable(ctx, table)
returns a Table node for the table.Table instance table.
source code
 
makeResource(ctx, data)
returns a Resource node for the rsc.Data instance data.
source code
 
makeVOTable(data, ctx=None, **kwargs)
returns a votable.V.VOTABLE object representing data.
source code
 
writeAsVOTable(data, outputFile, ctx=None, **kwargs)
writes ``data`` to the ``outputFile``.
source code
 
getAsVOTable(data, ctx=None, **kwargs)
returns a string containing a VOTable representation of data.
source code
 
format(data, outputFile, **ctxargs) source code
Variables
  tableEncoders = {'binary': <class 'gavo.votable.model.BINARY'>...
  STC_FRAMES_TO_COOSYS = {'ECLIPTIC': 'ecl_FK5', 'FK4': 'eq_FK4'...
  COLUMN_REF_UTYPES = ['stc:astrocoords.position2d.value2.c1', '...
  __package__ = 'gavo.formats'
Function Details

defineField(ctx, element, colDesc)

source code 

adds attributes and children to element from colDesc.

element can be a V.FIELD or a V.PARAM *instance* and is changed in place.

This function returns None to remind people we're changing in place here.

makeFieldFromColumn(ctx, colType, rscCol)

source code 

returns a VOTable colType for a rscdef column-type thing.

This function lets you make PARAM and FIELD elements (colType) from column or param instances.

makeVOTable(data, ctx=None, **kwargs)

source code 

returns a votable.V.VOTABLE object representing data.

data can be an rsc.Data or an rsc.Table. data can be a data or a table instance, tablecoding any key in votable.tableEncoders.

You may pass a VOTableContext object; if you don't a context with all defaults will be used.

A deprecated alternative is to directly pass VOTableContext constructor arguments as additional keyword arguments. Don't do this, though, we'll probably remove the option to do so at some point.

You will usually pass the result to votable.write. The object returned contains DelayedTables, i.e., most of the content will only be realized at render time.

writeAsVOTable(data, outputFile, ctx=None, **kwargs)

source code 

writes ``data`` to the ``outputFile``.

data can be a table or ``Data`` item.

``ctx`` can be a ``VOTableContext`` instance; alternatively, ``VOTableContext`` constructor arguments can be passed in as ``kwargs``.

getAsVOTable(data, ctx=None, **kwargs)

source code 

returns a string containing a VOTable representation of data.

``kwargs`` can be constructor arguments for VOTableContext.


Variables Details

tableEncoders

Value:
{'binary': <class 'gavo.votable.model.BINARY'>,
 'binary2': <class 'gavo.votable.model.BINARY2'>,
 'td': <class 'gavo.votable.model.TABLEDATA'>}

STC_FRAMES_TO_COOSYS

Value:
{'ECLIPTIC': 'ecl_FK5',
 'FK4': 'eq_FK4',
 'FK5': 'eq_FK5',
 'GALACTIC_II': 'galactic',
 'ICRS': 'ICRS',
 'SUPERGALACTIC': 'supergalactic'}

COLUMN_REF_UTYPES

Value:
['stc:astrocoords.position2d.value2.c1',
 'stc:astrocoords.position2d.value2.c2',
 'stc:astrocoords.position2d.error2.c1',
 'stc:astrocoords.position2d.error2.c2',
 'stc:astrocoords.velocity2d.value2.c1',
 'stc:astrocoords.velocity2d.value2.c2',
 'stc:astrocoords.velocity2d.error2.c1',
 'stc:astrocoords.velocity2d.error2.c2',
...