WCSLIB  5.4.1
wcs.h
Go to the documentation of this file.
1 /*============================================================================
2 
3  WCSLIB 5.5 - an implementation of the FITS WCS standard.
4  Copyright (C) 1995-2015, Mark Calabretta
5 
6  This file is part of WCSLIB.
7 
8  WCSLIB is free software: you can redistribute it and/or modify it under the
9  terms of the GNU Lesser General Public License as published by the Free
10  Software Foundation, either version 3 of the License, or (at your option)
11  any later version.
12 
13  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
16  more details.
17 
18  You should have received a copy of the GNU Lesser General Public License
19  along with WCSLIB. If not, see http://www.gnu.org/licenses.
20 
21  Direct correspondence concerning WCSLIB to mark@calabretta.id.au
22 
23  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
24  http://www.atnf.csiro.au/people/Mark.Calabretta
25  $Id: wcs.h,v 5.5 2015/05/05 13:16:31 mcalabre Exp $
26 *=============================================================================
27 *
28 * WCSLIB 5.5 - C routines that implement the FITS World Coordinate System
29 * (WCS) standard. Refer to the README file provided with WCSLIB for an
30 * overview of the library.
31 *
32 *
33 * Summary of the wcs routines
34 * ---------------------------
35 * Routines in this suite implement the FITS World Coordinate System (WCS)
36 * standard which defines methods to be used for computing world coordinates
37 * from image pixel coordinates, and vice versa. The standard, and proposed
38 * extensions for handling distortions, are described in
39 *
40 = "Representations of world coordinates in FITS",
41 = Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (WCS Paper I)
42 =
43 = "Representations of celestial coordinates in FITS",
44 = Calabretta, M.R., & Greisen, E.W. 2002, A&A, 395, 1077 (WCS Paper II)
45 =
46 = "Representations of spectral coordinates in FITS",
47 = Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L.
48 = 2006, A&A, 446, 747 (WCS Paper III)
49 =
50 = "Representations of distortions in FITS world coordinate systems",
51 = Calabretta, M.R. et al. (WCS Paper IV, draft dated 2004/04/22),
52 = available from http://www.atnf.csiro.au/people/Mark.Calabretta
53 =
54 = "Mapping on the HEALPix grid",
55 = Calabretta, M.R., & Roukema, B.F. 2007, MNRAS, 381, 865 (WCS Paper V)
56 =
57 = "Representing the 'Butterfly' Projection in FITS -- Projection Code XPH",
58 = Calabretta, M.R., & Lowe, S.R. 2013, PASA, 30, e050 (WCS Paper VI)
59 *
60 * These routines are based on the wcsprm struct which contains all information
61 * needed for the computations. The struct contains some members that must be
62 * set by the user, and others that are maintained by these routines, somewhat
63 * like a C++ class but with no encapsulation.
64 *
65 * wcsnpv(), wcsnps(), wcsini(), wcssub(), and wcsfree() are provided to manage
66 * the wcsprm struct and another, wcsprt(), prints its contents. Refer to the
67 * description of the wcsprm struct for an explanation of the anticipated usage
68 * of these routines. wcscopy(), which does a deep copy of one wcsprm struct
69 * to another, is defined as a preprocessor macro function that invokes
70 * wcssub().
71 *
72 * wcsperr() prints the error message(s) (if any) stored in a wcsprm struct,
73 * and the linprm, celprm, prjprm, spcprm, and tabprm structs that it contains.
74 *
75 * A setup routine, wcsset(), computes intermediate values in the wcsprm struct
76 * from parameters in it that were supplied by the user. The struct always
77 * needs to be set up by wcsset() but this need not be called explicitly -
78 * refer to the explanation of wcsprm::flag.
79 *
80 * wcsp2s() and wcss2p() implement the WCS world coordinate transformations.
81 * In fact, they are high level driver routines for the WCS linear,
82 * logarithmic, celestial, spectral and tabular transformation routines
83 * described in lin.h, log.h, cel.h, spc.h and tab.h.
84 *
85 * Given either the celestial longitude or latitude plus an element of the
86 * pixel coordinate a hybrid routine, wcsmix(), iteratively solves for the
87 * unknown elements.
88 *
89 * wcssptr() translates the spectral axis in a wcsprm struct. For example, a
90 * 'FREQ' axis may be translated into 'ZOPT-F2W' and vice versa.
91 *
92 * wcslib_version() returns the WCSLIB version number.
93 *
94 * Quadcube projections:
95 * ---------------------
96 * The quadcube projections (TSC, CSC, QSC) may be represented in FITS in
97 * either of two ways:
98 *
99 * a: The six faces may be laid out in one plane and numbered as follows:
100 *
101 = 0
102 =
103 = 4 3 2 1 4 3 2
104 =
105 = 5
106 *
107 * Faces 2, 3 and 4 may appear on one side or the other (or both). The
108 * world-to-pixel routines map faces 2, 3 and 4 to the left but the
109 * pixel-to-world routines accept them on either side.
110 *
111 * b: The "COBE" convention in which the six faces are stored in a
112 * three-dimensional structure using a CUBEFACE axis indexed from
113 * 0 to 5 as above.
114 *
115 * These routines support both methods; wcsset() determines which is being
116 * used by the presence or absence of a CUBEFACE axis in ctype[]. wcsp2s()
117 * and wcss2p() translate the CUBEFACE axis representation to the single
118 * plane representation understood by the lower-level WCSLIB projection
119 * routines.
120 *
121 *
122 * wcsnpv() - Memory allocation for PVi_ma
123 * ---------------------------------------
124 * wcsnpv() changes the value of NPVMAX (default 64). This global variable
125 * controls the number of pvcard structs, for holding PVi_ma keyvalues, that
126 * wcsini() should allocate space for.
127 *
128 * PLEASE NOTE: This function is not thread-safe.
129 *
130 * Given:
131 * n int Value of NPVMAX; ignored if < 0.
132 *
133 * Function return value:
134 * int Current value of NPVMAX.
135 *
136 *
137 * wcsnps() - Memory allocation for PSi_ma
138 * ---------------------------------------
139 * wcsnps() changes the values of NPSMAX (default 8). This global variable
140 * controls the number of pscard structs, for holding PSi_ma keyvalues, that
141 * wcsini() should allocate space for.
142 *
143 * PLEASE NOTE: This function is not thread-safe.
144 *
145 * Given:
146 * n int Value of NPSMAX; ignored if < 0.
147 *
148 * Function return value:
149 * int Current value of NPSMAX.
150 *
151 *
152 * wcsini() - Default constructor for the wcsprm struct
153 * ----------------------------------------------------
154 * wcsini() optionally allocates memory for arrays in a wcsprm struct and sets
155 * all members of the struct to default values. Memory is allocated for up to
156 * NPVMAX PVi_ma keywords or NPSMAX PSi_ma keywords per WCS representation.
157 * These may be changed via wcsnpv() and wcsnps() before wcsini() is called.
158 *
159 * PLEASE NOTE: every wcsprm struct should be initialized by wcsini(), possibly
160 * repeatedly. On the first invokation, and only the first invokation,
161 * wcsprm::flag must be set to -1 to initialize memory management, regardless
162 * of whether wcsini() will actually be used to allocate memory.
163 *
164 * Given:
165 * alloc int If true, allocate memory unconditionally for the
166 * crpix, etc. arrays.
167 *
168 * If false, it is assumed that pointers to these arrays
169 * have been set by the user except if they are null
170 * pointers in which case memory will be allocated for
171 * them regardless. (In other words, setting alloc true
172 * saves having to initalize these pointers to zero.)
173 *
174 * naxis int The number of world coordinate axes. This is used to
175 * determine the length of the various wcsprm vectors and
176 * matrices and therefore the amount of memory to
177 * allocate for them.
178 *
179 * Given and returned:
180 * wcs struct wcsprm*
181 * Coordinate transformation parameters.
182 *
183 * Note that, in order to initialize memory management,
184 * wcsprm::flag should be set to -1 when wcs is
185 * initialized for the first time (memory leaks may
186 * result if it had already been initialized).
187 *
188 * Function return value:
189 * int Status return value:
190 * 0: Success.
191 * 1: Null wcsprm pointer passed.
192 * 2: Memory allocation failed.
193 *
194 * For returns > 1, a detailed error message is set in
195 * wcsprm::err if enabled, see wcserr_enable().
196 *
197 *
198 * wcssub() - Subimage extraction routine for the wcsprm struct
199 * ------------------------------------------------------------
200 * wcssub() extracts the coordinate description for a subimage from a wcsprm
201 * struct. It does a deep copy, using wcsini() to allocate memory for its
202 * arrays if required. Only the "information to be provided" part of the
203 * struct is extracted; a call to wcsset() is required to set up the remainder.
204 *
205 * The world coordinate system of the subimage must be separable in the sense
206 * that the world coordinates at any point in the subimage must depend only on
207 * the pixel coordinates of the axes extracted. In practice, this means that
208 * the PCi_ja matrix of the original image must not contain non-zero
209 * off-diagonal terms that associate any of the subimage axes with any of the
210 * non-subimage axes.
211 *
212 * Note that while the required elements of the tabprm array are extracted, the
213 * wtbarr array is not. (Thus it is not appropriate to call wcssub() after
214 * wcstab() but before filling the tabprm structs - refer to wcshdr.h.)
215 *
216 * wcssub() can also add axes to a wcsprm struct. The new axes will be created
217 * using the defaults set by wcsini() which produce a simple, unnamed, linear
218 * axis with world coordinate equal to the pixel coordinate. These default
219 * values can be changed afterwards, before invoking wcsset().
220 *
221 * Given:
222 * alloc int If true, allocate memory for the crpix, etc. arrays in
223 * the destination. Otherwise, it is assumed that
224 * pointers to these arrays have been set by the user
225 * except if they are null pointers in which case memory
226 * will be allocated for them regardless.
227 *
228 * wcssrc const struct wcsprm*
229 * Struct to extract from.
230 *
231 * Given and returned:
232 * nsub int*
233 * axes int[] Vector of length *nsub containing the image axis
234 * numbers (1-relative) to extract. Order is
235 * significant; axes[0] is the axis number of the input
236 * image that corresponds to the first axis in the
237 * subimage, etc.
238 *
239 * Use an axis number of 0 to create a new axis using
240 * the defaults set by wcsini(). They can be changed
241 * later.
242 *
243 * nsub (the pointer) may be set to zero, and so also may
244 * *nsub, which is interpreted to mean all axes in the
245 * input image; the number of axes will be returned if
246 * nsub != 0x0. axes itself (the pointer) may be set to
247 * zero to indicate the first *nsub axes in their
248 * original order.
249 *
250 * Set both nsub (or *nsub) and axes to zero to do a deep
251 * copy of one wcsprm struct to another.
252 *
253 * Subimage extraction by coordinate axis type may be
254 * done by setting the elements of axes[] to the
255 * following special preprocessor macro values:
256 *
257 * WCSSUB_LONGITUDE: Celestial longitude.
258 * WCSSUB_LATITUDE: Celestial latitude.
259 * WCSSUB_CUBEFACE: Quadcube CUBEFACE axis.
260 * WCSSUB_SPECTRAL: Spectral axis.
261 * WCSSUB_STOKES: Stokes axis.
262 *
263 * Refer to the notes (below) for further usage examples.
264 *
265 * On return, *nsub will be set to the number of axes in
266 * the subimage; this may be zero if there were no axes
267 * of the required type(s) (in which case no memory will
268 * be allocated). axes[] will contain the axis numbers
269 * that were extracted, or 0 for newly created axes. The
270 * vector length must be sufficient to contain all axis
271 * numbers. No checks are performed to verify that the
272 * coordinate axes are consistent, this is done by
273 * wcsset().
274 *
275 * wcsdst struct wcsprm*
276 * Struct describing the subimage. wcsprm::flag should
277 * be set to -1 if wcsdst was not previously initialized
278 * (memory leaks may result if it was previously
279 * initialized).
280 *
281 * Function return value:
282 * int Status return value:
283 * 0: Success.
284 * 1: Null wcsprm pointer passed.
285 * 2: Memory allocation failed.
286 * 12: Invalid subimage specification.
287 * 13: Non-separable subimage coordinate system.
288 *
289 * For returns > 1, a detailed error message is set in
290 * wcsprm::err if enabled, see wcserr_enable().
291 *
292 * Notes:
293 * Combinations of subimage axes of particular types may be extracted in the
294 * same order as they occur in the input image by combining preprocessor
295 * codes, for example
296 *
297 = *nsub = 1;
298 = axes[0] = WCSSUB_LONGITUDE | WCSSUB_LATITUDE | WCSSUB_SPECTRAL;
299 *
300 * would extract the longitude, latitude, and spectral axes in the same order
301 * as the input image. If one of each were present, *nsub = 3 would be
302 * returned.
303 *
304 * For convenience, WCSSUB_CELESTIAL is defined as the combination
305 * WCSSUB_LONGITUDE | WCSSUB_LATITUDE | WCSSUB_CUBEFACE.
306 *
307 * The codes may also be negated to extract all but the types specified, for
308 * example
309 *
310 = *nsub = 4;
311 = axes[0] = WCSSUB_LONGITUDE;
312 = axes[1] = WCSSUB_LATITUDE;
313 = axes[2] = WCSSUB_CUBEFACE;
314 = axes[3] = -(WCSSUB_SPECTRAL | WCSSUB_STOKES);
315 *
316 * The last of these specifies all axis types other than spectral or Stokes.
317 * Extraction is done in the order specified by axes[] a longitude axis (if
318 * present) would be extracted first (via axes[0]) and not subsequently (via
319 * axes[3]). Likewise for the latitude and cubeface axes in this example.
320 *
321 * From the foregoing, it is apparent that the value of *nsub returned may be
322 * less than or greater than that given. However, it will never exceed the
323 * number of axes in the input image (plus the number of newly-created axes
324 * if any were specified on input).
325 *
326 *
327 * wcscompare() - Compare two wcsprm structs for equality
328 * ------------------------------------------------------
329 * wcscompare() compares two wcsprm structs for equality.
330 *
331 * Given:
332 * cmp int A bit field controlling the strictness of the
333 * comparison. When 0, all fields must be identical.
334 *
335 * The following constants may be or'ed together to
336 * relax the comparison:
337 * WCSCOMPARE_ANCILLARY: Ignore ancillary keywords
338 * that don't change the WCS transformation, such
339 * as DATE-OBS or EQUINOX.
340 * WCSCOMPARE_TILING: Ignore integral differences in
341 * CRPIXja. This is the 'tiling' condition, where
342 * two WCSes cover different regions of the same
343 * map projection and align on the same map grid.
344 * WCSCOMPARE_CRPIX: Ignore any differences at all in
345 * CRPIXja. The two WCSes cover different regions
346 * of the same map projection but may not align on
347 * the same grid map. Overrides WCSCOMPARE_TILING.
348 *
349 * tol double Tolerance for comparison of floating-point values.
350 * For example, for tol == 1e-6, all floating-point
351 * values in the structs must be equal to the first 6
352 * decimal places. A value of 0 implies exact equality.
353 *
354 * wcs1 const struct wcsprm*
355 * The first wcsprm struct to compare.
356 *
357 * wcs2 const struct wcsprm*
358 * The second wcsprm struct to compare.
359 *
360 * Returned:
361 * equal int* Non-zero when the given structs are equal.
362 *
363 * Function return value:
364 * int Status return value:
365 * 0: Success.
366 * 1: Null pointer passed.
367 *
368 *
369 * wcscopy() macro - Copy routine for the wcsprm struct
370 * ----------------------------------------------------
371 * wcscopy() does a deep copy of one wcsprm struct to another. As of
372 * WCSLIB 3.6, it is implemented as a preprocessor macro that invokes
373 * wcssub() with the nsub and axes pointers both set to zero.
374 *
375 *
376 * wcsfree() - Destructor for the wcsprm struct
377 * --------------------------------------------
378 * wcsfree() frees memory allocated for the wcsprm arrays by wcsini() and/or
379 * wcsset(). wcsini() records the memory it allocates and wcsfree() will only
380 * attempt to free this.
381 *
382 * PLEASE NOTE: wcsfree() must not be invoked on a wcsprm struct that was not
383 * initialized by wcsini().
384 *
385 * Returned:
386 * wcs struct wcsprm*
387 * Coordinate transformation parameters.
388 *
389 * Function return value:
390 * int Status return value:
391 * 0: Success.
392 * 1: Null wcsprm pointer passed.
393 *
394 *
395 * wcsprt() - Print routine for the wcsprm struct
396 * ----------------------------------------------
397 * wcsprt() prints the contents of a wcsprm struct using wcsprintf(). Mainly
398 * intended for diagnostic purposes.
399 *
400 * Given:
401 * wcs const struct wcsprm*
402 * Coordinate transformation parameters.
403 *
404 * Function return value:
405 * int Status return value:
406 * 0: Success.
407 * 1: Null wcsprm pointer passed.
408 *
409 *
410 * wcsperr() - Print error messages from a wcsprm struct
411 * -----------------------------------------------------
412 * wcsperr() prints the error message(s), if any, stored in a wcsprm struct,
413 * and the linprm, celprm, prjprm, spcprm, and tabprm structs that it contains.
414 * If there are no errors then nothing is printed. It uses wcserr_prt(), q.v.
415 *
416 * Given:
417 * wcs const struct wcsprm*
418 * Coordinate transformation parameters.
419 *
420 * prefix const char *
421 * If non-NULL, each output line will be prefixed with
422 * this string.
423 *
424 * Function return value:
425 * int Status return value:
426 * 0: Success.
427 * 1: Null wcsprm pointer passed.
428 *
429 *
430 * wcsbchk() - Enable/disable bounds checking
431 * ------------------------------------------
432 * wcsbchk() is used to control bounds checking in the projection routines.
433 * Note that wcsset() always enables bounds checking. wcsbchk() will invoke
434 * wcsset() on the wcsprm struct beforehand if necessary.
435 *
436 * Given and returned:
437 * wcs struct wcsprm*
438 * Coordinate transformation parameters.
439 *
440 * Given:
441 * bounds int If bounds&1 then enable strict bounds checking for the
442 * spherical-to-Cartesian (s2x) transformation for the
443 * AZP, SZP, TAN, SIN, ZPN, and COP projections.
444 *
445 * If bounds&2 then enable strict bounds checking for the
446 * Cartesian-to-spherical (x2s) transformation for the
447 * HPX and XPH projections.
448 *
449 * If bounds&4 then enable bounds checking on the native
450 * coordinates returned by the Cartesian-to-spherical
451 * (x2s) transformations using prjchk().
452 *
453 * Zero it to disable all checking.
454 *
455 * Function return value:
456 * int Status return value:
457 * 0: Success.
458 * 1: Null wcsprm pointer passed.
459 *
460 *
461 * wcsset() - Setup routine for the wcsprm struct
462 * ----------------------------------------------
463 * wcsset() sets up a wcsprm struct according to information supplied within
464 * it (refer to the description of the wcsprm struct).
465 *
466 * wcsset() recognizes the NCP projection and converts it to the equivalent SIN
467 * projection and likewise translates GLS into SFL. It also translates the
468 * AIPS spectral types ('FREQ-LSR', 'FELO-HEL', etc.), possibly changing the
469 * input header keywords wcsprm::ctype and/or wcsprm::specsys if necessary.
470 *
471 * Note that this routine need not be called directly; it will be invoked by
472 * wcsp2s() and wcss2p() if the wcsprm::flag is anything other than a
473 * predefined magic value.
474 *
475 * Given and returned:
476 * wcs struct wcsprm*
477 * Coordinate transformation parameters.
478 *
479 * Function return value:
480 * int Status return value:
481 * 0: Success.
482 * 1: Null wcsprm pointer passed.
483 * 2: Memory allocation failed.
484 * 3: Linear transformation matrix is singular.
485 * 4: Inconsistent or unrecognized coordinate axis
486 * types.
487 * 5: Invalid parameter value.
488 * 6: Invalid coordinate transformation parameters.
489 * 7: Ill-conditioned coordinate transformation
490 * parameters.
491 *
492 * For returns > 1, a detailed error message is set in
493 * wcsprm::err if enabled, see wcserr_enable().
494 *
495 * Notes:
496 * wcsset() always enables strict bounds checking in the projection routines
497 * (via a call to prjini()). Use wcsbchk() to modify bounds-checking after
498 * wcsset() is invoked.
499 *
500 *
501 * wcsp2s() - Pixel-to-world transformation
502 * ----------------------------------------
503 * wcsp2s() transforms pixel coordinates to world coordinates.
504 *
505 * Given and returned:
506 * wcs struct wcsprm*
507 * Coordinate transformation parameters.
508 *
509 * Given:
510 * ncoord,
511 * nelem int The number of coordinates, each of vector length
512 * nelem but containing wcs.naxis coordinate elements.
513 * Thus nelem must equal or exceed the value of the
514 * NAXIS keyword unless ncoord == 1, in which case nelem
515 * is not used.
516 *
517 * pixcrd const double[ncoord][nelem]
518 * Array of pixel coordinates.
519 *
520 * Returned:
521 * imgcrd double[ncoord][nelem]
522 * Array of intermediate world coordinates. For
523 * celestial axes, imgcrd[][wcs.lng] and
524 * imgcrd[][wcs.lat] are the projected x-, and
525 * y-coordinates in pseudo "degrees". For spectral
526 * axes, imgcrd[][wcs.spec] is the intermediate spectral
527 * coordinate, in SI units.
528 *
529 * phi,theta double[ncoord]
530 * Longitude and latitude in the native coordinate system
531 * of the projection [deg].
532 *
533 * world double[ncoord][nelem]
534 * Array of world coordinates. For celestial axes,
535 * world[][wcs.lng] and world[][wcs.lat] are the
536 * celestial longitude and latitude [deg]. For
537 * spectral axes, imgcrd[][wcs.spec] is the intermediate
538 * spectral coordinate, in SI units.
539 *
540 * stat int[ncoord]
541 * Status return value for each coordinate:
542 * 0: Success.
543 * 1+: A bit mask indicating invalid pixel coordinate
544 * element(s).
545 *
546 * Function return value:
547 * int Status return value:
548 * 0: Success.
549 * 1: Null wcsprm pointer passed.
550 * 2: Memory allocation failed.
551 * 3: Linear transformation matrix is singular.
552 * 4: Inconsistent or unrecognized coordinate axis
553 * types.
554 * 5: Invalid parameter value.
555 * 6: Invalid coordinate transformation parameters.
556 * 7: Ill-conditioned coordinate transformation
557 * parameters.
558 * 8: One or more of the pixel coordinates were
559 * invalid, as indicated by the stat vector.
560 *
561 * For returns > 1, a detailed error message is set in
562 * wcsprm::err if enabled, see wcserr_enable().
563 *
564 *
565 * wcss2p() - World-to-pixel transformation
566 * ----------------------------------------
567 * wcss2p() transforms world coordinates to pixel coordinates.
568 *
569 * Given and returned:
570 * wcs struct wcsprm*
571 * Coordinate transformation parameters.
572 *
573 * Given:
574 * ncoord,
575 * nelem int The number of coordinates, each of vector length nelem
576 * but containing wcs.naxis coordinate elements. Thus
577 * nelem must equal or exceed the value of the NAXIS
578 * keyword unless ncoord == 1, in which case nelem is not
579 * used.
580 *
581 * world const double[ncoord][nelem]
582 * Array of world coordinates. For celestial axes,
583 * world[][wcs.lng] and world[][wcs.lat] are the
584 * celestial longitude and latitude [deg]. For spectral
585 * axes, world[][wcs.spec] is the spectral coordinate, in
586 * SI units.
587 *
588 * Returned:
589 * phi,theta double[ncoord]
590 * Longitude and latitude in the native coordinate
591 * system of the projection [deg].
592 *
593 * imgcrd double[ncoord][nelem]
594 * Array of intermediate world coordinates. For
595 * celestial axes, imgcrd[][wcs.lng] and
596 * imgcrd[][wcs.lat] are the projected x-, and
597 * y-coordinates in pseudo "degrees". For quadcube
598 * projections with a CUBEFACE axis the face number is
599 * also returned in imgcrd[][wcs.cubeface]. For
600 * spectral axes, imgcrd[][wcs.spec] is the intermediate
601 * spectral coordinate, in SI units.
602 *
603 * pixcrd double[ncoord][nelem]
604 * Array of pixel coordinates.
605 *
606 * stat int[ncoord]
607 * Status return value for each coordinate:
608 * 0: Success.
609 * 1+: A bit mask indicating invalid world coordinate
610 * element(s).
611 *
612 * Function return value:
613 * int Status return value:
614 * 0: Success.
615 * 1: Null wcsprm pointer passed.
616 * 2: Memory allocation failed.
617 * 3: Linear transformation matrix is singular.
618 * 4: Inconsistent or unrecognized coordinate axis
619 * types.
620 * 5: Invalid parameter value.
621 * 6: Invalid coordinate transformation parameters.
622 * 7: Ill-conditioned coordinate transformation
623 * parameters.
624 * 9: One or more of the world coordinates were
625 * invalid, as indicated by the stat vector.
626 *
627 * For returns > 1, a detailed error message is set in
628 * wcsprm::err if enabled, see wcserr_enable().
629 *
630 *
631 * wcsmix() - Hybrid coordinate transformation
632 * -------------------------------------------
633 * wcsmix(), given either the celestial longitude or latitude plus an element
634 * of the pixel coordinate, solves for the remaining elements by iterating on
635 * the unknown celestial coordinate element using wcss2p(). Refer also to the
636 * notes below.
637 *
638 * Given and returned:
639 * wcs struct wcsprm*
640 * Indices for the celestial coordinates obtained
641 * by parsing the wcsprm::ctype[].
642 *
643 * Given:
644 * mixpix int Which element of the pixel coordinate is given.
645 *
646 * mixcel int Which element of the celestial coordinate is given:
647 * 1: Celestial longitude is given in
648 * world[wcs.lng], latitude returned in
649 * world[wcs.lat].
650 * 2: Celestial latitude is given in
651 * world[wcs.lat], longitude returned in
652 * world[wcs.lng].
653 *
654 * vspan const double[2]
655 * Solution interval for the celestial coordinate [deg].
656 * The ordering of the two limits is irrelevant.
657 * Longitude ranges may be specified with any convenient
658 * normalization, for example [-120,+120] is the same as
659 * [240,480], except that the solution will be returned
660 * with the same normalization, i.e. lie within the
661 * interval specified.
662 *
663 * vstep const double
664 * Step size for solution search [deg]. If zero, a
665 * sensible, although perhaps non-optimal default will be
666 * used.
667 *
668 * viter int If a solution is not found then the step size will be
669 * halved and the search recommenced. viter controls how
670 * many times the step size is halved. The allowed range
671 * is 5 - 10.
672 *
673 * Given and returned:
674 * world double[naxis]
675 * World coordinate elements. world[wcs.lng] and
676 * world[wcs.lat] are the celestial longitude and
677 * latitude [deg]. Which is given and which returned
678 * depends on the value of mixcel. All other elements
679 * are given.
680 *
681 * Returned:
682 * phi,theta double[naxis]
683 * Longitude and latitude in the native coordinate
684 * system of the projection [deg].
685 *
686 * imgcrd double[naxis]
687 * Image coordinate elements. imgcrd[wcs.lng] and
688 * imgcrd[wcs.lat] are the projected x-, and
689 * y-coordinates in pseudo "degrees".
690 *
691 * Given and returned:
692 * pixcrd double[naxis]
693 * Pixel coordinate. The element indicated by mixpix is
694 * given and the remaining elements are returned.
695 *
696 * Function return value:
697 * int Status return value:
698 * 0: Success.
699 * 1: Null wcsprm pointer passed.
700 * 2: Memory allocation failed.
701 * 3: Linear transformation matrix is singular.
702 * 4: Inconsistent or unrecognized coordinate axis
703 * types.
704 * 5: Invalid parameter value.
705 * 6: Invalid coordinate transformation parameters.
706 * 7: Ill-conditioned coordinate transformation
707 * parameters.
708 * 10: Invalid world coordinate.
709 * 11: No solution found in the specified interval.
710 *
711 * For returns > 1, a detailed error message is set in
712 * wcsprm::err if enabled, see wcserr_enable().
713 *
714 * Notes:
715 * Initially the specified solution interval is checked to see if it's a
716 * "crossing" interval. If it isn't, a search is made for a crossing
717 * solution by iterating on the unknown celestial coordinate starting at the
718 * upper limit of the solution interval and decrementing by the specified
719 * step size. A crossing is indicated if the trial value of the pixel
720 * coordinate steps through the value specified. If a crossing interval is
721 * found then the solution is determined by a modified form of "regula falsi"
722 * division of the crossing interval. If no crossing interval was found
723 * within the specified solution interval then a search is made for a
724 * "non-crossing" solution as may arise from a point of tangency. The
725 * process is complicated by having to make allowance for the discontinuities
726 * that occur in all map projections.
727 *
728 * Once one solution has been determined others may be found by subsequent
729 * invokations of wcsmix() with suitably restricted solution intervals.
730 *
731 * Note the circumstance that arises when the solution point lies at a native
732 * pole of a projection in which the pole is represented as a finite curve,
733 * for example the zenithals and conics. In such cases two or more valid
734 * solutions may exist but wcsmix() only ever returns one.
735 *
736 * Because of its generality wcsmix() is very compute-intensive. For
737 * compute-limited applications more efficient special-case solvers could be
738 * written for simple projections, for example non-oblique cylindrical
739 * projections.
740 *
741 *
742 * wcssptr() - Spectral axis translation
743 * -------------------------------------
744 * wcssptr() translates the spectral axis in a wcsprm struct. For example, a
745 * 'FREQ' axis may be translated into 'ZOPT-F2W' and vice versa.
746 *
747 * Given and returned:
748 * wcs struct wcsprm*
749 * Coordinate transformation parameters.
750 *
751 * i int* Index of the spectral axis (0-relative). If given < 0
752 * it will be set to the first spectral axis identified
753 * from the ctype[] keyvalues in the wcsprm struct.
754 *
755 * ctype char[9] Desired spectral CTYPEia. Wildcarding may be used as
756 * for the ctypeS2 argument to spctrn() as described in
757 * the prologue of spc.h, i.e. if the final three
758 * characters are specified as "???", or if just the
759 * eighth character is specified as '?', the correct
760 * algorithm code will be substituted and returned.
761 *
762 * Function return value:
763 * int Status return value:
764 * 0: Success.
765 * 1: Null wcsprm pointer passed.
766 * 2: Memory allocation failed.
767 * 3: Linear transformation matrix is singular.
768 * 4: Inconsistent or unrecognized coordinate axis
769 * types.
770 * 5: Invalid parameter value.
771 * 6: Invalid coordinate transformation parameters.
772 * 7: Ill-conditioned coordinate transformation
773 * parameters.
774 * 12: Invalid subimage specification (no spectral
775 * axis).
776 *
777 * For returns > 1, a detailed error message is set in
778 * wcsprm::err if enabled, see wcserr_enable().
779 *
780 *
781 * wcslib_version() - WCSLIB version number
782 * ----------------------------------------
783 * wcslib_version() returns the WCSLIB version number.
784 *
785 * The major version number changes when the ABI changes or when the license
786 * conditions change. ABI changes typically result from a change to the
787 * contents of one of the structs. The major version number is used to
788 * distinguish between incompatible versions of the sharable library.
789 *
790 * The minor version number changes with new functionality or bug fixes that do
791 * not involve a change in the ABI.
792 *
793 * The auxiliary version number (which is often absent) signals changes to the
794 * documentation, test suite, build procedures, or any other change that does
795 * not affect the compiled library.
796 *
797 * Returned:
798 * vers[3] int[3] The broken-down version number:
799 * 0: Major version number.
800 * 1: Minor version number.
801 * 2: Auxiliary version number (zero if absent).
802 * May be given as a null pointer if not required.
803 *
804 * Function return value:
805 * char* A null-terminated, statically allocated string
806 * containing the version number in the usual form, i.e.
807 * "<major>.<minor>.<auxiliary>".
808 *
809 *
810 * wcsprm struct - Coordinate transformation parameters
811 * ----------------------------------------------------
812 * The wcsprm struct contains information required to transform world
813 * coordinates. It consists of certain members that must be set by the user
814 * ("given") and others that are set by the WCSLIB routines ("returned").
815 * While the addresses of the arrays themselves may be set by wcsini() if it
816 * (optionally) allocates memory, their contents must be set by the user.
817 *
818 * Some parameters that are given are not actually required for transforming
819 * coordinates. These are described as "auxiliary"; the struct simply provides
820 * a place to store them, though they may be used by wcshdo() in constructing a
821 * FITS header from a wcsprm struct. Some of the returned values are supplied
822 * for informational purposes and others are for internal use only as
823 * indicated.
824 *
825 * In practice, it is expected that a WCS parser would scan the FITS header to
826 * determine the number of coordinate axes. It would then use wcsini() to
827 * allocate memory for arrays in the wcsprm struct and set default values.
828 * Then as it reread the header and identified each WCS keyrecord it would load
829 * the value into the relevant wcsprm array element. This is essentially what
830 * wcspih() does - refer to the prologue of wcshdr.h. As the final step,
831 * wcsset() is invoked, either directly or indirectly, to set the derived
832 * members of the wcsprm struct. wcsset() strips off trailing blanks in all
833 * string members and null-fills the character array.
834 *
835 * int flag
836 * (Given and returned) This flag must be set to zero whenever any of the
837 * following wcsprm struct members are set or changed:
838 *
839 * - wcsprm::naxis (q.v., not normally set by the user),
840 * - wcsprm::crpix,
841 * - wcsprm::pc,
842 * - wcsprm::cdelt,
843 * - wcsprm::crval,
844 * - wcsprm::cunit,
845 * - wcsprm::ctype,
846 * - wcsprm::lonpole,
847 * - wcsprm::latpole,
848 * - wcsprm::restfrq,
849 * - wcsprm::restwav,
850 * - wcsprm::npv,
851 * - wcsprm::pv,
852 * - wcsprm::nps,
853 * - wcsprm::ps,
854 * - wcsprm::cd,
855 * - wcsprm::crota,
856 * - wcsprm::altlin,
857 * - wcsprm::ntab,
858 * - wcsprm::nwtb,
859 * - wcsprm::tab,
860 * - wcsprm::wtb.
861 *
862 * This signals the initialization routine, wcsset(), to recompute the
863 * returned members of the celprm struct. celset() will reset flag to
864 * indicate that this has been done.
865 *
866 * PLEASE NOTE: flag should be set to -1 when wcsini() is called for the
867 * first time for a particular wcsprm struct in order to initialize memory
868 * management. It must ONLY be used on the first initialization otherwise
869 * memory leaks may result.
870 *
871 * int naxis
872 * (Given or returned) Number of pixel and world coordinate elements.
873 *
874 * If wcsini() is used to initialize the linprm struct (as would normally
875 * be the case) then it will set naxis from the value passed to it as a
876 * function argument. The user should not subsequently modify it.
877 *
878 * double *crpix
879 * (Given) Address of the first element of an array of double containing
880 * the coordinate reference pixel, CRPIXja.
881 *
882 * double *pc
883 * (Given) Address of the first element of the PCi_ja (pixel coordinate)
884 * transformation matrix. The expected order is
885 *
886 = struct wcsprm wcs;
887 = wcs.pc = {PC1_1, PC1_2, PC2_1, PC2_2};
888 *
889 * This may be constructed conveniently from a 2-D array via
890 *
891 = double m[2][2] = {{PC1_1, PC1_2},
892 = {PC2_1, PC2_2}};
893 *
894 * which is equivalent to
895 *
896 = double m[2][2];
897 = m[0][0] = PC1_1;
898 = m[0][1] = PC1_2;
899 = m[1][0] = PC2_1;
900 = m[1][1] = PC2_2;
901 *
902 * The storage order for this 2-D array is the same as for the 1-D array,
903 * whence
904 *
905 = wcs.pc = *m;
906 *
907 * would be legitimate.
908 *
909 * double *cdelt
910 * (Given) Address of the first element of an array of double containing
911 * the coordinate increments, CDELTia.
912 *
913 * double *crval
914 * (Given) Address of the first element of an array of double containing
915 * the coordinate reference values, CRVALia.
916 *
917 * char (*cunit)[72]
918 * (Given) Address of the first element of an array of char[72] containing
919 * the CUNITia keyvalues which define the units of measurement of the
920 * CRVALia, CDELTia, and CDi_ja keywords.
921 *
922 * As CUNITia is an optional header keyword, cunit[][72] may be left blank
923 * but otherwise is expected to contain a standard units specification as
924 * defined by WCS Paper I. Utility function wcsutrn(), described in
925 * wcsunits.h, is available to translate commonly used non-standard units
926 * specifications but this must be done as a separate step before invoking
927 * wcsset().
928 *
929 * For celestial axes, if cunit[][72] is not blank, wcsset() uses
930 * wcsunits() to parse it and scale cdelt[], crval[], and cd[][*] to
931 * degrees. It then resets cunit[][72] to "deg".
932 *
933 * For spectral axes, if cunit[][72] is not blank, wcsset() uses wcsunits()
934 * to parse it and scale cdelt[], crval[], and cd[][*] to SI units. It
935 * then resets cunit[][72] accordingly.
936 *
937 * wcsset() ignores cunit[][72] for other coordinate types; cunit[][72] may
938 * be used to label coordinate values.
939 *
940 * These variables accomodate the longest allowed string-valued FITS
941 * keyword, being limited to 68 characters, plus the null-terminating
942 * character.
943 *
944 * char (*ctype)[72]
945 * (Given) Address of the first element of an array of char[72] containing
946 * the coordinate axis types, CTYPEia.
947 *
948 * The ctype[][72] keyword values must be in upper case and there must be
949 * zero or one pair of matched celestial axis types, and zero or one
950 * spectral axis. The ctype[][72] strings should be padded with blanks on
951 * the right and null-terminated so that they are at least eight characters
952 * in length.
953 *
954 * These variables accomodate the longest allowed string-valued FITS
955 * keyword, being limited to 68 characters, plus the null-terminating
956 * character.
957 *
958 * double lonpole
959 * (Given and returned) The native longitude of the celestial pole, phi_p,
960 * given by LONPOLEa [deg] or by PVi_2a [deg] attached to the longitude
961 * axis which takes precedence if defined, and ...
962 * double latpole
963 * (Given and returned) ... the native latitude of the celestial pole,
964 * theta_p, given by LATPOLEa [deg] or by PVi_3a [deg] attached to the
965 * longitude axis which takes precedence if defined.
966 *
967 * lonpole and latpole may be left to default to values set by wcsini()
968 * (see celprm::ref), but in any case they will be reset by wcsset() to
969 * the values actually used. Note therefore that if the wcsprm struct is
970 * reused without resetting them, whether directly or via wcsini(), they
971 * will no longer have their default values.
972 *
973 * double restfrq
974 * (Given) The rest frequency [Hz], and/or ...
975 * double restwav
976 * (Given) ... the rest wavelength in vacuo [m], only one of which need be
977 * given, the other should be set to zero.
978 *
979 * int npv
980 * (Given) The number of entries in the wcsprm::pv[] array.
981 *
982 * int npvmax
983 * (Given or returned) The length of the wcsprm::pv[] array.
984 *
985 * npvmax will be set by wcsini() if it allocates memory for wcsprm::pv[],
986 * otherwise it must be set by the user. See also wcsnpv().
987 *
988 * struct pvcard *pv
989 * (Given) Address of the first element of an array of length npvmax of
990 * pvcard structs.
991 *
992 * As a FITS header parser encounters each PVi_ma keyword it should load it
993 * into a pvcard struct in the array and increment npv. wcsset()
994 * interprets these as required.
995 *
996 * Note that, if they were not given, wcsset() resets the entries for
997 * PVi_1a, PVi_2a, PVi_3a, and PVi_4a for longitude axis i to match
998 * phi_0 and theta_0 (the native longitude and latitude of the reference
999 * point), LONPOLEa and LATPOLEa respectively.
1000 *
1001 * int nps
1002 * (Given) The number of entries in the wcsprm::ps[] array.
1003 *
1004 * int npsmax
1005 * (Given or returned) The length of the wcsprm::ps[] array.
1006 *
1007 * npsmax will be set by wcsini() if it allocates memory for wcsprm::ps[],
1008 * otherwise it must be set by the user. See also wcsnps().
1009 *
1010 * struct pscard *ps
1011 * (Given) Address of the first element of an array of length npsmax of
1012 * pscard structs.
1013 *
1014 * As a FITS header parser encounters each PSi_ma keyword it should load it
1015 * into a pscard struct in the array and increment nps. wcsset()
1016 * interprets these as required (currently no PSi_ma keyvalues are
1017 * recognized).
1018 *
1019 * double *cd
1020 * (Given) For historical compatibility, the wcsprm struct supports two
1021 * alternate specifications of the linear transformation matrix, those
1022 * associated with the CDi_ja keywords, and ...
1023 * double *crota
1024 * (Given) ... those associated with the CROTAia keywords. Although these
1025 * may not formally co-exist with PCi_ja, the approach taken here is simply
1026 * to ignore them if given in conjunction with PCi_ja.
1027 *
1028 * int altlin
1029 * (Given) altlin is a bit flag that denotes which of the PCi_ja, CDi_ja
1030 * and CROTAia keywords are present in the header:
1031 *
1032 * - Bit 0: PCi_ja is present.
1033 *
1034 * - Bit 1: CDi_ja is present.
1035 *
1036 * Matrix elements in the IRAF convention are
1037 * equivalent to the product CDi_ja = CDELTia * PCi_ja, but the
1038 * defaults differ from that of the PCi_ja matrix. If one or more
1039 * CDi_ja keywords are present then all unspecified CDi_ja default to
1040 * zero. If no CDi_ja (or CROTAia) keywords are present, then the
1041 * header is assumed to be in PCi_ja form whether or not any PCi_ja
1042 * keywords are present since this results in an interpretation of
1043 * CDELTia consistent with the original FITS specification.
1044 *
1045 * While CDi_ja may not formally co-exist with PCi_ja, it may co-exist
1046 * with CDELTia and CROTAia which are to be ignored.
1047 *
1048 * - Bit 2: CROTAia is present.
1049 *
1050 * In the AIPS convention, CROTAia may only be
1051 * associated with the latitude axis of a celestial axis pair. It
1052 * specifies a rotation in the image plane that is applied AFTER the
1053 * CDELTia; any other CROTAia keywords are ignored.
1054 *
1055 * CROTAia may not formally co-exist with PCi_ja.
1056 *
1057 * CROTAia and CDELTia may formally co-exist with CDi_ja but if so are to
1058 * be ignored.
1059 *
1060 * CDi_ja and CROTAia keywords, if found, are to be stored in the
1061 * wcsprm::cd and wcsprm::crota arrays which are dimensioned similarly to
1062 * wcsprm::pc and wcsprm::cdelt. FITS
1063 * header parsers should use the following procedure:
1064 *
1065 * - Whenever a PCi_ja keyword is encountered: altlin |= 1;
1066 *
1067 * - Whenever a CDi_ja keyword is encountered: altlin |= 2;
1068 *
1069 * - Whenever a CROTAia keyword is encountered: altlin |= 4;
1070 *
1071 * If none of these bits are set the PCi_ja representation results, i.e.
1072 * wcsprm::pc and wcsprm::cdelt will be used as given.
1073 *
1074 * These alternate specifications of the linear transformation matrix are
1075 * translated immediately to PCi_ja by wcsset() and are invisible to the
1076 * lower-level WCSLIB routines. In particular, wcsset() resets
1077 * wcsprm::cdelt to unity if CDi_ja is present (and no PCi_ja).
1078 *
1079 * If CROTAia are present but none is associated with the latitude axis
1080 * (and no PCi_ja or CDi_ja), then wcsset() reverts to a unity PCi_ja
1081 * matrix.
1082 *
1083 * int velref
1084 * (Given) AIPS velocity code VELREF, refer to spcaips().
1085 *
1086 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1087 * wcsprm::velref is changed.
1088 *
1089 * char alt[4]
1090 * (Given, auxiliary) Character code for alternate coordinate descriptions
1091 * (i.e. the 'a' in keyword names such as CTYPEia). This is blank for the
1092 * primary coordinate description, or one of the 26 upper-case letters,
1093 * A-Z.
1094 *
1095 * An array of four characters is provided for alignment purposes, only the
1096 * first is used.
1097 *
1098 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1099 * wcsprm::alt is changed.
1100 *
1101 * int colnum
1102 * (Given, auxiliary) Where the coordinate representation is associated
1103 * with an image-array column in a FITS binary table, this variable may be
1104 * used to record the relevant column number.
1105 *
1106 * It should be set to zero for an image header or pixel list.
1107 *
1108 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1109 * wcsprm::colnum is changed.
1110 *
1111 * int *colax
1112 * (Given, auxiliary) Address of the first element of an array of int
1113 * recording the column numbers for each axis in a pixel list.
1114 *
1115 * The array elements should be set to zero for an image header or image
1116 * array in a binary table.
1117 *
1118 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1119 * wcsprm::colax is changed.
1120 *
1121 * char (*cname)[72]
1122 * (Given, auxiliary) The address of the first element of an array of
1123 * char[72] containing the coordinate axis names, CNAMEia.
1124 *
1125 * These variables accomodate the longest allowed string-valued FITS
1126 * keyword, being limited to 68 characters, plus the null-terminating
1127 * character.
1128 *
1129 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1130 * wcsprm::cname is changed.
1131 *
1132 * double *crder
1133 * (Given, auxiliary) Address of the first element of an array of double
1134 * recording the random error in the coordinate value, CRDERia.
1135 *
1136 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1137 * wcsprm::crder is changed.
1138 *
1139 * double *csyer
1140 * (Given, auxiliary) Address of the first element of an array of double
1141 * recording the systematic error in the coordinate value, CSYERia.
1142 *
1143 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1144 * wcsprm::csyer is changed.
1145 *
1146 * char dateavg[72]
1147 * (Given, auxiliary) The date of a representative mid-point of the
1148 * observation in ISO format, yyyy-mm-ddThh:mm:ss.
1149 *
1150 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1151 * wcsprm::dateavg is changed.
1152 *
1153 * char dateobs[72]
1154 * (Given, auxiliary) The date of the start of the observation unless
1155 * otherwise explained in the comment field of the DATE-OBS keyword, in
1156 * ISO format, yyyy-mm-ddThh:mm:ss.
1157 *
1158 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1159 * wcsprm::dateobs is changed.
1160 *
1161 * double equinox
1162 * (Given, auxiliary) The equinox associated with dynamical equatorial or
1163 * ecliptic coordinate systems, EQUINOXa (or EPOCH in older headers). Not
1164 * applicable to ICRS equatorial or ecliptic coordinates.
1165 *
1166 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1167 * wcsprm::equinox is changed.
1168 *
1169 * double mjdavg
1170 * (Given, auxiliary) Modified Julian Date (MJD = JD - 2400000.5), MJD-AVG,
1171 * corresponding to DATE-AVG.
1172 *
1173 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1174 * wcsprm::mjdavg is changed.
1175 *
1176 * double mjdobs
1177 * (Given, auxiliary) Modified Julian Date (MJD = JD - 2400000.5), MJD-OBS,
1178 * corresponding to DATE-OBS.
1179 *
1180 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1181 * wcsprm::mjdobs is changed.
1182 *
1183 * double obsgeo[3]
1184 * (Given, auxiliary) Location of the observer in a standard terrestrial
1185 * reference frame, OBSGEO-X, OBSGEO-Y, OBSGEO-Z [m].
1186 *
1187 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1188 * wcsprm::obsgeo is changed.
1189 *
1190 * char radesys[72]
1191 * (Given, auxiliary) The equatorial or ecliptic coordinate system type,
1192 * RADESYSa.
1193 *
1194 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1195 * wcsprm::radesys is changed.
1196 *
1197 * char specsys[72]
1198 * (Given, auxiliary) Spectral reference frame (standard of rest),
1199 * SPECSYSa.
1200 *
1201 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1202 * wcsprm::specsys is changed.
1203 *
1204 * char ssysobs[72]
1205 * (Given, auxiliary) The spectral reference frame in which there is no
1206 * differential variation in the spectral coordinate across the
1207 * field-of-view, SSYSOBSa.
1208 *
1209 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1210 * wcsprm::ssysobs is changed.
1211 *
1212 * double velosys
1213 * (Given, auxiliary) The relative radial velocity [m/s] between the
1214 * observer and the selected standard of rest in the direction of the
1215 * celestial reference coordinate, VELOSYSa.
1216 *
1217 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1218 * wcsprm::velosys is changed.
1219 *
1220 * double zsource
1221 * (Given, auxiliary) The redshift, ZSOURCEa, of the source.
1222 *
1223 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1224 * wcsprm::zsource is changed.
1225 *
1226 * char ssyssrc[72]
1227 * (Given, auxiliary) The spectral reference frame (standard of rest),
1228 * SSYSSRCa, in which wcsprm::zsource was measured.
1229 *
1230 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1231 * wcsprm::ssyssrc is changed.
1232 *
1233 * double velangl
1234 * (Given, auxiliary) The angle [deg] that should be used to decompose an
1235 * observed velocity into radial and transverse components.
1236 *
1237 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1238 * wcsprm::velangl is changed.
1239 *
1240 * char wcsname[72]
1241 * (Given, auxiliary) The name given to the coordinate representation,
1242 * WCSNAMEa. This variable accomodates the longest allowed string-valued
1243 * FITS keyword, being limited to 68 characters, plus the null-terminating
1244 * character.
1245 *
1246 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1247 * wcsprm::wcsname is changed.
1248 *
1249 * int ntab
1250 * (Given) See wcsprm::tab.
1251 *
1252 * int nwtb
1253 * (Given) See wcsprm::wtb.
1254 *
1255 * struct tabprm *tab
1256 * (Given) Address of the first element of an array of ntab tabprm structs
1257 * for which memory has been allocated. These are used to store tabular
1258 * transformation parameters.
1259 *
1260 * Although technically wcsprm::ntab and tab are "given", they will
1261 * normally be set by invoking wcstab(), whether directly or indirectly.
1262 *
1263 * The tabprm structs contain some members that must be supplied and others
1264 * that are derived. The information to be supplied comes primarily from
1265 * arrays stored in one or more FITS binary table extensions. These
1266 * arrays, referred to here as "wcstab arrays", are themselves located by
1267 * parameters stored in the FITS image header.
1268 *
1269 * struct wtbarr *wtb
1270 * (Given) Address of the first element of an array of nwtb wtbarr structs
1271 * for which memory has been allocated. These are used in extracting
1272 * wcstab arrays from a FITS binary table.
1273 *
1274 * Although technically wcsprm::nwtb and wtb are "given", they will
1275 * normally be set by invoking wcstab(), whether directly or indirectly.
1276 *
1277 * char lngtyp[8]
1278 * (Returned) Four-character WCS celestial longitude and ...
1279 * char lattyp[8]
1280 * (Returned) ... latitude axis types. e.g. "RA", "DEC", "GLON", "GLAT",
1281 * etc. extracted from 'RA--', 'DEC-', 'GLON', 'GLAT', etc. in the first
1282 * four characters of CTYPEia but with trailing dashes removed. (Declared
1283 * as char[8] for alignment reasons.)
1284 *
1285 * int lng
1286 * (Returned) Index for the longitude coordinate, and ...
1287 * int lat
1288 * (Returned) ... index for the latitude coordinate, and ...
1289 * int spec
1290 * (Returned) ... index for the spectral coordinate in the imgcrd[][] and
1291 * world[][] arrays in the API of wcsp2s(), wcss2p() and wcsmix().
1292 *
1293 * These may also serve as indices into the pixcrd[][] array provided that
1294 * the PCi_ja matrix does not transpose axes.
1295 *
1296 * int cubeface
1297 * (Returned) Index into the pixcrd[][] array for the CUBEFACE axis. This
1298 * is used for quadcube projections where the cube faces are stored on a
1299 * separate axis (see wcs.h).
1300 *
1301 * int *types
1302 * (Returned) Address of the first element of an array of int containing a
1303 * four-digit type code for each axis.
1304 *
1305 * - First digit (i.e. 1000s):
1306 * - 0: Non-specific coordinate type.
1307 * - 1: Stokes coordinate.
1308 * - 2: Celestial coordinate (including CUBEFACE).
1309 * - 3: Spectral coordinate.
1310 *
1311 * - Second digit (i.e. 100s):
1312 * - 0: Linear axis.
1313 * - 1: Quantized axis (STOKES, CUBEFACE).
1314 * - 2: Non-linear celestial axis.
1315 * - 3: Non-linear spectral axis.
1316 * - 4: Logarithmic axis.
1317 * - 5: Tabular axis.
1318 *
1319 * - Third digit (i.e. 10s):
1320 * - 0: Group number, e.g. lookup table number, being an index into the
1321 * tabprm array (see above).
1322 *
1323 * - The fourth digit is used as a qualifier depending on the axis type.
1324 *
1325 * - For celestial axes:
1326 * - 0: Longitude coordinate.
1327 * - 1: Latitude coordinate.
1328 * - 2: CUBEFACE number.
1329 *
1330 * - For lookup tables: the axis number in a multidimensional table.
1331 *
1332 * CTYPEia in "4-3" form with unrecognized algorithm code will have its
1333 * type set to -1 and generate an error.
1334 *
1335 * void *padding
1336 * (An unused variable inserted for alignment purposes only.)
1337 *
1338 * struct linprm lin
1339 * (Returned) Linear transformation parameters (usage is described in the
1340 * prologue to lin.h).
1341 *
1342 * struct celprm cel
1343 * (Returned) Celestial transformation parameters (usage is described in
1344 * the prologue to cel.h).
1345 *
1346 * struct spcprm spc
1347 * (Returned) Spectral transformation parameters (usage is described in the
1348 * prologue to spc.h).
1349 *
1350 * struct wcserr *err
1351 * (Returned) If enabled, when an error status is returned, this struct
1352 * contains detailed information about the error, see wcserr_enable().
1353 *
1354 * void *m_padding
1355 * (For internal use only.)
1356 * int m_flag
1357 * (For internal use only.)
1358 * int m_naxis
1359 * (For internal use only.)
1360 * double *m_crpix
1361 * (For internal use only.)
1362 * double *m_pc
1363 * (For internal use only.)
1364 * double *m_cdelt
1365 * (For internal use only.)
1366 * double *m_crval
1367 * (For internal use only.)
1368 * char (*m_cunit)[72]
1369 * (For internal use only.)
1370 * char (*m_ctype)[72]
1371 * (For internal use only.)
1372 * struct pvcard *m_pv
1373 * (For internal use only.)
1374 * struct pscard *m_ps
1375 * (For internal use only.)
1376 * double *m_cd
1377 * (For internal use only.)
1378 * double *m_crota
1379 * (For internal use only.)
1380 * int *m_colax
1381 * (For internal use only.)
1382 * char (*m_cname)[72]
1383 * (For internal use only.)
1384 * double *m_crder
1385 * (For internal use only.)
1386 * double *m_csyer
1387 * (For internal use only.)
1388 * struct tabprm *m_tab
1389 * (For internal use only.)
1390 * struct wtbarr *m_wtb
1391 * (For internal use only.)
1392 *
1393 *
1394 * pvcard struct - Store for PVi_ma keyrecords
1395 * -------------------------------------------
1396 * The pvcard struct is used to pass the parsed contents of PVi_ma keyrecords
1397 * to wcsset() via the wcsprm struct.
1398 *
1399 * All members of this struct are to be set by the user.
1400 *
1401 * int i
1402 * (Given) Axis number (1-relative), as in the FITS PVi_ma keyword. If
1403 * i == 0, wcsset() will replace it with the latitude axis number.
1404 *
1405 * int m
1406 * (Given) Parameter number (non-negative), as in the FITS PVi_ma keyword.
1407 *
1408 * double value
1409 * (Given) Parameter value.
1410 *
1411 *
1412 * pscard struct - Store for PSi_ma keyrecords
1413 * -------------------------------------------
1414 * The pscard struct is used to pass the parsed contents of PSi_ma keyrecords
1415 * to wcsset() via the wcsprm struct.
1416 *
1417 * All members of this struct are to be set by the user.
1418 *
1419 * int i
1420 * (Given) Axis number (1-relative), as in the FITS PSi_ma keyword.
1421 *
1422 * int m
1423 * (Given) Parameter number (non-negative), as in the FITS PSi_ma keyword.
1424 *
1425 * char value[72]
1426 * (Given) Parameter value.
1427 *
1428 *
1429 * wtbarr struct - Extraction of coordinate lookup tables from BINTABLE
1430 * --------------------------------------------------------------------
1431 * Function wcstab(), which is invoked automatically by wcspih(), sets up an
1432 * array of wtbarr structs to assist in extracting coordinate lookup tables
1433 * from a binary table extension (BINTABLE) and copying them into the tabprm
1434 * structs stored in wcsprm. Refer to the usage notes for wcspih() and
1435 * wcstab() in wcshdr.h, and also the prologue to tab.h.
1436 *
1437 * For C++ usage, because of a name space conflict with the wtbarr typedef
1438 * defined in CFITSIO header fitsio.h, the wtbarr struct is renamed to wtbarr_s
1439 * by preprocessor macro substitution with scope limited to wcs.h itself.
1440 *
1441 * int i
1442 * (Given) Image axis number.
1443 *
1444 * int m
1445 * (Given) wcstab array axis number for index vectors.
1446 *
1447 * int kind
1448 * (Given) Character identifying the wcstab array type:
1449 * - c: coordinate array,
1450 * - i: index vector.
1451 *
1452 * char extnam[72]
1453 * (Given) EXTNAME identifying the binary table extension.
1454 *
1455 * int extver
1456 * (Given) EXTVER identifying the binary table extension.
1457 *
1458 * int extlev
1459 * (Given) EXTLEV identifying the binary table extension.
1460 *
1461 * char ttype[72]
1462 * (Given) TTYPEn identifying the column of the binary table that contains
1463 * the wcstab array.
1464 *
1465 * long row
1466 * (Given) Table row number.
1467 *
1468 * int ndim
1469 * (Given) Expected dimensionality of the wcstab array.
1470 *
1471 * int *dimlen
1472 * (Given) Address of the first element of an array of int of length ndim
1473 * into which the wcstab array axis lengths are to be written.
1474 *
1475 * double **arrayp
1476 * (Given) Pointer to an array of double which is to be allocated by the
1477 * user and into which the wcstab array is to be written.
1478 *
1479 *
1480 * Global variable: const char *wcs_errmsg[] - Status return messages
1481 * ------------------------------------------------------------------
1482 * Error messages to match the status value returned from each function.
1483 *
1484 *===========================================================================*/
1485 
1486 #ifndef WCSLIB_WCS
1487 #define WCSLIB_WCS
1488 
1489 #include "lin.h"
1490 #include "cel.h"
1491 #include "spc.h"
1492 
1493 #ifdef __cplusplus
1494 extern "C" {
1495 #endif
1496 
1497 #define WCSSUB_LONGITUDE 0x1001
1498 #define WCSSUB_LATITUDE 0x1002
1499 #define WCSSUB_CUBEFACE 0x1004
1500 #define WCSSUB_CELESTIAL 0x1007
1501 #define WCSSUB_SPECTRAL 0x1008
1502 #define WCSSUB_STOKES 0x1010
1503 
1504 
1505 #define WCSCOMPARE_ANCILLARY 0x0001
1506 #define WCSCOMPARE_TILING 0x0002
1507 #define WCSCOMPARE_CRPIX 0x0004
1508 
1509 
1510 extern const char *wcs_errmsg[];
1511 
1513  WCSERR_SUCCESS = 0, /* Success. */
1514  WCSERR_NULL_POINTER = 1, /* Null wcsprm pointer passed. */
1515  WCSERR_MEMORY = 2, /* Memory allocation failed. */
1516  WCSERR_SINGULAR_MTX = 3, /* Linear transformation matrix is
1517  singular. */
1518  WCSERR_BAD_CTYPE = 4, /* Inconsistent or unrecognized coordinate
1519  axis type. */
1520  WCSERR_BAD_PARAM = 5, /* Invalid parameter value. */
1521  WCSERR_BAD_COORD_TRANS = 6, /* Unrecognized coordinate transformation
1522  parameter. */
1523  WCSERR_ILL_COORD_TRANS = 7, /* Ill-conditioned coordinate transformation
1524  parameter. */
1525  WCSERR_BAD_PIX = 8, /* One or more of the pixel coordinates were
1526  invalid. */
1527  WCSERR_BAD_WORLD = 9, /* One or more of the world coordinates were
1528  invalid. */
1529  WCSERR_BAD_WORLD_COORD = 10, /* Invalid world coordinate. */
1530  WCSERR_NO_SOLUTION = 11, /* No solution found in the specified
1531  interval. */
1532  WCSERR_BAD_SUBIMAGE = 12, /* Invalid subimage specification. */
1533  WCSERR_NON_SEPARABLE = 13 /* Non-separable subimage coordinate
1534  system. */
1535 };
1536 
1537 
1538 /* Struct used for storing PVi_ma keywords. */
1539 struct pvcard {
1540  int i; /* Axis number, as in PVi_ma (1-relative). */
1541  int m; /* Parameter number, ditto (0-relative). */
1542  double value; /* Parameter value. */
1543 };
1544 
1545 /* Size of the pvcard struct in int units, used by the Fortran wrappers. */
1546 #define PVLEN (sizeof(struct pvcard)/sizeof(int))
1547 
1548 /* Struct used for storing PSi_ma keywords. */
1549 struct pscard {
1550  int i; /* Axis number, as in PSi_ma (1-relative). */
1551  int m; /* Parameter number, ditto (0-relative). */
1552  char value[72]; /* Parameter value. */
1553 };
1554 
1555 /* Size of the pscard struct in int units, used by the Fortran wrappers. */
1556 #define PSLEN (sizeof(struct pscard)/sizeof(int))
1557 
1558  /* For extracting wcstab arrays. Matches */
1559  /* the wtbarr typedef defined in CFITSIO */
1560  /* header fitsio.h. */
1561 #ifdef __cplusplus
1562 #define wtbarr wtbarr_s /* See prologue above. */
1563 #endif
1564 struct wtbarr {
1565  int i; /* Image axis number. */
1566  int m; /* Array axis number for index vectors. */
1567  int kind; /* wcstab array type. */
1568  char extnam[72]; /* EXTNAME of binary table extension. */
1569  int extver; /* EXTVER of binary table extension. */
1570  int extlev; /* EXTLEV of binary table extension. */
1571  char ttype[72]; /* TTYPEn of column containing the array. */
1572  long row; /* Table row number. */
1573  int ndim; /* Expected wcstab array dimensionality. */
1574  int *dimlen; /* Where to write the array axis lengths. */
1575  double **arrayp; /* Where to write the address of the array */
1576  /* allocated to store the wcstab array. */
1577 };
1578 
1579 
1580 struct wcsprm {
1581  /* Initialization flag (see the prologue above). */
1582  /*------------------------------------------------------------------------*/
1583  int flag; /* Set to zero to force initialization. */
1584 
1585  /* FITS header keyvalues to be provided (see the prologue above). */
1586  /*------------------------------------------------------------------------*/
1587  int naxis; /* Number of axes (pixel and coordinate). */
1588  double *crpix; /* CRPIXja keyvalues for each pixel axis. */
1589  double *pc; /* PCi_ja linear transformation matrix. */
1590  double *cdelt; /* CDELTia keyvalues for each coord axis. */
1591  double *crval; /* CRVALia keyvalues for each coord axis. */
1592 
1593  char (*cunit)[72]; /* CUNITia keyvalues for each coord axis. */
1594  char (*ctype)[72]; /* CTYPEia keyvalues for each coord axis. */
1595 
1596  double lonpole; /* LONPOLEa keyvalue. */
1597  double latpole; /* LATPOLEa keyvalue. */
1598 
1599  double restfrq; /* RESTFRQa keyvalue. */
1600  double restwav; /* RESTWAVa keyvalue. */
1601 
1602  int npv; /* Number of PVi_ma keywords, and the */
1603  int npvmax; /* number for which space was allocated. */
1604  struct pvcard *pv; /* PVi_ma keywords for each i and m. */
1605 
1606  int nps; /* Number of PSi_ma keywords, and the */
1607  int npsmax; /* number for which space was allocated. */
1608  struct pscard *ps; /* PSi_ma keywords for each i and m. */
1609 
1610  /* Alternative header keyvalues (see the prologue above). */
1611  /*------------------------------------------------------------------------*/
1612  double *cd; /* CDi_ja linear transformation matrix. */
1613  double *crota; /* CROTAia keyvalues for each coord axis. */
1614  int altlin; /* Alternative representations */
1615  /* Bit 0: PCi_ja is present, */
1616  /* Bit 1: CDi_ja is present, */
1617  /* Bit 2: CROTAia is present. */
1618  int velref; /* AIPS velocity code, VELREF. */
1619 
1620  /* Auxiliary coordinate system information, not used by WCSLIB. */
1621  char alt[4];
1622  int colnum;
1623  int *colax;
1624 
1625  char (*cname)[72];
1626  double *crder;
1627  double *csyer;
1628  char dateavg[72];
1629  char dateobs[72];
1630  double equinox;
1631  double mjdavg;
1632  double mjdobs;
1633  double obsgeo[3];
1634  char radesys[72];
1635  char specsys[72];
1636  char ssysobs[72];
1637  double velosys;
1638  double zsource;
1639  char ssyssrc[72];
1640  double velangl;
1641  char wcsname[72];
1642 
1643  /* Coordinate lookup tables (see the prologue above). */
1644  /*------------------------------------------------------------------------*/
1645  int ntab; /* Number of separate tables. */
1646  int nwtb; /* Number of wtbarr structs. */
1647  struct tabprm *tab; /* Tabular transformation parameters. */
1648  struct wtbarr *wtb; /* Array of wtbarr structs. */
1649 
1650  /* Information derived from the FITS header keyvalues by wcsset(). */
1651  /*------------------------------------------------------------------------*/
1652  char lngtyp[8], lattyp[8]; /* Celestial axis types, e.g. RA, DEC. */
1653  int lng, lat, spec; /* Longitude, latitude and spectral axis */
1654  /* indices (0-relative). */
1655  int cubeface; /* True if there is a CUBEFACE axis. */
1656  int *types; /* Coordinate type codes for each axis. */
1657  void *padding; /* (Dummy inserted for alignment purposes.) */
1658 
1659  struct linprm lin; /* Linear transformation parameters. */
1660  struct celprm cel; /* Celestial transformation parameters. */
1661  struct spcprm spc; /* Spectral transformation parameters. */
1662 
1663  /* Error handling, if enabled. */
1664  /*------------------------------------------------------------------------*/
1665  struct wcserr *err;
1666 
1667  /* Private - the remainder are for memory management. */
1668  /*------------------------------------------------------------------------*/
1669  void *m_padding;
1671  double *m_crpix, *m_pc, *m_cdelt, *m_crval;
1672  char (*m_cunit)[72], (*m_ctype)[72];
1673  struct pvcard *m_pv;
1674  struct pscard *m_ps;
1675  double *m_cd, *m_crota;
1676  int *m_colax;
1677  char (*m_cname)[72];
1678  double *m_crder, *m_csyer;
1679  struct tabprm *m_tab;
1680  struct wtbarr *m_wtb;
1681 };
1682 
1683 /* Size of the wcsprm struct in int units, used by the Fortran wrappers. */
1684 #define WCSLEN (sizeof(struct wcsprm)/sizeof(int))
1685 
1686 
1687 int wcsnpv(int n);
1688 
1689 int wcsnps(int n);
1690 
1691 int wcsini(int alloc, int naxis, struct wcsprm *wcs);
1692 
1693 int wcssub(int alloc, const struct wcsprm *wcssrc, int *nsub, int axes[],
1694  struct wcsprm *wcsdst);
1695 
1696 int wcscompare(int cmp, double tol, const struct wcsprm *wcs1,
1697  const struct wcsprm *wcs2, int *equal);
1698 
1699 int wcsfree(struct wcsprm *wcs);
1700 
1701 int wcsprt(const struct wcsprm *wcs);
1702 
1703 int wcsperr(const struct wcsprm *wcs, const char *prefix);
1704 
1705 int wcsbchk(struct wcsprm *wcs, int bounds);
1706 
1707 int wcsset(struct wcsprm *wcs);
1708 
1709 int wcsp2s(struct wcsprm *wcs, int ncoord, int nelem, const double pixcrd[],
1710  double imgcrd[], double phi[], double theta[], double world[],
1711  int stat[]);
1712 
1713 int wcss2p(struct wcsprm *wcs, int ncoord, int nelem, const double world[],
1714  double phi[], double theta[], double imgcrd[], double pixcrd[],
1715  int stat[]);
1716 
1717 int wcsmix(struct wcsprm *wcs, int mixpix, int mixcel, const double vspan[],
1718  double vstep, int viter, double world[], double phi[],
1719  double theta[], double imgcrd[], double pixcrd[]);
1720 
1721 int wcssptr(struct wcsprm *wcs, int *i, char ctype[9]);
1722 
1723 const char* wcslib_version(int vers[3]);
1724 
1725 /* Defined mainly for backwards compatibility, use wcssub() instead. */
1726 #define wcscopy(alloc, wcssrc, wcsdst) wcssub(alloc, wcssrc, 0x0, 0x0, wcsdst)
1727 
1728 
1729 /* Deprecated. */
1730 #define wcsini_errmsg wcs_errmsg
1731 #define wcssub_errmsg wcs_errmsg
1732 #define wcscopy_errmsg wcs_errmsg
1733 #define wcsfree_errmsg wcs_errmsg
1734 #define wcsprt_errmsg wcs_errmsg
1735 #define wcsset_errmsg wcs_errmsg
1736 #define wcsp2s_errmsg wcs_errmsg
1737 #define wcss2p_errmsg wcs_errmsg
1738 #define wcsmix_errmsg wcs_errmsg
1739 
1740 #ifdef __cplusplus
1741 #undef wtbarr
1742 }
1743 #endif
1744 
1745 #endif /* WCSLIB_WCS */
Definition: wcs.h:1525
char dateobs[72]
Definition: wcs.h:1629
int wcsfree(struct wcsprm *wcs)
Destructor for the wcsprm struct.
char radesys[72]
Definition: wcs.h:1634
struct wtbarr * m_wtb
Definition: wcs.h:1680
Definition: wcs.h:1515
int wcssub(int alloc, const struct wcsprm *wcssrc, int *nsub, int axes[], struct wcsprm *wcsdst)
Subimage extraction routine for the wcsprm struct.
int kind
Definition: getwcstab.h:173
double * m_crval
Definition: wcs.h:1671
Definition: wcs.h:1533
double * cd
Definition: wcs.h:1612
int * m_colax
Definition: wcs.h:1676
struct pscard * ps
Definition: wcs.h:1608
double * cdelt
Definition: wcs.h:1590
int i
Definition: wcs.h:1540
int npv
Definition: wcs.h:1602
struct tabprm * tab
Definition: wcs.h:1647
char ttype[72]
Definition: getwcstab.h:177
struct wcserr * err
Definition: wcs.h:1665
int lng
Definition: wcs.h:1653
char(* m_cunit)[72]
Definition: wcs.h:1672
int npsmax
Definition: wcs.h:1607
char alt[4]
Definition: wcs.h:1621
char(* m_cname)[72]
Definition: wcs.h:1677
Error message handling.
Definition: wcserr.h:225
int i
Definition: getwcstab.h:171
struct spcprm spc
Definition: wcs.h:1661
int cubeface
Definition: wcs.h:1655
int flag
Definition: wcs.h:1583
double equinox
Definition: wcs.h:1630
int wcss2p(struct wcsprm *wcs, int ncoord, int nelem, const double world[], double phi[], double theta[], double imgcrd[], double pixcrd[], int stat[])
World-to-pixel transformation.
int m
Definition: wcs.h:1541
int wcsbchk(struct wcsprm *wcs, int bounds)
Enable/disable bounds checking.
double obsgeo[3]
Definition: wcs.h:1633
Definition: wcs.h:1532
double lonpole
Definition: wcs.h:1596
int nps
Definition: wcs.h:1606
struct pvcard * pv
Definition: wcs.h:1604
int m
Definition: getwcstab.h:172
Definition: wcs.h:1516
Definition: wcs.h:1513
Spectral transformation parameters.
Definition: spc.h:773
Definition: wcs.h:1520
struct tabprm * m_tab
Definition: wcs.h:1679
Celestial transformation parameters.
Definition: cel.h:392
Linear transformation parameters.
Definition: lin.h:599
wcs_errmsg_enum
Definition: wcs.h:1512
struct pscard * m_ps
Definition: wcs.h:1674
int wcsprt(const struct wcsprm *wcs)
Print routine for the wcsprm struct.
Definition: wcs.h:1514
char(* cunit)[72]
Definition: wcs.h:1593
int ntab
Definition: wcs.h:1645
double * crota
Definition: wcs.h:1613
int wcscompare(int cmp, double tol, const struct wcsprm *wcs1, const struct wcsprm *wcs2, int *equal)
Compare two wcsprm structs for equality.
int m_naxis
Definition: wcs.h:1670
double * m_cd
Definition: wcs.h:1675
long row
Definition: getwcstab.h:178
double restfrq
Definition: wcs.h:1599
char specsys[72]
Definition: wcs.h:1635
int * types
Definition: wcs.h:1656
int wcssptr(struct wcsprm *wcs, int *i, char ctype[9])
Spectral axis translation.
char value[72]
Definition: wcs.h:1552
int nwtb
Definition: wcs.h:1646
char dateavg[72]
Definition: wcs.h:1628
char ssysobs[72]
Definition: wcs.h:1636
char(* cname)[72]
Definition: wcs.h:1625
double ** arrayp
Definition: getwcstab.h:181
int wcsset(struct wcsprm *wcs)
Setup routine for the wcsprm struct.
Coordinate transformation parameters.
Definition: wcs.h:1580
int colnum
Definition: wcs.h:1622
Definition: wcs.h:1521
double * m_pc
Definition: wcs.h:1671
int wcsp2s(struct wcsprm *wcs, int ncoord, int nelem, const double pixcrd[], double imgcrd[], double phi[], double theta[], double world[], int stat[])
Pixel-to-world transformation.
double velangl
Definition: wcs.h:1640
struct wtbarr * wtb
Definition: wcs.h:1648
double * crder
Definition: wcs.h:1626
double restwav
Definition: wcs.h:1600
double * m_crder
Definition: wcs.h:1678
char lngtyp[8]
Definition: wcs.h:1652
int wcsnpv(int n)
Memory allocation for PVi_ma.
int naxis
Definition: wcs.h:1587
int m
Definition: wcs.h:1551
int wcsmix(struct wcsprm *wcs, int mixpix, int mixcel, const double vspan[], double vstep, int viter, double world[], double phi[], double theta[], double imgcrd[], double pixcrd[])
Hybrid coordinate transformation.
int spec
Definition: wcs.h:1653
const char * wcs_errmsg[]
Status return messages.
Definition: wcs.h:1529
Extraction of coordinate lookup tables from BINTABLE.
Definition: getwcstab.h:170
int wcsperr(const struct wcsprm *wcs, const char *prefix)
Print error messages from a wcsprm struct.
double latpole
Definition: wcs.h:1597
double * m_crpix
Definition: wcs.h:1671
double velosys
Definition: wcs.h:1637
double * m_csyer
Definition: wcs.h:1678
Definition: wcs.h:1523
Tabular transformation parameters.
Definition: tab.h:525
int velref
Definition: wcs.h:1618
int i
Definition: wcs.h:1550
const char * wcslib_version(int vers[3])
double * csyer
Definition: wcs.h:1627
void * m_padding
Definition: wcs.h:1669
int lat
Definition: wcs.h:1653
Store for PVi_ma keyrecords.
Definition: wcs.h:1539
Definition: wcs.h:1518
double * crpix
Definition: wcs.h:1588
double mjdavg
Definition: wcs.h:1631
struct celprm cel
Definition: wcs.h:1660
int wcsini(int alloc, int naxis, struct wcsprm *wcs)
Default constructor for the wcsprm struct.
char extnam[72]
Definition: getwcstab.h:174
double * m_cdelt
Definition: wcs.h:1671
int npvmax
Definition: wcs.h:1603
double value
Definition: wcs.h:1542
Store for PSi_ma keyrecords.
Definition: wcs.h:1549
int ndim
Definition: getwcstab.h:179
double * crval
Definition: wcs.h:1591
int * colax
Definition: wcs.h:1623
int altlin
Definition: wcs.h:1614
struct linprm lin
Definition: wcs.h:1659
char(* ctype)[72]
Definition: wcs.h:1594
double * pc
Definition: wcs.h:1589
double mjdobs
Definition: wcs.h:1632
int extver
Definition: getwcstab.h:175
double * m_crota
Definition: wcs.h:1675
Definition: wcs.h:1530
int * dimlen
Definition: getwcstab.h:180
char ssyssrc[72]
Definition: wcs.h:1639
char lattyp[8]
Definition: wcs.h:1652
Definition: wcs.h:1527
struct pvcard * m_pv
Definition: wcs.h:1673
int m_flag
Definition: wcs.h:1670
int extlev
Definition: getwcstab.h:176
double zsource
Definition: wcs.h:1638
void * padding
Definition: wcs.h:1657
char wcsname[72]
Definition: wcs.h:1641
int wcsnps(int n)
Memory allocation for PSi_ma.