WCSLIB 8.9
Loading...
Searching...
No Matches
wcslib.h
Go to the documentation of this file.
1/*============================================================================
2 WCSLIB 8.9 - an implementation of the FITS WCS standard.
3 Copyright (C) 1995-2026, Mark Calabretta
4
5 This file is part of WCSLIB.
6
7 WCSLIB is free software: you can redistribute it and/or modify it under the
8 terms of the GNU Lesser General Public License as published by the Free
9 Software Foundation, either version 3 of the License, or (at your option)
10 any later version.
11
12 WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
15 more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with WCSLIB. If not, see http://www.gnu.org/licenses.
19
20 Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
21 http://www.atnf.csiro.au/computing/software/wcs
22 $Id: wcslib.h,v 8.9 2026/06/18 13:00:03 mcalabre Exp $
23*=============================================================================
24*
25* WCSLIB 8.9 - C routines that implement the FITS World Coordinate System
26* (WCS) standard. Refer to the README file provided with WCSLIB for an
27* overview of the library.
28*
29* Summary of wcslib.h
30* -------------------
31* This header file is provided purely for convenience. Use it to include all
32* of the separate WCSLIB headers.
33*
34*===========================================================================*/
35
36#ifndef WCSLIB_WCSLIB
37#define WCSLIB_WCSLIB
38
39#include "cel.h"
40#include "dis.h"
41#include "fitshdr.h"
42#include "lin.h"
43#include "log.h"
44#include "prj.h"
45#include "spc.h"
46#include "sph.h"
47#include "spx.h"
48#include "tab.h"
49#include "wcs.h"
50#include "wcserr.h"
51#include "wcsfix.h"
52#include "wcshdr.h"
53#include "wcsmath.h"
54#include "wcsprintf.h"
55#include "wcstrig.h"
56#include "wcsunits.h"
57#include "wcsutil.h"
58#include "wtbarr.h"
59
60#endif // WCSLIB_WCSLIB
100
120
135
161
180
195
214
247
287
327
340
365
372
377
386
426
432
440
452
461
467
472
484
490
496
502
508
857
874
925
937
950
960
1005
1036
1055
1083
1108
1123
1141
1158
1189
1202
1246
1334
1346
1368
1377
1383
1388
1396
1408
1418
1428
1439
1446
1468
1479
1490
1497
1504
1509
1514
1520
1525
1530
1535
1540
1545
1550
1555
1566
1580
1585
1594
1605
1619
1627
1635
1642
1650
1658
1666
1674
1682
1690
1698
1706
1714
1722
1730
1748
1882
1892
1899
1904
1917
1926
1933
1939
1956
1974
2046
2051
2068
2074
2080
2086
2092
2098
2104
2111
2123
2136
2143
2150
2157
2164
2171
2206
2315
2325
2370
2381
2422
2453
2472
2502
2527
2542
2561
2594
2633
2671
2756
2766
2789
2798
2807
2840
2846
2895
2903
2909
2915
2921
2926
2931
2936
2942
2947
2952
2957
2962
2967
2972
2977
2982
2994
3000
3006
3012
3018
3024
3030
3036
3089
3114
3142
3195
3249
3250
3395
3396
3548
3549
3603
3604
3662
3663
3695 wcserr_enable(1);
3696 wcsprintf_set(stderr);
3697
3698 ...
3699
3700 if (wcsset(&wcs) {
3701 wcsperr(&wcs);
3702 return wcs.err->status;
3703 }
3704@endverbatim
3705In this example, if an error was generated in one of the prjset() functions,
3706wcsperr() would print an error traceback starting with wcsset(), then
3707celset(), and finally the particular projection-setting function that
3708generated the error. For each of them it would print the status return value,
3709function name, source file, line number, and an error message which may be
3710more specific and informative than the general error messages reported in the
3711first example. For example, in response to a deliberately generated error,
3712the @c twcs test program, which tests wcserr among other things, produces a
3713traceback similar to this:
3714@verbatim
3715ERROR 5 in wcsset() at line 1564 of file wcs.c:
3716 Invalid parameter value.
3717ERROR 2 in celset() at line 196 of file cel.c:
3718 Invalid projection parameters.
3719ERROR 2 in bonset() at line 5727 of file prj.c:
3720 Invalid parameters for Bonne's projection.
3721@endverbatim
3722
3723Each of the @ref structs "structs" in @ref overview "WCSLIB" includes a
3724pointer, called @a err, to a wcserr struct. When an error occurs, a struct is
3725allocated and error information stored in it. The wcserr pointers and the
3726@ref memory "memory" allocated for them are managed by the routines that
3727manage the various structs such as wcsinit() and wcsfree().
3728
3729wcserr messaging is an opt-in system enabled via wcserr_enable(), as in the
3730example above. If enabled, when an error occurs it is the user's
3731responsibility to free the memory allocated for the error message using
3732wcsfree(), celfree(), prjfree(), etc. Failure to do so before the struct goes
3733out of scope will result in memory leaks (if execution continues beyond the
3734error).
3735*/
3736
3737
3918
3919
3993
3994
4015
4016
4017
4128
4129
4318
4319
4358
4577
4597
4612
4638
4657
4672
4690
4724
4761
4795
4830
4841
4861
4866
4873
4885
4890
4898
4917
4924
4951
4960
4968
4975
4982
4990
4997
5002
5008
5014
5019
5028
5035
5040
5045
5064
5077
5091
5104
5117
5131
5144
5157
5171
5184
5197
5211
5224
5237
5251
5264
5278
5292
5305
5318
5332
5345
5358
5372
5385
5398
5412
5425
5438
5452
5465
5478
5492
5505
5518
5532
5545
5558
5572
5585
5598
5612
5625
5638
5652
5665
5678
5692
5705
5718
5732
5745
5758
5772
5785
5798
5812
5825
5838
5852
5865
5878
5892
5905
5918
5932
5945
5958
5972
5985
5998
6012
6025
6038
6052
6065
6078
6092
6105
6118
6132
6138
6144
6150
6156
6162
6168
6174
6180
6188
6195
6202
6208
6214
6220
6226
6232
6238
6244
6250
6412
6431
6446
6472
6497
6512
6530
6560
6592
6625
6696
6749
6805
6873
6936
6947
6966
6972
6978
6983
6988
6996
7013
7025
7035
7040
7046
7051
7056
7064
7069
7077
7089
7095
7101
7107
7113
7140
7172
7202
7266
7423
7466
7484
7509
7534
7559
7571
7576
7581
7586
7599
7604
7609
7614
7619
7624
7629
7634
7639
7644
7649
7654
7660
7665
7671
7677
7683
7688
7694
7699
7705
7710
7716
7721
7727
7732
7738
7743
7749
7754
7760
7765
7771
7776
7782
7787
7794
7799
7805
7810
7824
7832
7840
7848
7856
7864
7872
7880
7888
7896
7904
7912
7920
7928
7936
7944
7952
7960
7968
7976
7984
7992
8000
8007
8056
8111
8130
8165
8192
8211
8239
8264
8279
8297
8327
8362
8396
8407
8431
8440
8451
8473
8480
8498
8510
8516
8521
8528
8535
8542
8556
8562
8567
8572
8577
8582
8587
8592
8597
8602
8607
8612
8624
8630
8636
8642
8648
8654
8660
8762
8779
8796
8808
8867
8894
9031
9070
9079
9098
9136
9164
9185
9214
9229
9248
9278
9327
9391
9457
9563
9706
9748
9778
9806
9846
9855
9861
9894
9900
9906
9935
9951
9958
9971
9976
9982
9987
9995
10010
10015
10023
10034
10041
10048
10117
10125
10139
10151
10163
10176
10185
10194
10203
10212
10223
10234
10243
10252
10261
10272
10281
10291
10301
10311
10320
10329
10338
10347
10356
10365
10374
10383
10392
10401
10410
10419
10428
10437
10446
10455
10464
10476
10485
10494
10504
10513
10523
10533
10541
10550
10559
10570
10575
10580
10596
10606
10611
10619
10624
10629
10634
10643
10650
10658
10707
10713
10719
10725
10731
10736
10741
10746
10751
10756
10761
10766
10771
10776
10781
10786
10791
10796
10801
10806
10811
10816
10821
10826
10831
10841
10847
10852
10857
10867
10872
10877
10882
10893
10899
10905
10911
10917
10923
10929
10935
10941
10947
10953
10958
10971
10978
10985
10993
11000
11007
11013
11019
11025
11031
11037
11043
11049
11055
11061
11091
11100
11107
11120
11125
11142
11164
11182
11196
11242
11261
11371
11378
11419
11441
11489
11582
11609
11652
11698
11735
11824
11837
11844
11851
11858
11865
11872
11878
11965
12086
12961
13008
13043
13086
13104
13354
13370
13379
13388
13398
13407
13416
13426
13436
13445
13454
13463
13472
13482
13496
13507
13520
13527
13535
13542
13551
13560
13569
13579
13590
13605
13629
13647
13676
13682
13686
13690
13697
13712
13728
13745
13773
13788
13834
13845
13856
13870
13881
13892
13903
13914
13970
14021
14113
14205
14212
14237
14262
14270
14278
14286
14294
14302
14310
14318
14326
14334
14342
14350
14358
14366
14374
14382
14390
14407
14427
14465
14482
14506
14525
14544
14564
14595
14619
14638
14657
14686
14715
14735
14756
14781
14795
14817
14833
14838
14843
14852
14857
14862
14867
14873
14878
14883
14889
int celfree(struct celprm *cel)
Destructor for the celprm struct.
int celset(struct celprm *cel)
Setup routine for the celprm struct.
int prjfree(struct prjprm *prj)
Destructor for the prjprm struct.
int bonset(struct prjprm *prj)
Set up a prjprm struct for Bonne's (BON) projection.
int prjset(struct prjprm *prj)
Generic setup routine for the prjprm struct.
Error message handling.
Definition wcserr.h:243
int wcsfree(struct wcsprm *wcs)
Destructor for the wcsprm struct.
int wcsperr(const struct wcsprm *wcs, const char *prefix)
Print error messages from a wcsprm struct.
int wcsinit(int alloc, int naxis, struct wcsprm *wcs, int npvmax, int npsmax, int ndpmax)
Default constructor for the wcsprm struct.
int wcsset(struct wcsprm *wcs)
Setup routine for the wcsprm struct.
int wcserr_enable(int enable)
Enable/disable error messaging.
int wcsprintf_set(FILE *wcsout)
Set output disposition for wcsprintf() and wcsfprintf().