WCSLIB  4.25.1
wcs.h
Go to the documentation of this file.
1 /*============================================================================
2 
3  WCSLIB 5.1 - 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.1 2015/04/07 10:56:36 mcalabre Exp $
26 *=============================================================================
27 *
28 * WCSLIB 5.1 - 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 * Three routines, wcsini(), wcssub(), and wcsfree() are provided to manage the
56 * wcsprm struct and another, wcsprt(), to 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 * wcsini() - Default constructor for the wcsprm struct
113 * ----------------------------------------------------
114 * wcsini() optionally allocates memory for arrays in a wcsprm struct and sets
115 * all members of the struct to default values. Memory is allocated for up to
116 * NPVMAX PVi_ma keywords or NPSMAX PSi_ma keywords per WCS representation.
117 * These may be changed via wcsnpv() and wcsnps() before wcsini() is called.
118 *
119 * PLEASE NOTE: every wcsprm struct should be initialized by wcsini(), possibly
120 * repeatedly. On the first invokation, and only the first invokation,
121 * wcsprm::flag must be set to -1 to initialize memory management, regardless
122 * of whether wcsini() will actually be used to allocate memory.
123 *
124 * Given:
125 * alloc int If true, allocate memory unconditionally for the
126 * crpix, etc. arrays.
127 *
128 * If false, it is assumed that pointers to these arrays
129 * have been set by the user except if they are null
130 * pointers in which case memory will be allocated for
131 * them regardless. (In other words, setting alloc true
132 * saves having to initalize these pointers to zero.)
133 *
134 * naxis int The number of world coordinate axes. This is used to
135 * determine the length of the various wcsprm vectors and
136 * matrices and therefore the amount of memory to
137 * allocate for them.
138 *
139 * Given and returned:
140 * wcs struct wcsprm*
141 * Coordinate transformation parameters.
142 *
143 * Note that, in order to initialize memory management,
144 * wcsprm::flag should be set to -1 when wcs is
145 * initialized for the first time (memory leaks may
146 * result if it had already been initialized).
147 *
148 * Function return value:
149 * int Status return value:
150 * 0: Success.
151 * 1: Null wcsprm pointer passed.
152 * 2: Memory allocation failed.
153 *
154 * For returns > 1, a detailed error message is set in
155 * wcsprm::err if enabled, see wcserr_enable().
156 *
157 *
158 * wcsnpv() - Memory allocation for PVi_ma
159 * ---------------------------------------
160 * wcsnpv() changes the value of NPVMAX (default 64). This global variable
161 * controls the number of PVi_ma keywords that wcsini() should allocate space
162 * for.
163 *
164 * PLEASE NOTE: This function is not thread-safe.
165 *
166 * Given:
167 * n int Value of NPVMAX; ignored if < 0.
168 *
169 * Function return value:
170 * int Current value of NPVMAX.
171 *
172 *
173 * wcsnps() - Memory allocation for PSi_ma
174 * ---------------------------------------
175 * wcsnps() changes the values of NPSMAX (default 8). This global variable
176 * controls the number of PSi_ma keywords that wcsini() should allocate space
177 * for.
178 *
179 * PLEASE NOTE: This function is not thread-safe.
180 *
181 * Given:
182 * n int Value of NPSMAX; ignored if < 0.
183 *
184 * Function return value:
185 * int Current value of NPSMAX.
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 * Some of the former are not actually required for transforming coordinates.
806 * These are described as "auxiliary"; the struct simply provides a place to
807 * store them, though they may be used by wcshdo() in constructing a FITS
808 * header from a wcsprm struct. Some of the returned values are supplied for
809 * informational purposes and others are for internal use only as indicated.
810 *
811 * In practice, it is expected that a WCS parser would scan the FITS header to
812 * determine the number of coordinate axes. It would then use wcsini() to
813 * allocate memory for arrays in the wcsprm struct and set default values.
814 * Then as it reread the header and identified each WCS keyrecord it would load
815 * the value into the relevant wcsprm array element. This is essentially what
816 * wcspih() does - refer to the prologue of wcshdr.h. As the final step,
817 * wcsset() is invoked, either directly or indirectly, to set the derived
818 * members of the wcsprm struct. wcsset() strips off trailing blanks in all
819 * string members and null-fills the character array.
820 *
821 * int flag
822 * (Given and returned) This flag must be set to zero whenever any of the
823 * following wcsprm struct members are set or changed:
824 *
825 * - wcsprm::naxis (q.v., not normally set by the user),
826 * - wcsprm::crpix,
827 * - wcsprm::pc,
828 * - wcsprm::cdelt,
829 * - wcsprm::crval,
830 * - wcsprm::cunit,
831 * - wcsprm::ctype,
832 * - wcsprm::lonpole,
833 * - wcsprm::latpole,
834 * - wcsprm::restfrq,
835 * - wcsprm::restwav,
836 * - wcsprm::npv,
837 * - wcsprm::pv,
838 * - wcsprm::nps,
839 * - wcsprm::ps,
840 * - wcsprm::cd,
841 * - wcsprm::crota,
842 * - wcsprm::altlin,
843 * - wcsprm::ntab,
844 * - wcsprm::nwtb,
845 * - wcsprm::tab,
846 * - wcsprm::wtb.
847 *
848 * This signals the initialization routine, wcsset(), to recompute the
849 * returned members of the celprm struct. celset() will reset flag to
850 * indicate that this has been done.
851 *
852 * PLEASE NOTE: flag should be set to -1 when wcsini() is called for the
853 * first time for a particular wcsprm struct in order to initialize memory
854 * management. It must ONLY be used on the first initialization otherwise
855 * memory leaks may result.
856 *
857 * int naxis
858 * (Given or returned) Number of pixel and world coordinate elements.
859 *
860 * If wcsini() is used to initialize the linprm struct (as would normally
861 * be the case) then it will set naxis from the value passed to it as a
862 * function argument. The user should not subsequently modify it.
863 *
864 * double *crpix
865 * (Given) Address of the first element of an array of double containing
866 * the coordinate reference pixel, CRPIXja.
867 *
868 * double *pc
869 * (Given) Address of the first element of the PCi_ja (pixel coordinate)
870 * transformation matrix. The expected order is
871 *
872 = struct wcsprm wcs;
873 = wcs.pc = {PC1_1, PC1_2, PC2_1, PC2_2};
874 *
875 * This may be constructed conveniently from a 2-D array via
876 *
877 = double m[2][2] = {{PC1_1, PC1_2},
878 = {PC2_1, PC2_2}};
879 *
880 * which is equivalent to
881 *
882 = double m[2][2];
883 = m[0][0] = PC1_1;
884 = m[0][1] = PC1_2;
885 = m[1][0] = PC2_1;
886 = m[1][1] = PC2_2;
887 *
888 * The storage order for this 2-D array is the same as for the 1-D array,
889 * whence
890 *
891 = wcs.pc = *m;
892 *
893 * would be legitimate.
894 *
895 * double *cdelt
896 * (Given) Address of the first element of an array of double containing
897 * the coordinate increments, CDELTia.
898 *
899 * double *crval
900 * (Given) Address of the first element of an array of double containing
901 * the coordinate reference values, CRVALia.
902 *
903 * char (*cunit)[72]
904 * (Given) Address of the first element of an array of char[72] containing
905 * the CUNITia keyvalues which define the units of measurement of the
906 * CRVALia, CDELTia, and CDi_ja keywords.
907 *
908 * As CUNITia is an optional header keyword, cunit[][72] may be left blank
909 * but otherwise is expected to contain a standard units specification as
910 * defined by WCS Paper I. Utility function wcsutrn(), described in
911 * wcsunits.h, is available to translate commonly used non-standard units
912 * specifications but this must be done as a separate step before invoking
913 * wcsset().
914 *
915 * For celestial axes, if cunit[][72] is not blank, wcsset() uses
916 * wcsunits() to parse it and scale cdelt[], crval[], and cd[][*] to
917 * degrees. It then resets cunit[][72] to "deg".
918 *
919 * For spectral axes, if cunit[][72] is not blank, wcsset() uses wcsunits()
920 * to parse it and scale cdelt[], crval[], and cd[][*] to SI units. It
921 * then resets cunit[][72] accordingly.
922 *
923 * wcsset() ignores cunit[][72] for other coordinate types; cunit[][72] may
924 * be used to label coordinate values.
925 *
926 * These variables accomodate the longest allowed string-valued FITS
927 * keyword, being limited to 68 characters, plus the null-terminating
928 * character.
929 *
930 * char (*ctype)[72]
931 * (Given) Address of the first element of an array of char[72] containing
932 * the coordinate axis types, CTYPEia.
933 *
934 * The ctype[][72] keyword values must be in upper case and there must be
935 * zero or one pair of matched celestial axis types, and zero or one
936 * spectral axis. The ctype[][72] strings should be padded with blanks on
937 * the right and null-terminated so that they are at least eight characters
938 * in length.
939 *
940 * These variables accomodate the longest allowed string-valued FITS
941 * keyword, being limited to 68 characters, plus the null-terminating
942 * character.
943 *
944 * double lonpole
945 * (Given and returned) The native longitude of the celestial pole, phi_p,
946 * given by LONPOLEa [deg] or by PVi_2a [deg] attached to the longitude
947 * axis which takes precedence if defined, and ...
948 * double latpole
949 * (Given and returned) ... the native latitude of the celestial pole,
950 * theta_p, given by LATPOLEa [deg] or by PVi_3a [deg] attached to the
951 * longitude axis which takes precedence if defined.
952 *
953 * lonpole and latpole may be left to default to values set by wcsini()
954 * (see celprm::ref), but in any case they will be reset by wcsset() to
955 * the values actually used. Note therefore that if the wcsprm struct is
956 * reused without resetting them, whether directly or via wcsini(), they
957 * will no longer have their default values.
958 *
959 * double restfrq
960 * (Given) The rest frequency [Hz], and/or ...
961 * double restwav
962 * (Given) ... the rest wavelength in vacuo [m], only one of which need be
963 * given, the other should be set to zero.
964 *
965 * int npv
966 * (Given) The number of entries in the wcsprm::pv[] array.
967 *
968 * int npvmax
969 * (Given or returned) The length of the wcsprm::pv[] array.
970 *
971 * npvmax will be set by wcsini() if it allocates memory for wcsprm::pv[],
972 * otherwise it must be set by the user. See also wcsnpv().
973 *
974 * struct pvcard *pv
975 * (Given or returned) Address of the first element of an array of length
976 * npvmax of pvcard structs. Set by wcsini() if it allocates memory for
977 * pv[], otherwise it must be set by the user. See also wcsnpv().
978 *
979 * As a FITS header parser encounters each PVi_ma keyword it should load it
980 * into a pvcard struct in the array and increment npv. wcsset()
981 * interprets these as required.
982 *
983 * Note that, if they were not given, wcsset() resets the entries for
984 * PVi_1a, PVi_2a, PVi_3a, and PVi_4a for longitude axis i to match
985 * phi_0 and theta_0 (the native longitude and latitude of the reference
986 * point), LONPOLEa and LATPOLEa respectively.
987 *
988 * int nps
989 * (Given) The number of entries in the wcsprm::ps[] array.
990 *
991 * int npsmax
992 * (Given or returned) The length of the wcsprm::ps[] array.
993 *
994 * npsmax will be set by wcsini() if it allocates memory for wcsprm::ps[],
995 * otherwise it must be set by the user. See also wcsnps().
996 *
997 * struct pscard *ps
998 * (Given or returned) Address of the first element of an array of length
999 * npsmax of pscard structs. Set by wcsini() if it allocates memory for
1000 * ps[], otherwise it must be set by the user. See also wcsnps().
1001 *
1002 * As a FITS header parser encounters each PSi_ma keyword it should load it
1003 * into a pscard struct in the array and increment nps. wcsset()
1004 * interprets these as required (currently no PSi_ma keyvalues are
1005 * recognized).
1006 *
1007 * double *cd
1008 * (Given) For historical compatibility, the wcsprm struct supports two
1009 * alternate specifications of the linear transformation matrix, those
1010 * associated with the CDi_ja keywords, and ...
1011 * double *crota
1012 * (Given) ... those associated with the CROTAia keywords. Although these
1013 * may not formally co-exist with PCi_ja, the approach taken here is simply
1014 * to ignore them if given in conjunction with PCi_ja.
1015 *
1016 * int altlin
1017 * (Given) altlin is a bit flag that denotes which of the PCi_ja, CDi_ja
1018 * and CROTAia keywords are present in the header:
1019 *
1020 * - Bit 0: PCi_ja is present.
1021 *
1022 * - Bit 1: CDi_ja is present.
1023 *
1024 * Matrix elements in the IRAF convention are
1025 * equivalent to the product CDi_ja = CDELTia * PCi_ja, but the
1026 * defaults differ from that of the PCi_ja matrix. If one or more
1027 * CDi_ja keywords are present then all unspecified CDi_ja default to
1028 * zero. If no CDi_ja (or CROTAia) keywords are present, then the
1029 * header is assumed to be in PCi_ja form whether or not any PCi_ja
1030 * keywords are present since this results in an interpretation of
1031 * CDELTia consistent with the original FITS specification.
1032 *
1033 * While CDi_ja may not formally co-exist with PCi_ja, it may co-exist
1034 * with CDELTia and CROTAia which are to be ignored.
1035 *
1036 * - Bit 2: CROTAia is present.
1037 *
1038 * In the AIPS convention, CROTAia may only be
1039 * associated with the latitude axis of a celestial axis pair. It
1040 * specifies a rotation in the image plane that is applied AFTER the
1041 * CDELTia; any other CROTAia keywords are ignored.
1042 *
1043 * CROTAia may not formally co-exist with PCi_ja.
1044 *
1045 * CROTAia and CDELTia may formally co-exist with CDi_ja but if so are to
1046 * be ignored.
1047 *
1048 * CDi_ja and CROTAia keywords, if found, are to be stored in the
1049 * wcsprm::cd and wcsprm::crota arrays which are dimensioned similarly to
1050 * wcsprm::pc and wcsprm::cdelt. FITS
1051 * header parsers should use the following procedure:
1052 *
1053 * - Whenever a PCi_ja keyword is encountered: altlin |= 1;
1054 *
1055 * - Whenever a CDi_ja keyword is encountered: altlin |= 2;
1056 *
1057 * - Whenever a CROTAia keyword is encountered: altlin |= 4;
1058 *
1059 * If none of these bits are set the PCi_ja representation results, i.e.
1060 * wcsprm::pc and wcsprm::cdelt will be used as given.
1061 *
1062 * These alternate specifications of the linear transformation matrix are
1063 * translated immediately to PCi_ja by wcsset() and are invisible to the
1064 * lower-level WCSLIB routines. In particular, wcsset() resets
1065 * wcsprm::cdelt to unity if CDi_ja is present (and no PCi_ja).
1066 *
1067 * If CROTAia are present but none is associated with the latitude axis
1068 * (and no PCi_ja or CDi_ja), then wcsset() reverts to a unity PCi_ja
1069 * matrix.
1070 *
1071 * int velref
1072 * (Given) AIPS velocity code VELREF, refer to spcaips().
1073 *
1074 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1075 * wcsprm::velref is changed.
1076 *
1077 * char alt[4]
1078 * (Given, auxiliary) Character code for alternate coordinate descriptions
1079 * (i.e. the 'a' in keyword names such as CTYPEia). This is blank for the
1080 * primary coordinate description, or one of the 26 upper-case letters,
1081 * A-Z.
1082 *
1083 * An array of four characters is provided for alignment purposes, only the
1084 * first is used.
1085 *
1086 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1087 * wcsprm::alt is changed.
1088 *
1089 * int colnum
1090 * (Given, auxiliary) Where the coordinate representation is associated
1091 * with an image-array column in a FITS binary table, this variable may be
1092 * used to record the relevant column number.
1093 *
1094 * It should be set to zero for an image header or pixel list.
1095 *
1096 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1097 * wcsprm::colnum is changed.
1098 *
1099 * int *colax
1100 * (Given, auxiliary) Address of the first element of an array of int
1101 * recording the column numbers for each axis in a pixel list.
1102 *
1103 * The array elements should be set to zero for an image header or image
1104 * array in a binary table.
1105 *
1106 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1107 * wcsprm::colax is changed.
1108 *
1109 * char (*cname)[72]
1110 * (Given, auxiliary) The address of the first element of an array of
1111 * char[72] containing the coordinate axis names, CNAMEia.
1112 *
1113 * These variables accomodate the longest allowed string-valued FITS
1114 * keyword, being limited to 68 characters, plus the null-terminating
1115 * character.
1116 *
1117 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1118 * wcsprm::cname is changed.
1119 *
1120 * double *crder
1121 * (Given, auxiliary) Address of the first element of an array of double
1122 * recording the random error in the coordinate value, CRDERia.
1123 *
1124 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1125 * wcsprm::crder is changed.
1126 *
1127 * double *csyer
1128 * (Given, auxiliary) Address of the first element of an array of double
1129 * recording the systematic error in the coordinate value, CSYERia.
1130 *
1131 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1132 * wcsprm::csyer is changed.
1133 *
1134 * char dateavg[72]
1135 * (Given, auxiliary) The date of a representative mid-point of the
1136 * observation in ISO format, yyyy-mm-ddThh:mm:ss.
1137 *
1138 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1139 * wcsprm::dateavg is changed.
1140 *
1141 * char dateobs[72]
1142 * (Given, auxiliary) The date of the start of the observation unless
1143 * otherwise explained in the comment field of the DATE-OBS keyword, in
1144 * ISO format, yyyy-mm-ddThh:mm:ss.
1145 *
1146 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1147 * wcsprm::dateobs is changed.
1148 *
1149 * double equinox
1150 * (Given, auxiliary) The equinox associated with dynamical equatorial or
1151 * ecliptic coordinate systems, EQUINOXa (or EPOCH in older headers). Not
1152 * applicable to ICRS equatorial or ecliptic coordinates.
1153 *
1154 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1155 * wcsprm::equinox is changed.
1156 *
1157 * double mjdavg
1158 * (Given, auxiliary) Modified Julian Date (MJD = JD - 2400000.5), MJD-AVG,
1159 * corresponding to DATE-AVG.
1160 *
1161 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1162 * wcsprm::mjdavg is changed.
1163 *
1164 * double mjdobs
1165 * (Given, auxiliary) Modified Julian Date (MJD = JD - 2400000.5), MJD-OBS,
1166 * corresponding to DATE-OBS.
1167 *
1168 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1169 * wcsprm::mjdobs is changed.
1170 *
1171 * double obsgeo[3]
1172 * (Given, auxiliary) Location of the observer in a standard terrestrial
1173 * reference frame, OBSGEO-X, OBSGEO-Y, OBSGEO-Z [m].
1174 *
1175 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1176 * wcsprm::obsgeo is changed.
1177 *
1178 * char radesys[72]
1179 * (Given, auxiliary) The equatorial or ecliptic coordinate system type,
1180 * RADESYSa.
1181 *
1182 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1183 * wcsprm::radesys is changed.
1184 *
1185 * char specsys[72]
1186 * (Given, auxiliary) Spectral reference frame (standard of rest),
1187 * SPECSYSa.
1188 *
1189 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1190 * wcsprm::specsys is changed.
1191 *
1192 * char ssysobs[72]
1193 * (Given, auxiliary) The spectral reference frame in which there is no
1194 * differential variation in the spectral coordinate across the
1195 * field-of-view, SSYSOBSa.
1196 *
1197 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1198 * wcsprm::ssysobs is changed.
1199 *
1200 * double velosys
1201 * (Given, auxiliary) The relative radial velocity [m/s] between the
1202 * observer and the selected standard of rest in the direction of the
1203 * celestial reference coordinate, VELOSYSa.
1204 *
1205 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1206 * wcsprm::velosys is changed.
1207 *
1208 * double zsource
1209 * (Given, auxiliary) The redshift, ZSOURCEa, of the source.
1210 *
1211 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1212 * wcsprm::zsource is changed.
1213 *
1214 * char ssyssrc[72]
1215 * (Given, auxiliary) The spectral reference frame (standard of rest),
1216 * SSYSSRCa, in which wcsprm::zsource was measured.
1217 *
1218 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1219 * wcsprm::ssyssrc is changed.
1220 *
1221 * double velangl
1222 * (Given, auxiliary) The angle [deg] that should be used to decompose an
1223 * observed velocity into radial and transverse components.
1224 *
1225 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1226 * wcsprm::velangl is changed.
1227 *
1228 * char wcsname[72]
1229 * (Given, auxiliary) The name given to the coordinate representation,
1230 * WCSNAMEa. This variable accomodates the longest allowed string-valued
1231 * FITS keyword, being limited to 68 characters, plus the null-terminating
1232 * character.
1233 *
1234 * It is not necessary to reset the wcsprm struct (via wcsset()) when
1235 * wcsprm::wcsname is changed.
1236 *
1237 * int ntab
1238 * (Given) See wcsprm::tab.
1239 *
1240 * int nwtb
1241 * (Given) See wcsprm::wtb.
1242 *
1243 * struct tabprm *tab
1244 * (Given) Address of the first element of an array of ntab tabprm structs
1245 * for which memory has been allocated. These are used to store tabular
1246 * transformation parameters.
1247 *
1248 * Although technically wcsprm::ntab and tab are "given", they will
1249 * normally be set by invoking wcstab(), whether directly or indirectly.
1250 *
1251 * The tabprm structs contain some members that must be supplied and others
1252 * that are derived. The information to be supplied comes primarily from
1253 * arrays stored in one or more FITS binary table extensions. These
1254 * arrays, referred to here as "wcstab arrays", are themselves located by
1255 * parameters stored in the FITS image header.
1256 *
1257 * struct wtbarr *wtb
1258 * (Given) Address of the first element of an array of nwtb wtbarr structs
1259 * for which memory has been allocated. These are used in extracting
1260 * wcstab arrays from a FITS binary table.
1261 *
1262 * Although technically wcsprm::nwtb and wtb are "given", they will
1263 * normally be set by invoking wcstab(), whether directly or indirectly.
1264 *
1265 * char lngtyp[8]
1266 * (Returned) Four-character WCS celestial longitude and ...
1267 * char lattyp[8]
1268 * (Returned) ... latitude axis types. e.g. "RA", "DEC", "GLON", "GLAT",
1269 * etc. extracted from 'RA--', 'DEC-', 'GLON', 'GLAT', etc. in the first
1270 * four characters of CTYPEia but with trailing dashes removed. (Declared
1271 * as char[8] for alignment reasons.)
1272 *
1273 * int lng
1274 * (Returned) Index for the longitude coordinate, and ...
1275 * int lat
1276 * (Returned) ... index for the latitude coordinate, and ...
1277 * int spec
1278 * (Returned) ... index for the spectral coordinate in the imgcrd[][] and
1279 * world[][] arrays in the API of wcsp2s(), wcss2p() and wcsmix().
1280 *
1281 * These may also serve as indices into the pixcrd[][] array provided that
1282 * the PCi_ja matrix does not transpose axes.
1283 *
1284 * int cubeface
1285 * (Returned) Index into the pixcrd[][] array for the CUBEFACE axis. This
1286 * is used for quadcube projections where the cube faces are stored on a
1287 * separate axis (see wcs.h).
1288 *
1289 * int *types
1290 * (Returned) Address of the first element of an array of int containing a
1291 * four-digit type code for each axis.
1292 *
1293 * - First digit (i.e. 1000s):
1294 * - 0: Non-specific coordinate type.
1295 * - 1: Stokes coordinate.
1296 * - 2: Celestial coordinate (including CUBEFACE).
1297 * - 3: Spectral coordinate.
1298 *
1299 * - Second digit (i.e. 100s):
1300 * - 0: Linear axis.
1301 * - 1: Quantized axis (STOKES, CUBEFACE).
1302 * - 2: Non-linear celestial axis.
1303 * - 3: Non-linear spectral axis.
1304 * - 4: Logarithmic axis.
1305 * - 5: Tabular axis.
1306 *
1307 * - Third digit (i.e. 10s):
1308 * - 0: Group number, e.g. lookup table number, being an index into the
1309 * tabprm array (see above).
1310 *
1311 * - The fourth digit is used as a qualifier depending on the axis type.
1312 *
1313 * - For celestial axes:
1314 * - 0: Longitude coordinate.
1315 * - 1: Latitude coordinate.
1316 * - 2: CUBEFACE number.
1317 *
1318 * - For lookup tables: the axis number in a multidimensional table.
1319 *
1320 * CTYPEia in "4-3" form with unrecognized algorithm code will have its
1321 * type set to -1 and generate an error.
1322 *
1323 * void *padding
1324 * (An unused variable inserted for alignment purposes only.)
1325 *
1326 * struct linprm lin
1327 * (Returned) Linear transformation parameters (usage is described in the
1328 * prologue to lin.h).
1329 *
1330 * struct celprm cel
1331 * (Returned) Celestial transformation parameters (usage is described in
1332 * the prologue to cel.h).
1333 *
1334 * struct spcprm spc
1335 * (Returned) Spectral transformation parameters (usage is described in the
1336 * prologue to spc.h).
1337 *
1338 * struct wcserr *err
1339 * (Returned) If enabled, when an error status is returned, this struct
1340 * contains detailed information about the error, see wcserr_enable().
1341 *
1342 * void *m_padding
1343 * (For internal use only.)
1344 * int m_flag
1345 * (For internal use only.)
1346 * int m_naxis
1347 * (For internal use only.)
1348 * double *m_crpix
1349 * (For internal use only.)
1350 * double *m_pc
1351 * (For internal use only.)
1352 * double *m_cdelt
1353 * (For internal use only.)
1354 * double *m_crval
1355 * (For internal use only.)
1356 * char (*m_cunit)[72]
1357 * (For internal use only.)
1358 * char (*m_ctype)[72]
1359 * (For internal use only.)
1360 * struct pvcard *m_pv
1361 * (For internal use only.)
1362 * struct pscard *m_ps
1363 * (For internal use only.)
1364 * double *m_cd
1365 * (For internal use only.)
1366 * double *m_crota
1367 * (For internal use only.)
1368 * int *m_colax
1369 * (For internal use only.)
1370 * char (*m_cname)[72]
1371 * (For internal use only.)
1372 * double *m_crder
1373 * (For internal use only.)
1374 * double *m_csyer
1375 * (For internal use only.)
1376 * struct tabprm *m_tab
1377 * (For internal use only.)
1378 * struct wtbarr *m_wtb
1379 * (For internal use only.)
1380 *
1381 *
1382 * pscard struct - Store for PSi_ma keyrecords
1383 * -------------------------------------------
1384 * The pscard struct is used to pass the parsed contents of PSi_ma keyrecords
1385 * to wcsset() via the wcsprm struct.
1386 *
1387 * All members of this struct are to be set by the user.
1388 *
1389 * int i
1390 * (Given) Axis number (1-relative), as in the FITS PSi_ma keyword.
1391 *
1392 * int m
1393 * (Given) Parameter number (non-negative), as in the FITS PSi_ma keyword.
1394 *
1395 * char value[72]
1396 * (Given) Parameter value.
1397 *
1398 *
1399 * pvcard struct - Store for PVi_ma keyrecords
1400 * -------------------------------------------
1401 * The pvcard struct is used to pass the parsed contents of PVi_ma keyrecords
1402 * to wcsset() via the wcsprm struct.
1403 *
1404 * All members of this struct are to be set by the user.
1405 *
1406 * int i
1407 * (Given) Axis number (1-relative), as in the FITS PVi_ma keyword. If
1408 * i == 0, wcsset() will replace it with the latitude axis number.
1409 *
1410 * int m
1411 * (Given) Parameter number (non-negative), as in the FITS PVi_ma keyword.
1412 *
1413 * double value
1414 * (Given) Parameter value.
1415 *
1416 *
1417 * wtbarr struct - Extraction of coordinate lookup tables from BINTABLE
1418 * --------------------------------------------------------------------
1419 * Function wcstab(), which is invoked automatically by wcspih(), sets up an
1420 * array of wtbarr structs to assist in extracting coordinate lookup tables
1421 * from a binary table extension (BINTABLE) and copying them into the tabprm
1422 * structs stored in wcsprm. Refer to the usage notes for wcspih() and
1423 * wcstab() in wcshdr.h, and also the prologue to tab.h.
1424 *
1425 * For C++ usage, because of a name space conflict with the wtbarr typedef
1426 * defined in CFITSIO header fitsio.h, the wtbarr struct is renamed to wtbarr_s
1427 * by preprocessor macro substitution with scope limited to wcs.h itself.
1428 *
1429 * int i
1430 * (Given) Image axis number.
1431 *
1432 * int m
1433 * (Given) wcstab array axis number for index vectors.
1434 *
1435 * int kind
1436 * (Given) Character identifying the wcstab array type:
1437 * - c: coordinate array,
1438 * - i: index vector.
1439 *
1440 * char extnam[72]
1441 * (Given) EXTNAME identifying the binary table extension.
1442 *
1443 * int extver
1444 * (Given) EXTVER identifying the binary table extension.
1445 *
1446 * int extlev
1447 * (Given) EXTLEV identifying the binary table extension.
1448 *
1449 * char ttype[72]
1450 * (Given) TTYPEn identifying the column of the binary table that contains
1451 * the wcstab array.
1452 *
1453 * long row
1454 * (Given) Table row number.
1455 *
1456 * int ndim
1457 * (Given) Expected dimensionality of the wcstab array.
1458 *
1459 * int *dimlen
1460 * (Given) Address of the first element of an array of int of length ndim
1461 * into which the wcstab array axis lengths are to be written.
1462 *
1463 * double **arrayp
1464 * (Given) Pointer to an array of double which is to be allocated by the
1465 * user and into which the wcstab array is to be written.
1466 *
1467 *
1468 * Global variable: const char *wcs_errmsg[] - Status return messages
1469 * ------------------------------------------------------------------
1470 * Error messages to match the status value returned from each function.
1471 *
1472 *===========================================================================*/
1473 
1474 #ifndef WCSLIB_WCS
1475 #define WCSLIB_WCS
1476 
1477 #include "lin.h"
1478 #include "cel.h"
1479 #include "spc.h"
1480 
1481 #ifdef __cplusplus
1482 extern "C" {
1483 #endif
1484 
1485 #define WCSSUB_LONGITUDE 0x1001
1486 #define WCSSUB_LATITUDE 0x1002
1487 #define WCSSUB_CUBEFACE 0x1004
1488 #define WCSSUB_CELESTIAL 0x1007
1489 #define WCSSUB_SPECTRAL 0x1008
1490 #define WCSSUB_STOKES 0x1010
1491 
1492 
1493 #define WCSCOMPARE_ANCILLARY 0x0001
1494 #define WCSCOMPARE_TILING 0x0002
1495 #define WCSCOMPARE_CRPIX 0x0004
1496 
1497 
1498 extern const char *wcs_errmsg[];
1499 
1501  WCSERR_SUCCESS = 0, /* Success. */
1502  WCSERR_NULL_POINTER = 1, /* Null wcsprm pointer passed. */
1503  WCSERR_MEMORY = 2, /* Memory allocation failed. */
1504  WCSERR_SINGULAR_MTX = 3, /* Linear transformation matrix is
1505  singular. */
1506  WCSERR_BAD_CTYPE = 4, /* Inconsistent or unrecognized coordinate
1507  axis type. */
1508  WCSERR_BAD_PARAM = 5, /* Invalid parameter value. */
1509  WCSERR_BAD_COORD_TRANS = 6, /* Unrecognized coordinate transformation
1510  parameter. */
1511  WCSERR_ILL_COORD_TRANS = 7, /* Ill-conditioned coordinate transformation
1512  parameter. */
1513  WCSERR_BAD_PIX = 8, /* One or more of the pixel coordinates were
1514  invalid. */
1515  WCSERR_BAD_WORLD = 9, /* One or more of the world coordinates were
1516  invalid. */
1517  WCSERR_BAD_WORLD_COORD = 10, /* Invalid world coordinate. */
1518  WCSERR_NO_SOLUTION = 11, /* No solution found in the specified
1519  interval. */
1520  WCSERR_BAD_SUBIMAGE = 12, /* Invalid subimage specification. */
1521  WCSERR_NON_SEPARABLE = 13 /* Non-separable subimage coordinate
1522  system. */
1523 };
1524 
1525 
1526 /* Struct used for storing PVi_ma keywords. */
1527 struct pvcard {
1528  int i; /* Axis number, as in PVi_ma (1-relative). */
1529  int m; /* Parameter number, ditto (0-relative). */
1530  double value; /* Parameter value. */
1531 };
1532 
1533 /* Struct used for storing PSi_ma keywords. */
1534 struct pscard {
1535  int i; /* Axis number, as in PSi_ma (1-relative). */
1536  int m; /* Parameter number, ditto (0-relative). */
1537  char value[72]; /* Parameter value. */
1538 };
1539 
1540  /* For extracting wcstab arrays. Matches */
1541  /* the wtbarr typedef defined in CFITSIO */
1542  /* header fitsio.h. */
1543 #ifdef __cplusplus
1544 #define wtbarr wtbarr_s /* See prologue above. */
1545 #endif
1546 struct wtbarr {
1547  int i; /* Image axis number. */
1548  int m; /* Array axis number for index vectors. */
1549  int kind; /* wcstab array type. */
1550  char extnam[72]; /* EXTNAME of binary table extension. */
1551  int extver; /* EXTVER of binary table extension. */
1552  int extlev; /* EXTLEV of binary table extension. */
1553  char ttype[72]; /* TTYPEn of column containing the array. */
1554  long row; /* Table row number. */
1555  int ndim; /* Expected wcstab array dimensionality. */
1556  int *dimlen; /* Where to write the array axis lengths. */
1557  double **arrayp; /* Where to write the address of the array */
1558  /* allocated to store the wcstab array. */
1559 };
1560 
1561 
1562 struct wcsprm {
1563  /* Initialization flag (see the prologue above). */
1564  /*------------------------------------------------------------------------*/
1565  int flag; /* Set to zero to force initialization. */
1566 
1567  /* FITS header keyvalues to be provided (see the prologue above). */
1568  /*------------------------------------------------------------------------*/
1569  int naxis; /* Number of axes (pixel and coordinate). */
1570  double *crpix; /* CRPIXja keyvalues for each pixel axis. */
1571  double *pc; /* PCi_ja linear transformation matrix. */
1572  double *cdelt; /* CDELTia keyvalues for each coord axis. */
1573  double *crval; /* CRVALia keyvalues for each coord axis. */
1574 
1575  char (*cunit)[72]; /* CUNITia keyvalues for each coord axis. */
1576  char (*ctype)[72]; /* CTYPEia keyvalues for each coord axis. */
1577 
1578  double lonpole; /* LONPOLEa keyvalue. */
1579  double latpole; /* LATPOLEa keyvalue. */
1580 
1581  double restfrq; /* RESTFRQa keyvalue. */
1582  double restwav; /* RESTWAVa keyvalue. */
1583 
1584  int npv; /* Number of PVi_ma keywords, and the */
1585  int npvmax; /* number for which space was allocated. */
1586  struct pvcard *pv; /* PVi_ma keywords for each i and m. */
1587 
1588  int nps; /* Number of PSi_ma keywords, and the */
1589  int npsmax; /* number for which space was allocated. */
1590  struct pscard *ps; /* PSi_ma keywords for each i and m. */
1591 
1592  /* Alternative header keyvalues (see the prologue above). */
1593  /*------------------------------------------------------------------------*/
1594  double *cd; /* CDi_ja linear transformation matrix. */
1595  double *crota; /* CROTAia keyvalues for each coord axis. */
1596  int altlin; /* Alternative representations */
1597  /* Bit 0: PCi_ja is present, */
1598  /* Bit 1: CDi_ja is present, */
1599  /* Bit 2: CROTAia is present. */
1600  int velref; /* AIPS velocity code, VELREF. */
1601 
1602  /* Auxiliary coordinate system information, not used by WCSLIB. */
1603  char alt[4];
1604  int colnum;
1605  int *colax;
1606 
1607  char (*cname)[72];
1608  double *crder;
1609  double *csyer;
1610  char dateavg[72];
1611  char dateobs[72];
1612  double equinox;
1613  double mjdavg;
1614  double mjdobs;
1615  double obsgeo[3];
1616  char radesys[72];
1617  char specsys[72];
1618  char ssysobs[72];
1619  double velosys;
1620  double zsource;
1621  char ssyssrc[72];
1622  double velangl;
1623  char wcsname[72];
1624 
1625  /* Coordinate lookup tables (see the prologue above). */
1626  /*------------------------------------------------------------------------*/
1627  int ntab; /* Number of separate tables. */
1628  int nwtb; /* Number of wtbarr structs. */
1629  struct tabprm *tab; /* Tabular transformation parameters. */
1630  struct wtbarr *wtb; /* Array of wtbarr structs. */
1631 
1632  /* Information derived from the FITS header keyvalues by wcsset(). */
1633  /*------------------------------------------------------------------------*/
1634  char lngtyp[8], lattyp[8]; /* Celestial axis types, e.g. RA, DEC. */
1635  int lng, lat, spec; /* Longitude, latitude and spectral axis */
1636  /* indices (0-relative). */
1637  int cubeface; /* True if there is a CUBEFACE axis. */
1638  int *types; /* Coordinate type codes for each axis. */
1639  void *padding; /* (Dummy inserted for alignment purposes.) */
1640 
1641  struct linprm lin; /* Linear transformation parameters. */
1642  struct celprm cel; /* Celestial transformation parameters. */
1643  struct spcprm spc; /* Spectral transformation parameters. */
1644 
1645  /* Error handling, if enabled. */
1646  /*------------------------------------------------------------------------*/
1647  struct wcserr *err;
1648 
1649  /* Private - the remainder are for memory management. */
1650  /*------------------------------------------------------------------------*/
1651  void *m_padding;
1653  double *m_crpix, *m_pc, *m_cdelt, *m_crval;
1654  char (*m_cunit)[72], (*m_ctype)[72];
1655  struct pvcard *m_pv;
1656  struct pscard *m_ps;
1657  double *m_cd, *m_crota;
1658  int *m_colax;
1659  char (*m_cname)[72];
1660  double *m_crder, *m_csyer;
1661  struct tabprm *m_tab;
1662  struct wtbarr *m_wtb;
1663 };
1664 
1665 /* Size of the wcsprm struct in int units, used by the Fortran wrappers. */
1666 #define WCSLEN (sizeof(struct wcsprm)/sizeof(int))
1667 
1668 
1669 int wcsnpv(int n);
1670 
1671 int wcsnps(int n);
1672 
1673 int wcsini(int alloc, int naxis, struct wcsprm *wcs);
1674 
1675 int wcssub(int alloc, const struct wcsprm *wcssrc, int *nsub, int axes[],
1676  struct wcsprm *wcsdst);
1677 
1678 int wcscompare(int cmp, double tol, const struct wcsprm *wcs1,
1679  const struct wcsprm *wcs2, int *equal);
1680 
1681 int wcsfree(struct wcsprm *wcs);
1682 
1683 int wcsprt(const struct wcsprm *wcs);
1684 
1685 int wcsperr(const struct wcsprm *wcs, const char *prefix);
1686 
1687 int wcsbchk(struct wcsprm *wcs, int bounds);
1688 
1689 int wcsset(struct wcsprm *wcs);
1690 
1691 int wcsp2s(struct wcsprm *wcs, int ncoord, int nelem, const double pixcrd[],
1692  double imgcrd[], double phi[], double theta[], double world[],
1693  int stat[]);
1694 
1695 int wcss2p(struct wcsprm *wcs, int ncoord, int nelem, const double world[],
1696  double phi[], double theta[], double imgcrd[], double pixcrd[],
1697  int stat[]);
1698 
1699 int wcsmix(struct wcsprm *wcs, int mixpix, int mixcel, const double vspan[],
1700  double vstep, int viter, double world[], double phi[],
1701  double theta[], double imgcrd[], double pixcrd[]);
1702 
1703 int wcssptr(struct wcsprm *wcs, int *i, char ctype[9]);
1704 
1705 const char* wcslib_version(int vers[3]);
1706 
1707 /* Defined mainly for backwards compatibility, use wcssub() instead. */
1708 #define wcscopy(alloc, wcssrc, wcsdst) wcssub(alloc, wcssrc, 0x0, 0x0, wcsdst)
1709 
1710 
1711 /* Deprecated. */
1712 #define wcsini_errmsg wcs_errmsg
1713 #define wcssub_errmsg wcs_errmsg
1714 #define wcscopy_errmsg wcs_errmsg
1715 #define wcsfree_errmsg wcs_errmsg
1716 #define wcsprt_errmsg wcs_errmsg
1717 #define wcsset_errmsg wcs_errmsg
1718 #define wcsp2s_errmsg wcs_errmsg
1719 #define wcss2p_errmsg wcs_errmsg
1720 #define wcsmix_errmsg wcs_errmsg
1721 
1722 #ifdef __cplusplus
1723 #undef wtbarr
1724 }
1725 #endif
1726 
1727 #endif /* WCSLIB_WCS */
Definition: wcs.h:1513
char dateobs[72]
Definition: wcs.h:1611
int wcsfree(struct wcsprm *wcs)
Destructor for the wcsprm struct.
char radesys[72]
Definition: wcs.h:1616
struct wtbarr * m_wtb
Definition: wcs.h:1662
Definition: wcs.h:1503
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:1653
Definition: wcs.h:1521
double * cd
Definition: wcs.h:1594
int * m_colax
Definition: wcs.h:1658
struct pscard * ps
Definition: wcs.h:1590
double * cdelt
Definition: wcs.h:1572
int i
Definition: wcs.h:1528
int npv
Definition: wcs.h:1584
struct tabprm * tab
Definition: wcs.h:1629
char ttype[72]
Definition: getwcstab.h:173
struct wcserr * err
Definition: wcs.h:1647
int lng
Definition: wcs.h:1635
char(* m_cunit)[72]
Definition: wcs.h:1654
int npsmax
Definition: wcs.h:1589
char alt[4]
Definition: wcs.h:1603
char(* m_cname)[72]
Definition: wcs.h:1659
Error message handling.
Definition: wcserr.h:221
int i
Definition: getwcstab.h:167
struct spcprm spc
Definition: wcs.h:1643
int cubeface
Definition: wcs.h:1637
int flag
Definition: wcs.h:1565
double equinox
Definition: wcs.h:1612
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:1529
int wcsbchk(struct wcsprm *wcs, int bounds)
Enable/disable bounds checking.
double obsgeo[3]
Definition: wcs.h:1615
Definition: wcs.h:1520
double lonpole
Definition: wcs.h:1578
int nps
Definition: wcs.h:1588
struct pvcard * pv
Definition: wcs.h:1586
int m
Definition: getwcstab.h:168
Definition: wcs.h:1504
Definition: wcs.h:1501
Spectral transformation parameters.
Definition: spc.h:773
Definition: wcs.h:1508
struct tabprm * m_tab
Definition: wcs.h:1661
Celestial transformation parameters.
Definition: cel.h:392
Linear transformation parameters.
Definition: lin.h:599
wcs_errmsg_enum
Definition: wcs.h:1500
struct pscard * m_ps
Definition: wcs.h:1656
int wcsprt(const struct wcsprm *wcs)
Print routine for the wcsprm struct.
Definition: wcs.h:1502
char(* cunit)[72]
Definition: wcs.h:1575
int ntab
Definition: wcs.h:1627
double * crota
Definition: wcs.h:1595
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:1652
double * m_cd
Definition: wcs.h:1657
long row
Definition: getwcstab.h:174
double restfrq
Definition: wcs.h:1581
char specsys[72]
Definition: wcs.h:1617
int * types
Definition: wcs.h:1638
int wcssptr(struct wcsprm *wcs, int *i, char ctype[9])
Spectral axis translation.
char value[72]
Definition: wcs.h:1537
int nwtb
Definition: wcs.h:1628
char dateavg[72]
Definition: wcs.h:1610
char ssysobs[72]
Definition: wcs.h:1618
char(* cname)[72]
Definition: wcs.h:1607
double ** arrayp
Definition: getwcstab.h:177
int wcsset(struct wcsprm *wcs)
Setup routine for the wcsprm struct.
Coordinate transformation parameters.
Definition: wcs.h:1562
int colnum
Definition: wcs.h:1604
Definition: wcs.h:1509
double * m_pc
Definition: wcs.h:1653
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:1622
struct wtbarr * wtb
Definition: wcs.h:1630
double * crder
Definition: wcs.h:1608
double restwav
Definition: wcs.h:1582
double * m_crder
Definition: wcs.h:1660
char lngtyp[8]
Definition: wcs.h:1634
int wcsnpv(int n)
Memory allocation for PVi_ma.
int naxis
Definition: wcs.h:1569
int m
Definition: wcs.h:1536
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:1635
const char * wcs_errmsg[]
Status return messages.
Definition: wcs.h:1517
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:1579
double * m_crpix
Definition: wcs.h:1653
double velosys
Definition: wcs.h:1619
double * m_csyer
Definition: wcs.h:1660
Definition: wcs.h:1511
Tabular transformation parameters.
Definition: tab.h:524
int velref
Definition: wcs.h:1600
int i
Definition: wcs.h:1535
const char * wcslib_version(int vers[3])
double * csyer
Definition: wcs.h:1609
void * m_padding
Definition: wcs.h:1651
int lat
Definition: wcs.h:1635
Store for PVi_ma keyrecords.
Definition: wcs.h:1527
Definition: wcs.h:1506
double * crpix
Definition: wcs.h:1570
double mjdavg
Definition: wcs.h:1613
struct celprm cel
Definition: wcs.h:1642
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:1653
int npvmax
Definition: wcs.h:1585
double value
Definition: wcs.h:1530
Store for PSi_ma keyrecords.
Definition: wcs.h:1534
int ndim
Definition: getwcstab.h:175
double * crval
Definition: wcs.h:1573
int * colax
Definition: wcs.h:1605
int altlin
Definition: wcs.h:1596
struct linprm lin
Definition: wcs.h:1641
char(* ctype)[72]
Definition: wcs.h:1576
double * pc
Definition: wcs.h:1571
double mjdobs
Definition: wcs.h:1614
int extver
Definition: getwcstab.h:171
double * m_crota
Definition: wcs.h:1657
Definition: wcs.h:1518
int * dimlen
Definition: getwcstab.h:176
char ssyssrc[72]
Definition: wcs.h:1621
char lattyp[8]
Definition: wcs.h:1634
Definition: wcs.h:1515
struct pvcard * m_pv
Definition: wcs.h:1655
int m_flag
Definition: wcs.h:1652
int extlev
Definition: getwcstab.h:172
double zsource
Definition: wcs.h:1620
void * padding
Definition: wcs.h:1639
char wcsname[72]
Definition: wcs.h:1623
int wcsnps(int n)
Memory allocation for PSi_ma.