1 """
2 The coverage RD element.
3
4 Most code to obtain coverage information from actual resources is in
5 gavo.user.info.
6 """
7
8
9
10
11
12
13
14 from gavo import base
15 from gavo import stc
16 from gavo import utils
17 from gavo.utils import pgsphere
18
20 """An attribute keeping a floating-point attribute.
21
22 The literal of these is as in VOTable: a whitespace-separated pair
23 for decimal floating-point literals.
24 """
25 typeDesc_ = "A float interval (i.e., a space-separated pair of floats)"
26
39
41 return "%.10g %.10g"%value
42
43
45 """An attribute keeping a temporal interval as MJD.
46
47 On literal input, we also allow ISO-like timestamps. You cannot
48 mix MJD and ISO, though.
49 """
50 typeDesc_ = "A float or ISO timestamp interval (values separated by space)"
67
68
69 -class Ranges(base.ListOfAtomsAttribute):
70 """An attribute definition for a list of intervals.
71 """
72 typeDesc_ = "A sequence of intervals (a space-separated pair of floats"
73
74 - def __init__(self, name, intervalAttr, default=[], **kwargs):
77
78
80 """Information on where and how to update a piece of coverage information.
81 """
82 name_ = "updater"
83
84
85 _sourceTable = base.ReferenceAttribute("sourceTable",
86 default=base.NotGiven,
87 description="A table from which to compute coverage by default.",
88 copyable=True)
89 _spaceTable = base.ReferenceAttribute("spaceTable",
90 default=base.NotGiven,
91 description="A table from which to compute spatial coverage (overrides"
92 " sourceTable).",
93 copyable=True)
94 _timeTable = base.ReferenceAttribute("timeTable",
95 default=base.NotGiven,
96 description="A table from which to compute temporal coverage (overrides"
97 " sourceTable)",
98 copyable=True)
99 _spectralTable = base.ReferenceAttribute("spectralTable",
100 default=base.NotGiven,
101 description="A table from which to compute spectral coverage (overrides"
102 " sourceTable)",
103 copyable=True)
104 _mocOrder = base.IntAttribute("mocOrder",
105 default=6,
106 description="Maximal HEALpix order to use in coverage MOCs (6 is about"
107 " a degree resolution, each additional point doubles resolution).",
108 copyable=True)
109
110
112 """The coverage of a resource.
113
114 For now, this is attached to the complete resource rather than the table,
115 since this is where it sits in VOResource. DaCHS *could* be a bit
116 more flexible, allowing different coverages per publish element. It
117 is not right now, though.
118
119 Note: Technically, this will introduce or amend the coverage meta
120 element. The information given here will be masked if you define
121 a coverage meta on the service or table level. Just do not do that.
122 """
123 name_ = "coverage"
124
125 _updater = base.StructAttribute("updater",
126 childFactory=Updater,
127 description="Rules for automatic computation or updating of"
128 " coverage information.",
129 default=base.NotGiven)
130 _spectral = Ranges("spectral",
131 FloatInterval(
132 "spectral", description="A wavelength interval"),
133 description="Interval(s) of spectral coverage, in meters of"
134 " BARYCENTER vacuum wavelength.")
135 _temporal = Ranges("temporal",
136 FloatOrDateInterval(
137 "temporal", description="A time interval"),
138 description="Interval(s) of temporal coverage, in MJD"
139 " (for TT BARYCENTER).")
140 _spatial = base.UnicodeAttribute("spatial",
141 default=base.NotGiven,
142 description="A MOC in ASCII representation giving the ICRS coverage"
143 " of the resource")
144
151
163