Package gavo :: Package stc
[frames] | no frames]

Source Code for Package gavo.stc

 1  """ 
 2  Support for the IVOA Space-Time-Coordinate data model. 
 3   
 4  We're dealing with a huge data model here that probably can't be 
 5  fully implemented in any sense of the word. 
 6   
 7  So, we have a stripped down data model in the form of an abstract syntax 
 8  tree here (defined in the dm submodule).  This can be built directly or 
 9  from various input formats (XXXast submodules).  From the AST, you can 
10  also build various output formats (XXXgen submodules). 
11   
12  All other operations should be performed on the AST. 
13   
14  Note that this is slow as a dog.  I doubt we'll ever see performant STC 
15  implementations.  This is really intended for one-shot transformations, 
16  e.g. into functions or a query language.  Don't do any transformations 
17  in serious loops. 
18  """ 
19   
20  #c Copyright 2008-2019, the GAVO project 
21  #c 
22  #c This program is free software, covered by the GNU GPL.  See the 
23  #c COPYING file in the source distribution. 
24   
25   
26  # Not checked by pyflakes: API file with gratuitous imports 
27   
28  import sys 
29   
30  from gavo.stc.common import (STCError, STCSParseError, STCLiteralError, 
31          STCValueError, STCNotImplementedError, STCUnitError, 
32          STCNamespace, stcSpaceRefFrames, stcRefPositions, ColRef) 
33   
34  from gavo.stc.times import (parseISODT,  
35          jYearToDateTime, dateTimeToJYear, 
36          bYearToDateTime, dateTimeToBYear, 
37          jdnToDateTime, dateTimeToJdn, 
38          mjdToDateTime, dateTimeToMJD, 
39          JD_MJD, 
40          datetimeMapperFactory) 
41   
42  # hardcore stc only from 2.5 upwards 
43  if sys.version_info[0]>=2 and sys.version_info[1]>4:   
44          from gavo.stc.conform import conform as conformTo, getSimple2Converter 
45   
46          from gavo.stc.dm import fromPgSphere 
47   
48          from gavo.stc.eq import EquivalencePolicy, defaultPolicy 
49   
50          from gavo.stc.stcsast import parseSTCS, parseQSTCS 
51   
52          from gavo.stc.stcsgen import getSTCS, getSpatialSystem 
53   
54          from gavo.stc.stcx import STC 
55   
56          from gavo.stc.stcxast import parseSTCX, parseFromETree 
57   
58          from gavo.stc.stcxgen import astToStan, getSTCXProfile, nodeToStan 
59   
60          from gavo.stc.syslib import getLibrarySystem 
61   
62          from gavo.stc.tapstc import (TAP_SYSTEMS, getTAPSTC, getSimpleSTCSParser, 
63                  parseSimpleSTCS, simpleSTCSToPolygon, getPGSphereTrafo) 
64   
65          from gavo.stc.utypegen import getUtypes 
66   
67          from gavo.stc.utypeast import parseFromUtypes 
68   
69 - def getSTCX(ast, rootElement):
70 return astToStan(ast, rootElement)
71