Blame view

services/planets/q.rd 11.6 KB
5cedf9ee   le sidaner   creation du reper...
1
2
<resource schema="planets">
  <meta name="title">Characteristics of Planets (demo)</meta>
d9cd2b5b   Philippe Hamy   modifie q.rd de p...
3
4
  <meta name="shortname">Planets</meta>
  <meta name="shortName">Planets</meta>
5cedf9ee   le sidaner   creation du reper...
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
  <meta name="description" format="plain">
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>
  <meta name="creationDate">2015-08-16T09:42:00Z</meta>
  <meta name="subject">planet</meta>
  <meta name="subject">mass</meta>
  <meta name="subject">radius</meta>
  <meta name="subject">period</meta>
  <meta name="copyright">LESIA-Obs Paris</meta>
  <meta name="creator.name">Stephane Erard</meta>
  <meta name="publisher">Paris Astronomical Data Centre - LESIA</meta>
  <meta name="contact.name">Stephane Erard</meta>
  <meta name="contact.email">vo.paris@obspm.fr</meta>
  <meta name="contact.address">Observatoire de Paris VOPDC, bat. Perrault, 77 av. Denfert Rochereau, 75014 Paris, FRANCE</meta>
  <meta name="source">2000asqu.book.....C</meta>
  <meta name="contentLevel">General</meta>
  <meta name="contentLevel">University</meta>
  <meta name="contentLevel">Research</meta>
  <meta name="contentLevel">Amateur</meta>
  <meta name="utype">ivo://vopdc.obspm/std/EpnCore#schema-2.0</meta>



<!-- METADATA COMPLETE -->

    <table id="epn_core" onDisk="true" adql="True">
        <mixin spatial_frame_type="celestial"
        optional_columns= "time_scale publisher bib_reference thumbnail_url" >//epntap2#table-2_0</mixin>


        <column name="distance_to_primary"  type="double precision"
            tablehead="Distance_to_primary"  unit="km"
              description="Extra: Mean heliocentric distance (semi-major axis)"
              ucd="pos.distance;stat.min" 
            verbLevel="2"/>

        <column name="mean_radius"    type="double precision" 
            tablehead="Mean_radius"  unit="km"
              description="Extra: Mean radius (1 bar level on giant planets)"
              ucd="phys.size.radius"
            verbLevel="2"/>

        <column name="mean_radius_uncertainty"    type="double precision" 
            tablehead="Mean_radius_uncertainty"  unit="km"
              description="Extra: Uncertainty on mean radius"
              ucd="phys.size.radius;stat.error"
            verbLevel="2"/>

        <column name="equatorial_radius"    type="double precision" 
            tablehead="Equatorial_radius"  unit="km"
              description="Extra: equatorial radius (1 bar level on giant planets)"
              ucd="phys.size.radius"
            verbLevel="2"/>

        <column name="equatorial_radius_uncertainty"    type="double precision" 
            tablehead="Equatorial_radius_uncertainty"  unit="km"
              description="Extra: Uncertainty on equatorial radius"
              ucd="phys.size.radius;stat.error"
            verbLevel="2"/>

        <column name="polar_radius"    type="double precision" 
            tablehead="Polar_radius"  unit="km"
              description="Extra: polar radius (1 bar level on giant planets)"
              ucd="phys.size.radius"
            verbLevel="2"/>

        <column name="polar_radius_uncertainty"    type="double precision" 
            tablehead="Polar_radius_uncertainty"  unit="km"
              description="Extra: Uncertainty on polar radius"
              ucd="phys.size.radius;stat.error"
            verbLevel="2"/>

        <column name="rms_deviation"    type="double precision" 
            tablehead="RMS_deviation"  unit="km"
              description="Extra: Average departure from ellipsoid"
              ucd="phys.size.radius;stat.stdev"
            verbLevel="2"/>

        <column name="elevation_min"    type="double precision" 
            tablehead="Elevation_min"  unit="km"
              description="Deepest depression relative to ellipsoid"
            ucd="pos.bodyrc.alt;stat.min"
            verbLevel="2"/>

        <column name="elevation_max"    type="double precision" 
            tablehead="Elevation_max"  unit="km"
              description="Highest relief relative to ellipsoid"
            ucd="pos.bodyrc.alt;stat.max"
            verbLevel="2"/>

        <column name="mass"    type="double precision" 
            tablehead="Mass"  unit="kg"
              description="Mass of planet"
               ucd="phys.mass"
            verbLevel="2"/>

        <column name="sideral_rotation_period"    type="double precision" 
            tablehead="Sideral_rotation_period"  unit="h"
              description="Rotation period (internal for giant planets)"
              ucd="time.period.rotation"
            verbLevel="2"/>

            <column name="ds_id" type="text"
                tablehead="Dataset ID"
                description="Identifier for this object to use when calling 
                        datalink services"
                ucd="meta.id"/>

            <column name="datalink_url" type="text"
                tablehead="Datalink"
                description="Datalinks and services for this object"
                ucd="meta.ref.url;meta.datalink"/>
    </table>

<!-- TABLE COMPLETE -->

    <data id="import">
        <sources>data/Masses2.csv</sources>
        <csvGrammar>
            <rowfilter procDef="//products#define">
                <bind name="table">"\schema.epn_core"</bind>
            </rowfilter>
        </csvGrammar>

        <make table="epn_core">
            <rowmaker idmaps="*">
                <var key="dataproduct_type">"ci"</var>
d9cd2b5b   Philippe Hamy   modifie q.rd de p...
131
                <var key="spatial_frame_type">"none"</var>
