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