| 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-2025, the GAVO project <[email protected]> |
| 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, jdnToJYear, |
| 36 |
bYearToDateTime, dateTimeToBYear, |
| 37 |
jdnToDateTime, dateTimeToJdn, |
| 38 |
mjdToDateTime, dateTimeToMJD, |
| 39 |
JD_MJD, isMJD, |
| 40 |
datetimeMapperFactory) |
| 41 |
|
| 42 |
from gavo.stc.conform import conform as conformTo, getSimple2Converter |
| 43 |
|
| 44 |
from gavo.stc.dm import fromPgSphere, STCSpec |
| 45 |
|
| 46 |
from gavo.stc.eq import EquivalencePolicy, defaultPolicy |
| 47 |
|
| 48 |
from gavo.stc.stcsast import parseSTCS, parseQSTCS |
| 49 |
|
| 50 |
from gavo.stc.stcsgen import getSTCS, getSpatialSystem |
| 51 |
|
| 52 |
from gavo.stc.stcx import STC |
| 53 |
|
| 54 |
from gavo.stc.stcxast import parseSTCX, parseFromETree |
| 55 |
|
| 56 |
from gavo.stc.stcxgen import astToStan, getSTCXProfile, nodeToStan |
| 57 |
|
| 58 |
from gavo.stc.syslib import getLibrarySystem |
| 59 |
|
| 60 |
from gavo.stc.tapstc import (TAP_SYSTEMS, getTAPSTC, getSimpleSTCSParser, |
| 61 |
parseSimpleSTCS, simpleSTCSToPolygon, getPGSphereTrafo) |
| 62 |
|
| 63 |
from gavo.stc.utypegen import getUtypes |
| 64 |
|
| 65 |
from gavo.stc.utypeast import parseFromUtypes |
| 66 |
|
| 67 |
def getSTCX(ast, rootElement): |
| 68 |
return astToStan(ast, rootElement) |