Commit d9cd2b5bd6183f4b0e51a49d6c272f497cbf33b5
1 parent
5cedf9ee
Exists in
master
modifie q.rd de planets
Showing
1 changed file
with
94 additions
and
5 deletions
Show diff stats
services/planets/q.rd
1 | <resource schema="planets"> | 1 | <resource schema="planets"> |
2 | <meta name="title">Characteristics of Planets (demo)</meta> | 2 | <meta name="title">Characteristics of Planets (demo)</meta> |
3 | + <meta name="shortname">Planets</meta> | ||
4 | + <meta name="shortName">Planets</meta> | ||
3 | <meta name="description" format="plain"> | 5 | <meta name="description" format="plain"> |
4 | Demonstration service of EPN-TAP v1: main characteristics of planets. Data are included in the table, therefore most relevant parameters are non-standard in EPN-TAP. Data are retrieved from Archinal et al 2009 (IAU report, 2011CeMDA.109..101A) [radii] and Cox et al 2000 (Allen's astrophysical quantities, 2000asqu.book.....C) [masses, heliocentric distances, and rotation periods]. </meta> | 6 | Demonstration service of EPN-TAP v1: main characteristics of planets. Data are included in the table, therefore most relevant parameters are non-standard in EPN-TAP. Data are retrieved from Archinal et al 2009 (IAU report, 2011CeMDA.109..101A) [radii] and Cox et al 2000 (Allen's astrophysical quantities, 2000asqu.book.....C) [masses, heliocentric distances, and rotation periods]. </meta> |
5 | <meta name="creationDate">2015-08-16T09:42:00Z</meta> | 7 | <meta name="creationDate">2015-08-16T09:42:00Z</meta> |
@@ -126,7 +128,7 @@ Demonstration service of EPN-TAP v1: main characteristics of planets. Data are i | @@ -126,7 +128,7 @@ Demonstration service of EPN-TAP v1: main characteristics of planets. Data are i | ||
126 | <make table="epn_core"> | 128 | <make table="epn_core"> |
127 | <rowmaker idmaps="*"> | 129 | <rowmaker idmaps="*"> |
128 | <var key="dataproduct_type">"ci"</var> | 130 | <var key="dataproduct_type">"ci"</var> |
129 | - <var key="spatial_frame_type">"celestial"</var> | 131 | + <var key="spatial_frame_type">"none"</var> |
130 | 132 | ||
131 | <var key="target_name" source="target_name" /> | 133 | <var key="target_name" source="target_name" /> |
132 | <var key="granule_uid" source="target_name" /> | 134 | <var key="granule_uid" source="target_name" /> |
@@ -145,8 +147,14 @@ Demonstration service of EPN-TAP v1: main characteristics of planets. Data are i | @@ -145,8 +147,14 @@ Demonstration service of EPN-TAP v1: main characteristics of planets. Data are i | ||
145 | <var key="service_title">"planets" </var> | 147 | <var key="service_title">"planets" </var> |
146 | <var key="bib_reference">"2011CeMDA.109..101A#2000asqu.book.....C"</var> | 148 | <var key="bib_reference">"2011CeMDA.109..101A#2000asqu.book.....C"</var> |
147 | <var key="publisher">"LESIA" </var> | 149 | <var key="publisher">"LESIA" </var> |
148 | - <var key="target_class">"planet"</var> | 150 | + <var key="target_class">"planet"</var> |
149 | 151 | ||
152 | + <!-- the id for our datalink services is artificial: it's | ||
153 | + just the concatenation of the object class and the object name | ||
154 | + --> | ||
155 | + <var key="ds_id">@target_class+"/"+@target_name</var> | ||
156 | + <var key="datalink_url">("\getConfig{web}{serverURL}/\rdId/epdl/dlmeta" | ||
157 | + +"?ID="+urllib.parse.quote(@ds_id))</var> | ||
150 | 158 | ||
151 | <apply procDef="//epntap2#populate-2_0" name="fillepn"> | 159 | <apply procDef="//epntap2#populate-2_0" name="fillepn"> |
152 | <bind name="granule_gid">@granule_gid</bind> | 160 | <bind name="granule_gid">@granule_gid</bind> |
@@ -154,12 +162,18 @@ Demonstration service of EPN-TAP v1: main characteristics of planets. Data are i | @@ -154,12 +162,18 @@ Demonstration service of EPN-TAP v1: main characteristics of planets. Data are i | ||
154 | <bind name="obs_id">@obs_id</bind> | 162 | <bind name="obs_id">@obs_id</bind> |
155 | <bind name="target_class">@target_class</bind> | 163 | <bind name="target_class">@target_class</bind> |
156 | <bind name="time_scale">"UTC"</bind> | 164 | <bind name="time_scale">"UTC"</bind> |
165 | + | ||
157 | <bind name="target_name">@target_name</bind> | 166 | <bind name="target_name">@target_name</bind> |
158 | <bind name="instrument_host_name">""</bind> | 167 | <bind name="instrument_host_name">""</bind> |
159 | <bind name="instrument_name">""</bind> | 168 | <bind name="instrument_name">""</bind> |
169 | + | ||
170 | + | ||
160 | <bind key="processing_level">5</bind> | 171 | <bind key="processing_level">5</bind> |
172 | + | ||
161 | <bind name="dataproduct_type">@dataproduct_type</bind> | 173 | <bind name="dataproduct_type">@dataproduct_type</bind> |
162 | <bind name="measurement_type">"phys.mass#phys.size.radius"</bind> | 174 | <bind name="measurement_type">"phys.mass#phys.size.radius"</bind> |
175 | + | ||
176 | + | ||
163 | <bind name="service_title">@service_title</bind> | 177 | <bind name="service_title">@service_title</bind> |
164 | <bind name="creation_date">@creation_date</bind> | 178 | <bind name="creation_date">@creation_date</bind> |
165 | <bind name="modification_date">@modification_date</bind> | 179 | <bind name="modification_date">@modification_date</bind> |
@@ -171,8 +185,83 @@ Demonstration service of EPN-TAP v1: main characteristics of planets. Data are i | @@ -171,8 +185,83 @@ Demonstration service of EPN-TAP v1: main characteristics of planets. Data are i | ||
171 | </make> | 185 | </make> |
172 | </data> | 186 | </data> |
173 | 187 | ||
174 | - <data id="collection" auto="false"> | ||
175 | - <make table="epn_core"/> | ||
176 | - <publish/> | 188 | + <service id="epdl" allowed="dlget,dlmeta"> |
189 | + <datalinkCore> | ||
190 | + <metaMaker> | ||
191 | + <code> | ||
192 | + yield MS(InputKey, name="epoch", | ||
193 | + type="double precision", | ||
194 | + unit="d", ucd="meta.epoch", | ||
195 | + description="Time the ephemeris is to be computed for, JD", | ||
196 | + multiplicity="forced-single", | ||
197 | + values=MS(Values, | ||
198 | + min=2400000, | ||
199 | + max=3000000)) | ||
200 | + </code> | ||
201 | + </metaMaker> | ||
202 | + | ||
203 | + <metaMaker> | ||
204 | + <code> | ||
205 | + with base.getTableConn() as conn: | ||
206 | + url = list(conn.query("SELECT thumbnail_url from \schema.epn_core where" | ||
207 | + " target_class=%(targetClass)s and target_name=%(targetName)s", { | ||
208 | + "targetClass": descriptor.targetClass, | ||
209 | + "targetName": descriptor.targetName}))[0][0] | ||
210 | + yield LinkDef(descriptor.pubDID, | ||
211 | + url, | ||
212 | + description="A preview of the planet", | ||
213 | + semantics="#preview", | ||
214 | + contentType="image/jpeg") | ||
215 | + </code> | ||
216 | + </metaMaker> | ||
217 | + | ||
218 | + <descriptorGenerator> | ||
219 | + <setup> | ||
220 | + <code> | ||
221 | + class PlanetDescriptor(object): | ||
222 | + def __init__(self, pubDID): | ||
223 | + self.pubDID = pubDID | ||
224 | + self.targetClass, self.targetName = self.pubDID.split("/", 1) | ||
225 | + self.computeEphemerisId() | ||
226 | + | ||
227 | + def computeEphemerisId(self): | ||
228 | + shortClass = { | ||
229 | + 'planet': 'p', | ||
230 | + 'satellite': 's', | ||
231 | + }[self.targetClass] | ||
232 | + self.ephId = "{}:{}".format( | ||
233 | + shortClass, self.targetName) | ||
234 | + description="computed ephemeris of the planet", | ||
235 | + </code> | ||
236 | + </setup> | ||
237 | + <code> | ||
238 | + return PlanetDescriptor(pubDID) | ||
239 | + </code> | ||
240 | + </descriptorGenerator> | ||
241 | + | ||
242 | + <dataFunction> | ||
243 | + <setup> | ||
244 | + <par name="upstream_service_url" | ||
245 | + >"http://vo.imcce.fr/webservices/miriade/ephemcc_query.php?-from=vespa&"</par> | ||
246 | + <code> | ||
247 | + | ||
248 | + from urllib.parse import urlencode | ||
249 | + from gavo.svcs import WebRedirect | ||
250 | + import urllib.parse | ||
251 | + </code> | ||
252 | + </setup> | ||
253 | + <code> | ||
254 | + parameters = { | ||
255 | + "-name": descriptor.ephId, | ||
256 | + "-ep": args["epoch"], | ||
257 | + } | ||
258 | + raise WebRedirect(upstream_service_url+urlencode(parameters)) | ||
259 | + </code> | ||
260 | + </dataFunction> | ||
261 | + </datalinkCore> | ||
262 | + </service> | ||
263 | + <data id="collection" auto="false"> | ||
264 | + <make table="epn_core"/> | ||
265 | + <publish/> | ||
177 | </data> | 266 | </data> |
178 | </resource> | 267 | </resource> |