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