File Coverage

palsrc/palObs.c
Criterion Covered Total %
statement 17 17 100.0
branch 8 8 100.0
condition n/a
subroutine n/a
pod n/a
total 25 25 100.0


line stmt bran cond sub pod time code
1             /*
2             *+
3             * Name:
4             * palObs
5              
6             * Purpose:
7             * Parameters of selected ground-based observing stations
8              
9             * Language:
10             * Starlink ANSI C
11              
12             * Type of Module:
13             * Library routine
14              
15             * Invocation:
16             * int palObs( size_t n, const char * c,
17             * char * ident, size_t identlen,
18             * char * name, size_t namelen,
19             * double * w, double * p, double * h );
20              
21             * Arguments:
22             * n = size_t (Given)
23             * Number specifying the observing station. If 0
24             * the identifier in "c" is used to determine the
25             * observing station to use.
26             * c = const char * (Given)
27             * Identifier specifying the observing station for
28             * which the parameters should be returned. Only used
29             * if n is 0. Can be NULL for n>0. Case insensitive.
30             * ident = char * (Returned)
31             * Identifier of the observing station selected. Will be
32             * identical to "c" if n==0. Unchanged if "n" or "c"
33             * do not match an observing station. Should be at least
34             * 11 characters (including the trailing nul).
35             * identlen = size_t (Given)
36             * Size of the buffer "ident" including trailing nul.
37             * name = char * (Returned)
38             * Full name of the specified observing station. Contains "?"
39             * if "n" or "c" did not correspond to a valid station. Should
40             * be at least 41 characters (including the trailing nul).
41             * w = double * (Returned)
42             * Longitude (radians, West +ve). Unchanged if observing
43             * station could not be identified.
44             * p = double * (Returned)
45             * Geodetic latitude (radians, North +ve). Unchanged if observing
46             * station could not be identified.
47             * h = double * (Returned)
48             * Height above sea level (metres). Unchanged if observing
49             * station could not be identified.
50              
51             * Returned Value:
52             * palObs = int
53             * 0 if an observing station was returned. -1 if no match was
54             * found.
55              
56             * Description:
57             * Station numbers, identifiers, names and other details are
58             * subject to change and should not be hardwired into
59             * application programs.
60             *
61             * All characters in "c" up to the first space are
62             * checked; thus an abbreviated ID will return the parameters
63             * for the first station in the list which matches the
64             * abbreviation supplied, and no station in the list will ever
65             * contain embedded spaces. "c" must not have leading spaces.
66             *
67             * IMPORTANT -- BEWARE OF THE LONGITUDE SIGN CONVENTION. The
68             * longitude returned by palOBS (and SLA_OBS) is west-positive in accordance
69             * with astronomical usage. However, this sign convention is
70             * left-handed and is the opposite of the one used by geographers;
71             * elsewhere in PAL the preferable east-positive convention is
72             * used. In particular, note that for use in palAop, palAoppa
73             * and palOap the sign of the longitude must be reversed.
74             *
75             * Users are urged to inform the author of any improvements
76             * they would like to see made. For example:
77             *
78             * typographical corrections
79             * more accurate parameters
80             * better station identifiers or names
81             * additional stations
82              
83              
84             * Authors:
85             * PTW: Patrick T. Wallace
86             * TIMJ: Tim Jenness (JAC, Hawaii)
87             * {enter_new_authors_here}
88              
89             * Notes:
90             * - Differs from the SLA interface in that the output short name
91             * is not the same variable as the input short name. This simplifies
92             * consting. Additionally the size of the output buffers are now
93             * specified in the API and a status integer is returned.
94              
95             * History:
96             * 2012-03-06 (TIMJ):
97             * Initial version containing entries from SLA/F as of 15 March 2002
98             * with a 2008 tweak to the JCMT GPS position.
99             * Adapted with permission from the Fortran SLALIB library.
100             * 2014-04-08 (TIMJ):
101             * Add APEX and NANTEN2
102             * 2020-09-15 (GSB):
103             * Add IRAM30M and NOEMA
104             * {enter_further_changes_here}
105              
106             * Copyright:
107             * Copyright (C) 2002 Rutherford Appleton Laboratory
108             * Copyright (C) 2012 Science and Technology Facilities Council.
109             * Copyright (C) 2014 Cornell University.
110             * All Rights Reserved.
111              
112             * Licence:
113             * This program is free software; you can redistribute it and/or
114             * modify it under the terms of the GNU General Public License as
115             * published by the Free Software Foundation; either version 3 of
116             * the License, or (at your option) any later version.
117             *
118             * This program is distributed in the hope that it will be
119             * useful, but WITHOUT ANY WARRANTY; without even the implied
120             * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
121             * PURPOSE. See the GNU General Public License for more details.
122             *
123             * You should have received a copy of the GNU General Public License
124             * along with this program; if not, write to the Free Software
125             * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
126             * MA 02110-1301, USA.
127              
128             * Bugs:
129             * {note_any_bugs_here}
130             *-
131             */
132              
133             #if HAVE_CONFIG_H
134             # include
135             #endif
136              
137             #ifdef HAVE_BSD_STRING_H
138             #include
139             #endif
140              
141             #include
142              
143             /* We prefer to use the starutil package. */
144             #if HAVE_STAR_UTIL_H
145             #include "star/util.h"
146             #else
147             /* This version is just a straight copy without putting ellipsis on the end. */
148             static void star__strellcpy( char * dest, const char * src, size_t size ) {
149             # if HAVE_STRLCPY
150             strlcpy( dest, src, size );
151             # else
152             strncpy( dest, src, size );
153 2           dest[size-1] = '\0';
154             # endif
155             }
156              
157             #define star_strellcpy(dest, src, size) star__strellcpy(dest, src, size)
158             #endif
159              
160             #if HAVE__STRICMP || defined(_WIN32) || defined(_WIN64)
161             #define strcasecmp _stricmp
162             #endif
163              
164             #include "pal.h"
165             #include "palmac.h"
166              
167             /* Helper macros to convert degrees to radians in longitude and latitude */
168             #define WEST(ID,IAM,AS) PAL__DAS2R*((60.0*(60.0*(double)ID+(double)IAM))+(double)AS)
169             #define NORTH(ID,IAM,AS) WEST(ID,IAM,AS)
170             #define EAST(ID,IAM,AS) -1.0*WEST(ID,IAM,AS)
171             #define SOUTH(ID,IAM,AS) -1.0*WEST(ID,IAM,AS)
172              
173             struct telData {
174             double w;
175             double p;
176             double h;
177             char shortname[11];
178             char longname[41];
179             };
180              
181              
182 11           int palObs( size_t n, const char * c,
183             char * ident, size_t identlen,
184             char * name, size_t namelen,
185             double * w, double * p, double * h ) {
186 11           const struct telData telData[] = {
187             /* AAT (Observer's Guide) AAT */
188             {
189             EAST(149,3,57.91),
190             SOUTH(31,16,37.34),
191             1164E0,
192             "AAT",
193             "Anglo-Australian 3.9m Telescope"
194             },
195             /* WHT (Gemini, April 1987) LPO4.2 */
196             {
197             WEST(17,52,53.9),
198             NORTH(28,45,38.1),
199             2332E0,
200             "LPO4.2",
201             "William Herschel 4.2m Telescope"
202             },
203             /* INT (Gemini, April 1987) LPO2.5 */
204             {
205             WEST(17,52,39.5),
206             NORTH(28,45,43.2),
207             2336E0,
208             "LPO2.5",
209             "Isaac Newton 2.5m Telescope"
210             },
211             /* JKT (Gemini, April 1987) LPO1 */
212             {
213             WEST(17,52,41.2),
214             NORTH(28,45,39.9),
215             2364E0,
216             "LPO1",
217             "Jacobus Kapteyn 1m Telescope"
218             },
219             /* Lick 120" (S.L.Allen, private communication, 2002) LICK120 */
220             {
221             WEST(121,38,13.689),
222             NORTH(37,20,34.931),
223             1286E0,
224             "LICK120",
225             "Lick 120 inch"
226             },
227             /* MMT 6.5m conversion (MMT Observatory website) MMT */
228             {
229             WEST(110,53,4.4),
230             NORTH(31,41,19.6),
231             2608E0,
232             "MMT",
233             "MMT 6.5m, Mt Hopkins"
234             },
235             /* Victoria B.C. 1.85m (1984 Almanac) DAO72 */
236             {
237             WEST(123,25,1.18),
238             NORTH(48,31,11.9),
239             238E0,
240             "DAO72",
241             "DAO Victoria BC 1.85 metre"
242             },
243             /* Las Campanas (1983 Almanac) DUPONT */
244             {
245             WEST(70,42,9.),
246             SOUTH(29,0,11.),
247             2280E0,
248             "DUPONT",
249             "Du Pont 2.5m Telescope, Las Campanas"
250             },
251             /* Mt Hopkins 1.5m (1983 Almanac) MTHOP1.5 */
252             {
253             WEST(110,52,39.00),
254             NORTH(31,40,51.4),
255             2344E0,
256             "MTHOP1.5",
257             "Mt Hopkins 1.5 metre"
258             },
259             /* Mt Stromlo 74" (1983 Almanac) STROMLO74 */
260             {
261             EAST(149,0,27.59),
262             SOUTH(35,19,14.3),
263             767E0,
264             "STROMLO74",
265             "Mount Stromlo 74 inch"
266             },
267             /* ANU 2.3m, SSO (Gary Hovey) ANU2.3 */
268             {
269             EAST(149,3,40.3),
270             SOUTH(31,16,24.1),
271             1149E0,
272             "ANU2.3",
273             "Siding Spring 2.3 metre"
274             },
275             /* Greenbank 140' (1983 Almanac) GBVA140 */
276             {
277             WEST(79,50,9.61),
278             NORTH(38,26,15.4),
279             881E0,
280             "GBVA140",
281             "Greenbank 140 foot"
282             },
283             /* Cerro Tololo 4m (1982 Almanac) TOLOLO4M */
284             {
285             WEST(70,48,53.6),
286             SOUTH(30,9,57.8),
287             2235E0,
288             "TOLOLO4M",
289             "Cerro Tololo 4 metre"
290             },
291             /* Cerro Tololo 1.5m (1982 Almanac) TOLOLO1.5M */
292             {
293             WEST(70,48,54.5),
294             SOUTH(30,9,56.3),
295             2225E0,
296             "TOLOLO1.5M",
297             "Cerro Tololo 1.5 metre"
298             },
299             /* Tidbinbilla 64m (1982 Almanac) TIDBINBLA */
300             {
301             EAST(148,58,48.20),
302             SOUTH(35,24,14.3),
303             670E0,
304             "TIDBINBLA",
305             "Tidbinbilla 64 metre"
306             },
307             /* Bloemfontein 1.52m (1981 Almanac) BLOEMF */
308             {
309             EAST(26,24,18.),
310             SOUTH(29,2,18.),
311             1387E0,
312             "BLOEMF",
313             "Bloemfontein 1.52 metre"
314             },
315             /* Bosque Alegre 1.54m (1981 Almanac) BOSQALEGRE */
316             {
317             WEST(64,32,48.0),
318             SOUTH(31,35,53.),
319             1250E0,
320             "BOSQALEGRE",
321             "Bosque Alegre 1.54 metre"
322             },
323             /* USNO 61" astrographic reflector, Flagstaff (1981 Almanac) FLAGSTF61 */
324             {
325             WEST(111,44,23.6),
326             NORTH(35,11,2.5),
327             2316E0,
328             "FLAGSTF61",
329             "USNO 61 inch astrograph, Flagstaff"
330             },
331             /* Lowell 72" (1981 Almanac) LOWELL72 */
332             {
333             WEST(111,32,9.3),
334             NORTH(35,5,48.6),
335             2198E0,
336             "LOWELL72",
337             "Perkins 72 inch, Lowell"
338             },
339             /* Harvard 1.55m (1981 Almanac) HARVARD */
340             {
341             WEST(71,33,29.32),
342             NORTH(42,30,19.0),
343             185E0,
344             "HARVARD",
345             "Harvard College Observatory 1.55m"
346             },
347             /* Okayama 1.88m (1981 Almanac) OKAYAMA */
348             {
349             EAST(133,35,47.29),
350             NORTH(34,34,26.1),
351             372E0,
352             "OKAYAMA",
353             "Okayama 1.88 metre"
354             },
355             /* Kitt Peak Mayall 4m (1981 Almanac) KPNO158 */
356             {
357             WEST(111,35,57.61),
358             NORTH(31,57,50.3),
359             2120E0,
360             "KPNO158",
361             "Kitt Peak 158 inch"
362             },
363             /* Kitt Peak 90 inch (1981 Almanac) KPNO90 */
364             {
365             WEST(111,35,58.24),
366             NORTH(31,57,46.9),
367             2071E0,
368             "KPNO90",
369             "Kitt Peak 90 inch"
370             },
371             /* Kitt Peak 84 inch (1981 Almanac) KPNO84 */
372             {
373             WEST(111,35,51.56),
374             NORTH(31,57,29.2),
375             2096E0,
376             "KPNO84",
377             "Kitt Peak 84 inch"
378             },
379             /* Kitt Peak 36 foot (1981 Almanac) KPNO36FT */
380             {
381             WEST(111,36,51.12),
382             NORTH(31,57,12.1),
383             1939E0,
384             "KPNO36FT",
385             "Kitt Peak 36 foot"
386             },
387             /* Kottamia 74" (1981 Almanac) KOTTAMIA */
388             {
389             EAST(31,49,30.),
390             NORTH(29,55,54.),
391             476E0,
392             "KOTTAMIA",
393             "Kottamia 74 inch"
394             },
395             /* La Silla 3.6m (1981 Almanac) ESO3.6 */
396             {
397             WEST(70,43,36.),
398             SOUTH(29,15,36.),
399             2428E0,
400             "ESO3.6",
401             "ESO 3.6 metre"
402             },
403             /* Mauna Kea 88 inch MAUNAK88 */
404             /* (IfA website, Richard Wainscoat) */
405             {
406             WEST(155,28,9.96),
407             NORTH(19,49,22.77),
408             4213.6E0,
409             "MAUNAK88",
410             "Mauna Kea 88 inch"
411             },
412             /* UKIRT (IfA website, Richard Wainscoat) UKIRT */
413             {
414             WEST(155,28,13.18),
415             NORTH(19,49,20.75),
416             4198.5E0,
417             "UKIRT",
418             "UK Infra Red Telescope"
419             },
420             /* Quebec 1.6m (1981 Almanac) QUEBEC1.6 */
421             {
422             WEST(71,9,9.7),
423             NORTH(45,27,20.6),
424             1114E0,
425             "QUEBEC1.6",
426             "Quebec 1.6 metre"
427             },
428             /* Mt Ekar 1.82m (1981 Almanac) MTEKAR */
429             {
430             EAST(11,34,15.),
431             NORTH(45,50,48.),
432             1365E0,
433             "MTEKAR",
434             "Mt Ekar 1.82 metre"
435             },
436             /* Mt Lemmon 60" (1981 Almanac) MTLEMMON60 */
437             {
438             WEST(110,42,16.9),
439             NORTH(32,26,33.9),
440             2790E0,
441             "MTLEMMON60",
442             "Mt Lemmon 60 inch"
443             },
444             /* Mt Locke 2.7m (1981 Almanac) MCDONLD2.7 */
445             {
446             WEST(104,1,17.60),
447             NORTH(30,40,17.7),
448             2075E0,
449             "MCDONLD2.7",
450             "McDonald 2.7 metre"
451             },
452             /* Mt Locke 2.1m (1981 Almanac) MCDONLD2.1 */
453             {
454             WEST(104,1,20.10),
455             NORTH(30,40,17.7),
456             2075E0,
457             "MCDONLD2.1",
458             "McDonald 2.1 metre"
459             },
460             /* Palomar 200" (1981 Almanac) PALOMAR200 */
461             {
462             WEST(116,51,50.),
463             NORTH(33,21,22.),
464             1706E0,
465             "PALOMAR200",
466             "Palomar 200 inch"
467             },
468             /* Palomar 60" (1981 Almanac) PALOMAR60 */
469             {
470             WEST(116,51,31.),
471             NORTH(33,20,56.),
472             1706E0,
473             "PALOMAR60",
474             "Palomar 60 inch"
475             },
476             /* David Dunlap 74" (1981 Almanac) DUNLAP74 */
477             {
478             WEST(79,25,20.),
479             NORTH(43,51,46.),
480             244E0,
481             "DUNLAP74",
482             "David Dunlap 74 inch"
483             },
484             /* Haute Provence 1.93m (1981 Almanac) HPROV1.93 */
485             {
486             EAST(5,42,46.75),
487             NORTH(43,55,53.3),
488             665E0,
489             "HPROV1.93",
490             "Haute Provence 1.93 metre"
491             },
492             /* Haute Provence 1.52m (1981 Almanac) HPROV1.52 */
493             {
494             EAST(5,42,43.82),
495             NORTH(43,56,0.2),
496             667E0,
497             "HPROV1.52",
498             "Haute Provence 1.52 metre"
499             },
500             /* San Pedro Martir 83" (1981 Almanac) SANPM83 */
501             {
502             WEST(115,27,47.),
503             NORTH(31,2,38.),
504             2830E0,
505             "SANPM83",
506             "San Pedro Martir 83 inch"
507             },
508             /* Sutherland 74" (1981 Almanac) SAAO74 */
509             {
510             EAST(20,48,44.3),
511             SOUTH(32,22,43.4),
512             1771E0,
513             "SAAO74",
514             "Sutherland 74 inch"
515             },
516             /* Tautenburg 2m (1981 Almanac) TAUTNBG */
517             {
518             EAST(11,42,45.),
519             NORTH(50,58,51.),
520             331E0,
521             "TAUTNBG",
522             "Tautenburg 2 metre"
523             },
524             /* Catalina 61" (1981 Almanac) CATALINA61 */
525             {
526             WEST(110,43,55.1),
527             NORTH(32,25,0.7),
528             2510E0,
529             "CATALINA61",
530             "Catalina 61 inch"
531             },
532             /* Steward 90" (1981 Almanac) STEWARD90 */
533             {
534             WEST(111,35,58.24),
535             NORTH(31,57,46.9),
536             2071E0,
537             "STEWARD90",
538             "Steward 90 inch"
539             },
540             /* Russian 6m (1981 Almanac) USSR6 */
541             {
542             EAST(41,26,30.0),
543             NORTH(43,39,12.),
544             2100E0,
545             "USSR6",
546             "USSR 6 metre"
547             },
548             /* Arecibo 1000' (1981 Almanac) ARECIBO */
549             {
550             WEST(66,45,11.1),
551             NORTH(18,20,36.6),
552             496E0,
553             "ARECIBO",
554             "Arecibo 1000 foot"
555             },
556             /* Cambridge 5km (1981 Almanac) CAMB5KM */
557             {
558             EAST(0,2,37.23),
559             NORTH(52,10,12.2),
560             17E0,
561             "CAMB5KM",
562             "Cambridge 5km"
563             },
564             /* Cambridge 1 mile (1981 Almanac) CAMB1MILE */
565             {
566             EAST(0,2,21.64),
567             NORTH(52,9,47.3),
568             17E0,
569             "CAMB1MILE",
570             "Cambridge 1 mile"
571             },
572             /* Bonn 100m (1981 Almanac) EFFELSBERG */
573             {
574             EAST(6,53,1.5),
575             NORTH(50,31,28.6),
576             366E0,
577             "EFFELSBERG",
578             "Effelsberg 100 metre"
579             },
580             /* Greenbank 300' (1981 Almanac) GBVA300 (R.I.P.) */
581             {
582             WEST(79,50,56.36),
583             NORTH(38,25,46.3),
584             894E0,
585             "(R.I.P.)",
586             "Greenbank 300 foot"
587             },
588             /* Jodrell Bank Mk 1 (1981 Almanac) JODRELL1 */
589             {
590             WEST(2,18,25.),
591             NORTH(53,14,10.5),
592             78E0,
593             "JODRELL1",
594             "Jodrell Bank 250 foot"
595             },
596             /* Australia Telescope Parkes Observatory PARKES */
597             /* (Peter te Lintel Hekkert) */
598             {
599             EAST(148,15,44.3591),
600             SOUTH(32,59,59.8657),
601             391.79E0,
602             "PARKES",
603             "Parkes 64 metre"
604             },
605             /* VLA (1981 Almanac) VLA */
606             {
607             WEST(107,37,3.82),
608             NORTH(34,4,43.5),
609             2124E0,
610             "VLA",
611             "Very Large Array"
612             },
613             /* Sugar Grove 150' (1981 Almanac) SUGARGROVE */
614             {
615             WEST(79,16,23.),
616             NORTH(38,31,14.),
617             705E0,
618             "SUGARGROVE",
619             "Sugar Grove 150 foot"
620             },
621             /* Russian 600' (1981 Almanac) USSR600 */
622             {
623             EAST(41,35,25.5),
624             NORTH(43,49,32.),
625             973E0,
626             "USSR600",
627             "USSR 600 foot"
628             },
629             /* Nobeyama 45 metre mm dish (based on 1981 Almanac entry) NOBEYAMA */
630             {
631             EAST(138,29,12.),
632             NORTH(35,56,19.),
633             1350E0,
634             "NOBEYAMA",
635             "Nobeyama 45 metre"
636             },
637             /* James Clerk Maxwell 15 metre mm telescope, Mauna Kea JCMT */
638             /* From GPS measurements on 11Apr2007 for eSMA setup (R. Tilanus) */
639             {
640             WEST(155,28,37.30),
641             NORTH(19,49,22.22),
642             4124.75E0,
643             "JCMT",
644             "JCMT 15 metre"
645             },
646             /* ESO 3.5 metre NTT, La Silla (K.Wirenstrand) ESONTT */
647             {
648             WEST(70,43,7.),
649             SOUTH(29,15,30.),
650             2377E0,
651             "ESONTT",
652             "ESO 3.5 metre NTT"
653             },
654             /* St Andrews University Observatory (1982 Almanac) ST.ANDREWS */
655             {
656             WEST(2,48,52.5),
657             NORTH(56,20,12.),
658             30E0,
659             "ST.ANDREWS",
660             "St Andrews"
661             },
662             /* Apache Point 3.5 metre (R.Owen) APO3.5 */
663             {
664             WEST(105,49,11.56),
665             NORTH(32,46,48.96),
666             2809E0,
667             "APO3.5",
668             "Apache Point 3.5m"
669             },
670             /* W.M.Keck Observatory, Telescope 1 KECK1 */
671             /* (William Lupton) */
672             {
673             WEST(155,28,28.99),
674             NORTH(19,49,33.41),
675             4160E0,
676             "KECK1",
677             "Keck 10m Telescope #1"
678             },
679             /* Tautenberg Schmidt (1983 Almanac) TAUTSCHM */
680             {
681             EAST(11,42,45.0),
682             NORTH(50,58,51.0),
683             331E0,
684             "TAUTSCHM",
685             "Tautenberg 1.34 metre Schmidt"
686             },
687             /* Palomar Schmidt (1981 Almanac) PALOMAR48 */
688             {
689             WEST(116,51,32.0),
690             NORTH(33,21,26.0),
691             1706E0,
692             "PALOMAR48",
693             "Palomar 48-inch Schmidt"
694             },
695             /* UK Schmidt, Siding Spring (1983 Almanac) UKST */
696             {
697             EAST(149,4,12.8),
698             SOUTH(31,16,27.8),
699             1145E0,
700             "UKST",
701             "UK 1.2 metre Schmidt, Siding Spring"
702             },
703             /* Kiso Schmidt, Japan (1981 Almanac) KISO */
704             {
705             EAST(137,37,42.2),
706             NORTH(35,47,38.7),
707             1130E0,
708             "KISO",
709             "Kiso 1.05 metre Schmidt, Japan"
710             },
711             /* ESO Schmidt, La Silla (1981 Almanac) ESOSCHM */
712             {
713             WEST(70,43,46.5),
714             SOUTH(29,15,25.8),
715             2347E0,
716             "ESOSCHM",
717             "ESO 1 metre Schmidt, La Silla"
718             },
719             /* Australia Telescope Compact Array ATCA */
720             /* (WGS84 coordinates of Station 35, Mark Calabretta) */
721             {
722             EAST(149,33,0.500),
723             SOUTH(30,18,46.385),
724             236.9E0,
725             "ATCA",
726             "Australia Telescope Compact Array"
727             },
728             /* Australia Telescope Mopra Observatory MOPRA */
729             /* (Peter te Lintel Hekkert) */
730             {
731             EAST(149,5,58.732),
732             SOUTH(31,16,4.451),
733             850E0,
734             "MOPRA",
735             "ATNF Mopra Observatory"
736             },
737             /* Subaru telescope, Mauna Kea SUBARU */
738             /* (IfA website, Richard Wainscoat) */
739             {
740             WEST(155,28,33.67),
741             NORTH(19,49,31.81),
742             4163E0,
743             "SUBARU",
744             "Subaru 8m telescope"
745             },
746             /* Canada-France-Hawaii Telescope, Mauna Kea CFHT */
747             /* (IfA website, Richard Wainscoat) */
748             {
749             WEST(155,28,7.95),
750             NORTH(19,49,30.91),
751             4204.1E0,
752             "CFHT",
753             "Canada-France-Hawaii 3.6m Telescope"
754             },
755             /* W.M.Keck Observatory, Telescope 2 KECK2 */
756             /* (William Lupton) */
757             {
758             WEST(155,28,27.24),
759             NORTH(19,49,35.62),
760             4159.6E0,
761             "KECK2",
762             "Keck 10m Telescope #2"
763             },
764             /* Gemini North, Mauna Kea GEMININ */
765             /* (IfA website, Richard Wainscoat) */
766             {
767             WEST(155,28,8.57),
768             NORTH(19,49,25.69),
769             4213.4E0,
770             "GEMININ",
771             "Gemini North 8-m telescope"
772             },
773             /* Five College Radio Astronomy Observatory FCRAO */
774             /* (Tim Jenness) */
775             {
776             WEST(72,20,42.0),
777             NORTH(42,23,30.0),
778             314E0,
779             "FCRAO",
780             "Five College Radio Astronomy Obs"
781             },
782             /* NASA Infra Red Telescope Facility IRTF */
783             /* (IfA website, Richard Wainscoat) */
784             {
785             WEST(155,28,19.20),
786             NORTH(19,49,34.39),
787             4168.1E0,
788             "IRTF",
789             "NASA IR Telescope Facility, Mauna Kea"
790             },
791             /* Caltech Submillimeter Observatory CSO */
792             /* (IfA website, Richard Wainscoat; height estimated) */
793             {
794             WEST(155,28,31.79),
795             NORTH(19,49,20.78),
796             4080E0,
797             "CSO",
798             "Caltech Sub-mm Observatory, Mauna Kea"
799             },
800             /* ESO VLT, UT1 VLT1 */
801             /* (ESO website, VLT Whitebook Chapter 2) */
802             {
803             WEST(70,24,11.642),
804             SOUTH(24,37,33.117),
805             2635.43,
806             "VLT1",
807             "ESO VLT, Paranal, Chile: UT1"
808             },
809             /* ESO VLT, UT2 VLT2 */
810             /* (ESO website, VLT Whitebook Chapter 2) */
811             {
812             WEST(70,24,10.855),
813             SOUTH(24,37,31.465),
814             2635.43,
815             "VLT2",
816             "ESO VLT, Paranal, Chile: UT2"
817             },
818             /* ESO VLT, UT3 VLT3 */
819             /* (ESO website, VLT Whitebook Chapter 2) */
820             {
821             WEST(70,24,9.896),
822             SOUTH(24,37,30.300),
823             2635.43,
824             "VLT3",
825             "ESO VLT, Paranal, Chile: UT3"
826             },
827             /* ESO VLT, UT4 VLT4 */
828             /* (ESO website, VLT Whitebook Chapter 2) */
829             {
830             WEST(70,24,8.000),
831             SOUTH(24,37,31.000),
832             2635.43,
833             "VLT4",
834             "ESO VLT, Paranal, Chile: UT4"
835             },
836             /* Gemini South, Cerro Pachon GEMINIS */
837             /* (GPS readings by Patrick Wallace) */
838             {
839             WEST(70,44,11.5),
840             SOUTH(30,14,26.7),
841             2738E0,
842             "GEMINIS",
843             "Gemini South 8-m telescope"
844             },
845             /* Cologne Observatory for Submillimeter Astronomy (KOSMA) KOSMA3M */
846             /* (Holger Jakob) */
847             {
848             EAST(7,47,3.48),
849             NORTH(45,58,59.772),
850             3141E0,
851             "KOSMA3M",
852             "KOSMA 3m telescope, Gornergrat"
853             },
854             /* Magellan 1, 6.5m telescope at Las Campanas, Chile MAGELLAN1 */
855             /* (Skip Schaller) */
856             {
857             WEST(70,41,31.9),
858             SOUTH(29,0,51.7),
859             2408E0,
860             "MAGELLAN1",
861             "Magellan 1, 6.5m, Las Campanas"
862             },
863             /* Magellan 2, 6.5m telescope at Las Campanas, Chile MAGELLAN2 */
864             /* (Skip Schaller) */
865             {
866             WEST(70,41,33.5),
867             SOUTH(29,0,50.3),
868             2408E0,
869             "MAGELLAN2",
870             "Magellan 2, 6.5m, Las Campanas"
871             },
872             /* APEX - Atacama Pathfinder EXperiment, Llano de Chajnantor APEX */
873             /* (APEX web site) */
874             {
875             WEST(67,45,33.0),
876             SOUTH(23,0,20.8),
877             5105E0,
878             "APEX",
879             "APEX 12m telescope, Llano de Chajnantor"
880             },
881             /* NANTEN2 Submillimeter Observatory, 4m telescope Atacame desert NANTEN2 */
882             /* (NANTEN2 web site) */
883             {
884             WEST(67,42,8.0),
885             SOUTH(22,57,47.0),
886             4865E0,
887             "NANTEN2",
888             "NANTEN2 4m telescope, Pampa la Bola"
889             },
890             /* IRAM 30m telescope IRAM30M */
891             /* (IRAM web site) */
892             {
893             WEST(3,23,55.51),
894             NORTH(37,4,6.29),
895             2850.0E0,
896             "IRAM30M",
897             "IRAM 30m telescope, Pico Veleta"
898             },
899             /* IRAM NOEMA interferometer NOEMA */
900             /* (IRAM web site) */
901             {
902             EAST(5,54,28.5),
903             NORTH(44,38,2.0),
904             2550.0E0,
905             "NOEMA",
906             "NOEMA interferometer, Plateau de Bure"
907             }
908             };
909              
910             int retval = -1; /* Return status. 0 if found. -1 if no match */
911              
912             /* Work out the number of telescopes */
913             const size_t NTEL = sizeof(telData) / sizeof(struct telData);
914              
915             /* Prefill the return buffer in a pessimistic manner */
916             star_strellcpy( name, "?", namelen );
917              
918 11 100         if (n > 0) {
919 3 100         if (n <= NTEL) {
920             /* Index into telData with correction for zero-based indexing */
921             struct telData thistel;
922 2           thistel = telData[n-1];
923 2           *w = thistel.w;
924 2           *p = thistel.p;
925 2           *h = thistel.h;
926             star_strellcpy( ident, thistel.shortname, identlen );
927             star_strellcpy( name, thistel.longname, namelen );
928             retval = 0;
929             }
930              
931             } else {
932             /* Searching */
933             size_t i;
934 348 100         for (i=0; i
935 347           struct telData thistel = telData[i];
936 347 100         if (strcasecmp( c, thistel.shortname) == 0) {
937             /* a match */
938 7           *w = thistel.w;
939 7           *p = thistel.p;
940 7           *h = thistel.h;
941             star_strellcpy( ident, thistel.shortname, identlen );
942             star_strellcpy( name, thistel.longname, namelen );
943             retval = 0;
944 7           break;
945             }
946             }
947              
948             }
949              
950 11           return retval;
951              
952             }