1 /* stcl01.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__2 = 2;
11
12 /* $Procedure STCL01 ( STAR catalog type 1, load catalog file ) */
stcl01_(char * catfnm,char * tabnam,integer * handle,ftnlen catfnm_len,ftnlen tabnam_len)13 /* Subroutine */ int stcl01_(char *catfnm, char *tabnam, integer *handle,
14 ftnlen catfnm_len, ftnlen tabnam_len)
15 {
16 /* System generated locals */
17 address a__1[2];
18 integer i__1[2];
19 char ch__1[295];
20
21 /* Builtin functions */
22 /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen);
23
24 /* Local variables */
25 extern /* Subroutine */ int eklef_(char *, integer *, ftnlen), chkin_(
26 char *, ftnlen), stcc01_(char *, char *, logical *, char *,
27 ftnlen, ftnlen, ftnlen), errch_(char *, char *, ftnlen, ftnlen);
28 logical istyp1;
29 extern /* Subroutine */ int sigerr_(char *, ftnlen), chkout_(char *,
30 ftnlen);
31 char errmsg[256];
32 extern /* Subroutine */ int setmsg_(char *, ftnlen);
33 extern logical return_(void);
34
35 /* $ Abstract */
36
37 /* Load SPICE type 1 star catalog and return the catalog's */
38 /* table name. */
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 /* CATFNM I Catalog file name. */
79 /* TABNAM O Catalog table name. */
80 /* HANDLE O Catalog file handle. */
81
82 /* $ Detailed_Input */
83
84 /* CATFNM is the name of the catalog file. */
85
86 /* $ Detailed_Output */
87
88 /* TABNAM is the name of the table loaded from the catalog */
89 /* file. This name must be provided as an input argument */
90 /* to STCF01 catalog search routine. Multiple catalogs */
91 /* contaning the table TABNAM may be loaded. Sets of */
92 /* columns, column names and attribites must be */
93 /* identical through all these files. */
94
95 /* HANDLE is the integer handle of the catalog file. */
96
97 /* $ Parameters */
98
99 /* None. */
100
101 /* $ Exceptions */
102
103 /* 1) If the indicated file cannot be opened, the error will be */
104 /* diagnosed by routines called by this routine. */
105
106 /* 2) If the indicated file has the wrong architecture version, the */
107 /* error will be diagnosed by routines called by this routine. */
108
109 /* 3) If an I/O error occurs while reading the indicated file, the */
110 /* error will be diagnosed by routines called by this routine. */
111
112 /* 4) If the catalog file is not a type 1 star catalog file */
113 /* then the error 'SPICE(BADCATALOGFILE)' is signalled. */
114
115 /* $ Files */
116
117 /* This routine loads a SPICE type 1 star catalog file. */
118
119 /* SPICE type 1 star catalog files MUST contain a single data table. */
120 /* It can occupy a single segment or it can spread across multiple */
121 /* segments. This table MUST include the following columns: */
122
123 /* column name data type units */
124 /* ------------------------------------------------------- */
125 /* RA DOUBLE PRECISION DEGREES */
126 /* DEC DOUBLE PRECISION DEGREES */
127 /* RA_SIGMA DOUBLE PRECISION DEGREES */
128 /* DEC_SIGMA DOUBLE PRECISION DEGREES */
129 /* CATALOG_NUMBER INTEGER */
130 /* SPECTRAL_TYPE CHARACTER*(4) */
131 /* VISUAL_MAGNITUDE DOUBLE PRECISION */
132
133 /* Nulls are not allowed in any of the columns. */
134 /* Other columns can also be present in the table but their data */
135 /* will NOT be accessible through STCF01 and STCG01 -- */
136 /* the interface used to access data in the catalog. Note */
137 /* that the names and attributes of these additional columns */
138 /* must be identical for all segments containing this table. */
139
140 /* $ Particulars */
141
142 /* This STCL01 routine is intended to be part of the user */
143 /* interface to the SPICE type 1 star catalog. It loads a */
144 /* SPICE type 1 star catalog file and makes its data available */
145 /* for searches and retrieval. */
146
147 /* Other routines in SPICE type 1 star catalog access family are: */
148
149 /* STCF01 search through the catalog for all stars within */
150 /* a specified RA-DEC rectangle. */
151
152 /* STCG01 retrieve position and characteristics for */
153 /* every single star found. */
154
155 /* $ Examples */
156
157 /* In the following code fragment, STCL01 is used to load */
158 /* a SPICE type 1 star catalog. */
159
160 /* C */
161 /* C Load catalog file. */
162 /* C */
163 /* CALL STCL01 ( CATFN, TABNAM, HANDLE ) */
164 /* C */
165 /* C Search through the loaded catalog. */
166 /* C */
167 /* CALL STCF01 ( TABNAM, RAMIN, RAMAX, */
168 /* . DECMIN, DECMAX, NSTARS ) */
169 /* C */
170 /* C Retrieve data for every star that matched the */
171 /* C search criteria. */
172 /* C */
173 /* DO I = 1, NSTARS */
174
175 /* CALL STCG01 ( I, RA, DEC, RASIG, DECSIG, */
176 /* . CATNUM, SPTYPE, VMAG ) */
177
178 /* END DO */
179
180 /* $ Restrictions */
181
182 /* None. */
183
184 /* $ Literature_References */
185
186 /* None. */
187
188 /* $ Author_and_Institution */
189
190 /* B.V. Semenov (JPL) */
191
192 /* $ Version */
193
194 /* - SPICELIB Version 1.1.0, 18-JUN-1999 (WLT) */
195
196 /* Balanced calls to CHKIN/CHKOUT. */
197
198 /* - SPICELIB Version 1.0.0, 15-MAY-1996 (BVS) */
199
200 /* -& */
201 /* $ Index_Entries */
202
203 /* load a type 1 star catalog file */
204
205 /* -& */
206
207
208 /* SPICELIB functions */
209
210
211 /* Local variables */
212
213
214 /* Standard SPICE error handling. */
215
216 if (return_()) {
217 return 0;
218 } else {
219 chkin_("STCL01", (ftnlen)6);
220 }
221
222 /* Check whether the file is really a type 1 star catalog file. */
223 /* If not then signal an error. */
224
225 stcc01_(catfnm, tabnam, &istyp1, errmsg, catfnm_len, tabnam_len, (ftnlen)
226 256);
227 if (! istyp1) {
228 /* Writing concatenation */
229 i__1[0] = 39, a__1[0] = "File # is not type 1 star catalog file.";
230 i__1[1] = 256, a__1[1] = errmsg;
231 s_cat(ch__1, a__1, i__1, &c__2, (ftnlen)295);
232 setmsg_(ch__1, (ftnlen)295);
233 errch_("#", catfnm, (ftnlen)1, catfnm_len);
234 sigerr_("SPICE(BADCATALOGFILE)", (ftnlen)21);
235 chkout_("STCL01", (ftnlen)6);
236 return 0;
237 }
238
239 /* Load the catalog file with the high level EK loader. */
240
241 eklef_(catfnm, handle, catfnm_len);
242 chkout_("STCL01", (ftnlen)6);
243 return 0;
244 } /* stcl01_ */
245
246