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