5cedf9ee   le sidaner   creation du reper...
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149

                <var key="target_name" source="target_name" />
                <var key="granule_uid" source="target_name" />
                <var key="granule_gid">"Planet" </var>
                <var key="obs_id">"N/A"</var>
                <!--  <var key="target_class">"planet" </var> -->
                <!--  <var key="time_scale">"UTC" </var> -->


                <var key="distance_to_primary" source="distance_to_primary" />

                <var key="creation_date">"2015-08-20T07:54:00.00" </var>
                <var key="modification_date">"2017-12-15T17:54:00.00" </var>
                <var key="release_date">"2015-08-20T07:54:00.00" </var>

                <var key="service_title">"planets" </var>
                <var key="bib_reference">"2011CeMDA.109..101A#2000asqu.book.....C"</var>
                <var key="publisher">"LESIA" </var>
d9cd2b5b   Philippe Hamy   modifie q.rd de p...
150
                                <var key="target_class">"planet"</var>
5cedf9ee   le sidaner   creation du reper...
151

d9cd2b5b   Philippe Hamy   modifie q.rd de p...
152
153
154
155
156
157
                                <!-- the id for our datalink services is artificial: it's
                                just the concatenation of the object class and the object name
                                -->
                                <var key="ds_id">@target_class+"/"+@target_name</var>
                                <var key="datalink_url">("\getConfig{web}{serverURL}/\rdId/epdl/dlmeta"
                                        +"?ID="+urllib.parse.quote(@ds_id))</var> 
5cedf9ee   le sidaner   creation du reper...
158
159
160
161
162
163
164

                <apply procDef="//epntap2#populate-2_0" name="fillepn">
                    <bind name="granule_gid">@granule_gid</bind>
                    <bind name="granule_uid">@granule_uid</bind>
                    <bind name="obs_id">@obs_id</bind>
                    <bind name="target_class">@target_class</bind>
                    <bind name="time_scale">"UTC"</bind>
d9cd2b5b   Philippe Hamy   modifie q.rd de p...
165

5cedf9ee   le sidaner   creation du reper...
166
167
168
                    <bind name="target_name">@target_name</bind>
                    <bind name="instrument_host_name">""</bind>
                    <bind name="instrument_name">""</bind>
d9cd2b5b   Philippe Hamy   modifie q.rd de p...
169
170


5cedf9ee   le sidaner   creation du reper...
171
                    <bind key="processing_level">5</bind>
d9cd2b5b   Philippe Hamy   modifie q.rd de p...
172

5cedf9ee   le sidaner   creation du reper...
173
174
                    <bind name="dataproduct_type">@dataproduct_type</bind>
                    <bind name="measurement_type">"phys.mass#phys.size.radius"</bind>
d9cd2b5b   Philippe Hamy   modifie q.rd de p...
175
176


5cedf9ee   le sidaner   creation du reper...
177
178
179
180
181
182
183
184
185
186
187
                    <bind name="service_title">@service_title</bind>
                    <bind name="creation_date">@creation_date</bind>
                    <bind name="modification_date">@modification_date</bind>
                    <bind name="release_date">@release_date</bind>

                </apply>
                <map key="thumbnail_url">@thumbnail_url</map>
            </rowmaker>
        </make>
    </data>

d9cd2b5b   Philippe Hamy   modifie q.rd de p...
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
    <service id="epdl" allowed="dlget,dlmeta">
        <datalinkCore>
            <metaMaker>
                <code>
                    yield MS(InputKey, name="epoch", 
                        type="double precision",
                        unit="d", ucd="meta.epoch",
                        description="Time the ephemeris is to be computed for, JD",
                        multiplicity="forced-single",
                        values=MS(Values,
                            min=2400000,
                            max=3000000))
                </code>
            </metaMaker>

            <metaMaker>
                <code>
                    with base.getTableConn() as conn:
                         url = list(conn.query("SELECT thumbnail_url from \schema.epn_core where"
                                " target_class=%(targetClass)s and target_name=%(targetName)s", {
                                "targetClass": descriptor.targetClass,
                                "targetName": descriptor.targetName}))[0][0]
                    yield LinkDef(descriptor.pubDID,
                        url,
                        description="A preview of the planet",
                        semantics="#preview",
                        contentType="image/jpeg")
                </code>
            </metaMaker>

            <descriptorGenerator>
            <setup>
                <code>
                    class PlanetDescriptor(object):
                        def __init__(self, pubDID):
                            self.pubDID = pubDID
                            self.targetClass, self.targetName = self.pubDID.split("/", 1)
                            self.computeEphemerisId()

                        def computeEphemerisId(self):
                                shortClass = {
                                        'planet': 'p',
                                        'satellite': 's',
                                }[self.targetClass]
                                self.ephId = "{}:{}".format(
                                        shortClass, self.targetName)
                        description="computed ephemeris of the planet",
                </code>
            </setup>
                <code>
                    return PlanetDescriptor(pubDID)
                </code>
            </descriptorGenerator>

            <dataFunction>
                <setup>
                    <par name="upstream_service_url"
                        >"http://vo.imcce.fr/webservices/miriade/ephemcc_query.php?-from=vespa&amp;"</par>
                    <code>
            
	    from urllib.parse import urlencode
            from gavo.svcs import WebRedirect
	    import urllib.parse
                    </code>
                </setup>
                <code>
                    parameters = {
                        "-name": descriptor.ephId,
                        "-ep": args["epoch"],
                    }
                    raise WebRedirect(upstream_service_url+urlencode(parameters))
                </code>
            </dataFunction>
        </datalinkCore>
    </service>
       <data id="collection" auto="false">
       <make table="epn_core"/>
       <publish/>
5cedf9ee   le sidaner   creation du reper...
266
267
    </data>
</resource>