Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*=============================================================================
*
* WCSLIB - an implementation of the FITS WCS proposal.
* Copyright (C) 1995-1999, Mark Calabretta
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
* General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; if not, write to the Free Software Foundation,
* Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Correspondence concerning WCSLIB may be directed to:
* Internet email: mcalabre@atnf.csiro.au
* Postal address: Dr. Mark Calabretta,
* Australia Telescope National Facility,
* P.O. Box 76,
* Epping, NSW, 2121,
* AUSTRALIA
*
*=============================================================================
*
* C routines which implement the FITS World Coordinate System (WCS)
* convention.
*
* Summary of routines
* -------------------
* wcsfwd() and wcsrev() are high level driver routines for the WCS linear
* transformation, spherical coordinate transformation, and spherical
* projection routines.
*
* Given either the celestial longitude or latitude plus an element of the
* pixel coordinate a hybrid routine, wcsmix(), iteratively solves for the
* unknown elements.
*
* An initialization routine, wcsset(), computes indices from the ctype
* array but need not be called explicitly - see the explanation of
* wcs.flag below.
*
*
* Initialization routine; wcsset()
* --------------------------------
* Initializes elements of a wcsprm data structure which holds indices into
* the coordinate arrays. Note that this routine need not be called directly;
* it will be invoked by wcsfwd() and wcsrev() if the "flag" structure member
* is anything other than a predefined magic value.
*
* Given:
* naxis const int
* Number of image axes.
* ctype[][9]
* const char
* Coordinate axis types corresponding to the FITS
* CTYPEn header cards.
*
* Returned:
* wcs wcsprm* Indices for the celestial coordinates obtained
* by parsing the ctype[] array (see below).
*
* Function return value:
* int Error status
* 0: Success.
* 1: Inconsistent or unrecognized coordinate axis
* types.
*
*
* Forward transformation; wcsfwd()
* --------------------------------
* Compute the pixel coordinate for given world coordinates.
*
* Given:
* ctype[][9]
* const char
* Coordinate axis types corresponding to the FITS
* CTYPEn header cards.
*
* Given or returned:
* wcs wcsprm* Indices for the celestial coordinates obtained
* by parsing the ctype[] array (see below).
*
* Given:
* world const double[]
* World coordinates. world[wcs->lng] and
* world[wcs->lat] are the celestial longitude and
* latitude, in degrees.
*
* Given:
* crval const double[]
* Coordinate reference values corresponding to the FITS
* CRVALn header cards.
*
* Given and returned:
* cel celprm* Spherical coordinate transformation parameters (usage
* is described in the prologue to "cel.c").
*
* Returned:
* phi, double* Longitude and latitude in the native coordinate
* theta system of the projection, in degrees.
*
* Given and returned:
* prj prjprm* Projection parameters (usage is described in the
* prologue to "proj.c").
*
* Returned:
* imgcrd double[] Image coordinate. imgcrd[wcs->lng] and
* imgcrd[wcs->lat] are the projected x-, and
* y-coordinates, in "degrees". For quadcube
* projections with a CUBEFACE axis the face number is
* also returned in imgcrd[wcs->cubeface].
*
* Given and returned:
* lin linprm* Linear transformation parameters (usage is described
* in the prologue to "lin.c").
*
* Returned:
* pixcrd double[] Pixel coordinate.
*
* Function return value:
* int Error status
* 0: Success.
* 1: Invalid coordinate transformation parameters.
* 2: Invalid projection parameters.
* 3: Invalid world coordinate.
* 4: Invalid linear transformation parameters.
*
*
* Reverse transformation; wcsrev()
* --------------------------------
* Compute world coordinates for a given pixel coordinate.
*
* Given:
* ctype[][9]
* const char
* Coordinate axis types corresponding to the FITS
* CTYPEn header cards.
*
* Given or returned:
* wcs wcsprm* Indices for the celestial coordinates obtained
* by parsing the ctype[] array (see below).
*
* Given:
* pixcrd const double[]
* Pixel coordinate.
*
* Given and returned:
* lin linprm* Linear transformation parameters (usage is described
* in the prologue to "lin.c").
*
* Returned:
* imgcrd double[] Image coordinate. imgcrd[wcs->lng] and
* imgcrd[wcs->lat] are the projected x-, and
* y-coordinates, in "degrees".
*
* Given and returned:
* prj prjprm* Projection parameters (usage is described in the
* prologue to "proj.c").
*
* Returned:
* phi, double* Longitude and latitude in the native coordinate
* theta system of the projection, in degrees.
*
* Given:
* crval const double[]
* Coordinate reference values corresponding to the FITS
* CRVALn header cards.
*
* Given and returned:
* cel celprm* Spherical coordinate transformation parameters
* (usage is described in the prologue to "cel.c").
*
* Returned:
* world double[] World coordinates. world[wcs->lng] and
* world[wcs->lat] are the celestial longitude and
* latitude, in degrees.
*
* Function return value:
* int Error status
* 0: Success.
* 1: Invalid coordinate transformation parameters.
* 2: Invalid projection parameters.
* 3: Invalid pixel coordinate.
* 4: Invalid linear transformation parameters.
*
*
* Hybrid transformation; wcsmix()
* -------------------------------
* Given either the celestial longitude or latitude plus an element of the
* pixel coordinate solve for the remaining elements by iterating on the
* unknown celestial coordinate element using wcsfwd().
*
* Given:
* ctype[][9]
* const char
Loading
Loading full blame…