1 /* stcg01.f -- translated by f2c (version 19980913).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include "f2c.h"
7
8 /* Table of constant values */
9
10 static integer c__1 = 1;
11 static integer c__2 = 2;
12 static integer c__3 = 3;
13 static integer c__4 = 4;
14 static integer c__5 = 5;
15 static integer c__6 = 6;
16 static integer c__7 = 7;
17
18 /* $Procedure STCG01 ( STAR catalog type 1, get star data ) */
stcg01_(integer * index,doublereal * ra,doublereal * dec,doublereal * rasig,doublereal * decsig,integer * catnum,char * sptype,doublereal * vmag,ftnlen sptype_len)19 /* Subroutine */ int stcg01_(integer *index, doublereal *ra, doublereal *dec,
20 doublereal *rasig, doublereal *decsig, integer *catnum, char *sptype,
21 doublereal *vmag, ftnlen sptype_len)
22 {
23 extern /* Subroutine */ int ekgc_(integer *, integer *, integer *, char *,
24 logical *, logical *, ftnlen), ekgd_(integer *, integer *,
25 integer *, doublereal *, logical *, logical *), ekgi_(integer *,
26 integer *, integer *, integer *, logical *, logical *);
27 logical null;
28 extern /* Subroutine */ int chkin_(char *, ftnlen);
29 logical found;
30 extern /* Subroutine */ int sigerr_(char *, ftnlen), chkout_(char *,
31 ftnlen), setmsg_(char *, ftnlen), errint_(char *, integer *,
32 ftnlen);
33 extern logical return_(void);
34 extern doublereal rpd_(void);
35
36 /* $ Abstract */
37
38 /* Get data for a single star from a SPICE type 1 star catalog. */
39
40 /* $ Disclaimer */
41
42 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
43 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
44 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
45 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
46 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
47 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
48 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
49 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
50 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
51 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
52
53 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
54 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
55 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
56 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
57 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
58 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
59
60 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
61 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
62 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
63 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
64
65 /* $ Required_Reading */
66
67 /* EK */
68
69 /* $ Keywords */
70
71 /* None. */
72
73 /* $ Declarations */
74 /* $ Brief_I/O */
75
76 /* Variable I/O Description */
77 /* -------- --- -------------------------------------------------- */
78 /* INDEX I Star index. */
79 /* RA O Right ascension in radians. */
80 /* DEC O Declination in radians. */
81 /* RAS O Right ascension uncertainty in radians. */
82 /* DECS O Declination uncertainty in radians. */
83 /* CATNUM O Catalog number. */
84 /* SPTYPE O Spectral type. */
85 /* VMAG O Visual magnitude. */
86
87 /* $ Detailed_Input */
88
89 /* INDEX is the index of the star in the list of stars */
90 /* that satisfy the selection criteria specified in */
91 /* the last call to STCF01. */
92
93 /* $ Detailed_Output */
94
95 /* RA is right ascension of the star at the catalog epoch */
96 /* in radians relative to the J2000 inertial frame. */
97
98 /* DEC is declination of the star at the catalog epoch in */
99 /* radians relative to the J2000 inertial frame. */
100
101 /* RASIG is the uncertainty in right ascension of the star at */
102 /* the catalog epoch in radians. */
103
104 /* DECSIG is the uncertainty in declination of the star at */
105 /* the catalog epoch in radians. */
106
107 /* CATNUM is the star number in the catalog. */
108
109 /* SPTYPE is the star's spectral type. See catalog description */
110 /* for more information regarding encoding of spectral */
111 /* type values. */
112
113 /* VMAG is the visual magnitude of the star. */
114
115 /* $ Parameters */
116
117 /* None. */
118
119 /* $ Exceptions */
120
121 /* 1) If fetching of any of output values fails, then */
122 /* the error 'SPICE(BADSTARINDEX)' is signalled. */
123
124 /* 2) If no star catalog has been loaded, the error is dianosed */
125 /* by a routine called by this one. */
126
127 /* 3) If STCF01 was not called first, the EK query */
128 /* error 'SPICE(INVALIDINDEX)' is signalled. */
129
130 /* $ Files */
131
132 /* This routine reads the data from SPICE type 1 star catalog file */
133 /* loaded into the program by a call to STCL01. */
134
135 /* SPICE type 1 star catalog files MUST contain a single data table. */
136 /* It can occupy a single segment or it can spread across multiple */
137 /* segments. This table MUST include the following columns: */
138
139 /* column name data type units */
140 /* ------------------------------------------------------- */
141 /* RA DOUBLE PRECISION DEGREES */
142 /* DEC DOUBLE PRECISION DEGREES */
143 /* RA_SIGMA DOUBLE PRECISION DEGREES */
144 /* DEC_SIGMA DOUBLE PRECISION DEGREES */
145 /* CATALOG_NUMBER INTEGER */
146 /* SPECTRAL_TYPE CHARACTER*(4) */
147 /* VISUAL_MAGNITUDE DOUBLE PRECISION */
148
149 /* Nulls are not allowed in any of the columns. */
150 /* Other columns can also be present in the table but their data */
151 /* will NOT be accessible through STCF01 and STCG01 -- */
152 /* the interface used to access data in the catalog. Note */
153 /* that the names and attributes of these additional columns */
154 /* must be identical for all segments containing this table. */
155
156 /* $ Particulars */
157
158 /* This routine is intended to be a part of the user interface to */
159 /* the SPICE type 1 star catalog. It allows the caller to retrieve */
160 /* data for a single star found by STCF01 using the star's */
161 /* index within the search result array. This subroutine MUST */
162 /* NOT be called before a search by STCF01 was done. */
163
164 /* Other routines in the SPICE type 1 star catalog access */
165 /* family are: */
166
167 /* STCL01 load the catalog file and make its data */
168 /* available for search and retrieval. */
169
170 /* STCF01 search through the catalog for all stars within */
171 /* a specified RA-DEC rectangle. */
172
173 /* $ Examples */
174
175 /* In the following code fragment, STCG01 is used to retrieve */
176 /* position and characteristics for every star within an RA - DEC */
177 /* rectangle from a particular SPICE type 1 star catalog. */
178
179 /* C */
180 /* C Load catalog file. */
181 /* C */
182 /* CALL STCL01 ( CATFN, TABNAM, HANDLE ) */
183 /* C */
184 /* C Search through the loaded catalog. */
185 /* C */
186 /* CALL STCF01 ( TABNAM, RAMIN, RAMAX, */
187 /* . DECMIN, DECMAX, NSTARS ) */
188 /* C */
189 /* C Retrieve data for every star found. */
190 /* C */
191 /* DO I = 1, NSTARS */
192
193 /* CALL STCG01 ( I, RA, DEC, RASIG, DECSIG, */
194 /* . CATNUM, SPTYPE, VMAG ) */
195
196 /* END DO */
197
198 /* $ Restrictions */
199
200 /* 1) The catalog file STCG01 reads data from MUST be loaded */
201 /* by STCL01 and a search through the catalog MUST be done by */
202 /* STCF01 before STCG01 is called. */
203
204 /* 2) No other EK queries can be made between the call to STCF01 */
205 /* and the call to STCG01. */
206
207 /* $ Literature_References */
208
209 /* None. */
210
211 /* $ Author_and_Institution */
212
213 /* B.V. Semenov (JPL) */
214
215 /* $ Version */
216
217 /* - SPICELIB Version 1.0.0, 15-MAY-1996 (BVS) */
218
219 /* -& */
220 /* $ Index_Entries */
221
222 /* get data for single star from a type 1 star catalog */
223
224 /* -& */
225 /* $ Revisions */
226
227 /* -& */
228
229
230 /* SPICELIB functions */
231
232
233 /* Local variables. */
234
235
236 /* Standard SPICE error handling. */
237
238 if (return_()) {
239 return 0;
240 } else {
241 chkin_("STCG01", (ftnlen)6);
242 }
243
244 /* Fetch data from the catalog in the following order */
245 /* as defined QUERY string template in STCF01 routine */
246
247 /* RA, DEC, RASIG, DECSIG, CATNUM, SPTYPE, VMAG */
248
249 /* Check FOUNDs and report error if any of the parameters */
250 /* is not found. */
251
252 /* Since NULLs are not allowed in any of the star catalog */
253 /* columns, no check for NULLs is performed. */
254
255 ekgd_(&c__1, index, &c__1, ra, &null, &found);
256 if (! found) {
257 setmsg_("RA value for star # not found. ", (ftnlen)31);
258 errint_("#", index, (ftnlen)1);
259 sigerr_("SPICE(BADSTARINDEX)", (ftnlen)19);
260 chkout_("STCG01", (ftnlen)6);
261 return 0;
262 }
263 ekgd_(&c__2, index, &c__1, dec, &null, &found);
264 if (! found) {
265 setmsg_("DEC value for star # not found. ", (ftnlen)32);
266 errint_("#", index, (ftnlen)1);
267 sigerr_("SPICE(BADSTARINDEX)", (ftnlen)19);
268 chkout_("STCG01", (ftnlen)6);
269 return 0;
270 }
271 ekgd_(&c__3, index, &c__1, rasig, &null, &found);
272 if (! found) {
273 setmsg_("RASIG value for star # not found. ", (ftnlen)34);
274 errint_("#", index, (ftnlen)1);
275 sigerr_("SPICE(BADSTARINDEX)", (ftnlen)19);
276 chkout_("STCG01", (ftnlen)6);
277 return 0;
278 }
279 ekgd_(&c__4, index, &c__1, decsig, &null, &found);
280 if (! found) {
281 setmsg_("DECSIG value for star # not found.", (ftnlen)34);
282 errint_("#", index, (ftnlen)1);
283 sigerr_("SPICE(BADSTARINDEX)", (ftnlen)19);
284 chkout_("STCG01", (ftnlen)6);
285 return 0;
286 }
287 ekgi_(&c__5, index, &c__1, catnum, &null, &found);
288 if (! found) {
289 setmsg_("CATNUM value for star # not found.", (ftnlen)34);
290 errint_("#", index, (ftnlen)1);
291 sigerr_("SPICE(BADSTARINDEX)", (ftnlen)19);
292 chkout_("STCG01", (ftnlen)6);
293 return 0;
294 }
295 ekgc_(&c__6, index, &c__1, sptype, &null, &found, sptype_len);
296 if (! found) {
297 setmsg_("SPTYPE value for star # not found.", (ftnlen)34);
298 errint_("#", index, (ftnlen)1);
299 sigerr_("SPICE(BADSTARINDEX)", (ftnlen)19);
300 chkout_("STCG01", (ftnlen)6);
301 return 0;
302 }
303 ekgd_(&c__7, index, &c__1, vmag, &null, &found);
304 if (! found) {
305 setmsg_("VMAG value for star # not found. ", (ftnlen)33);
306 errint_("#", index, (ftnlen)1);
307 sigerr_("SPICE(BADSTARINDEX)", (ftnlen)19);
308 chkout_("STCG01", (ftnlen)6);
309 return 0;
310 }
311
312 /* Convert angles to radians before return. */
313
314 *ra *= rpd_();
315 *dec *= rpd_();
316 *rasig *= rpd_();
317 *decsig *= rpd_();
318 chkout_("STCG01", (ftnlen)6);
319 return 0;
320 } /* stcg01_ */
321
322