WCSLIB 8.5
Loading...
Searching...
No Matches
wcslib.h
Go to the documentation of this file.
1/*============================================================================
2 WCSLIB 8.5 - an implementation of the FITS WCS standard.
3 Copyright (C) 1995-2025, Mark Calabretta
4
5 This file is part of WCSLIB.
6
7 WCSLIB is free software: you can redistribute it and/or modify it under the
8 terms of the GNU Lesser General Public License as published by the Free
9 Software Foundation, either version 3 of the License, or (at your option)
10 any later version.
11
12 WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
15 more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with WCSLIB. If not, see http://www.gnu.org/licenses.
19
20 Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
21 http://www.atnf.csiro.au/people/Mark.Calabretta
22 $Id: wcslib.h,v 8.5 2025/12/06 13:47:41 mcalabre Exp $
23*=============================================================================
24*
25* WCSLIB 8.5 - C routines that implement the FITS World Coordinate System
26* (WCS) standard. Refer to the README file provided with WCSLIB for an
27* overview of the library.
28*
29* 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
3980
3981
4002
4003
4004
4115
4116
4305
4306
4345
4564
4584
4599
4625
4644
4659
4677
4711
4748
4782
4817
4828
4848
4853
4860
4872
4877
4885
4904
4911
4938
4947
4955
4962
4969
4977
4984
4989
4995
5001
5006
5015
5022
5027
5032
5051
5064
5078
5091
5104
5118
5131
5144
5158
5171
5184
5198
5211
5224
5238
5251
5265
5279
5292
5305
5319
5332
5345
5359
5372
5385
5399
5412
5425
5439
5452
5465
5479
5492
5505
5519
5532
5545
5559
5572
5585
5599
5612
5625
5639
5652
5665
5679
5692
5705
5719
5732
5745
5759
5772
5785
5799
5812
5825
5839
5852
5865
5879
5892
5905
5919
5932
5945
5959
5972
5985
5999
6012
6025
6039
6052
6065
6079
6092
6105
6119
6125
6131
6137
6143
6149
6155
6161
6167
6175
6182
6189
6195
6201
6207
6213
6219
6225
6231
6237
6399
6418
6433
6459
6484
6499
6517
6547
6579
6612
6683
6736
6792
6860
6923
6934
6953
6959
6965
6970
6975
6983
7000
7012
7022
7027
7033
7038
7043
7051
7056
7064
7076
7082
7088
7094
7100
7127
7159
7189
7253
7410
7453
7471
7496
7521
7546
7558
7563
7568
7573
7586
7591
7596
7601
7606
7611
7616
7621
7626
7631
7636
7641
7647
7652
7658
7664
7670
7675
7681
7686
7692
7697
7703
7708
7714
7719
7725
7730
7736
7741
7747
7752
7758
7763
7769
7774
7781
7786
7792
7797
7811
7819
7827
7835
7843
7851
7859
7867
7875
7883
7891
7899
7907
7915
7923
7931
7939
7947
7955
7963
7971
7979
7987
7994
8043
8098
8117
8152
8179
8198
8226
8251
8266
8284
8314
8349
8383
8394
8418
8427
8438
8460
8467
8485
8497
8503
8508
8515
8522
8529
8543
8549
8554
8559
8564
8569
8574
8579
8584
8589
8594
8599
8611
8617
8623
8629
8635
8641
8647
8749
8766
8783
8795
8854
8881
9018
9057
9066
9085
9123
9151
9172
9201
9216
9235
9265
9314
9378
9444
9550
9693
9735
9765
9793
9833
9842
9848
9881
9887
9893
9922
9938
9945
9958
9963
9969
9974
9982
9997
10002
10010
10021
10028
10035
10104
10112
10126
10138
10150
10163
10172
10181
10190
10199
10210
10221
10230
10239
10248
10259
10268
10278
10288
10298
10307
10316
10325
10334
10343
10352
10361
10370
10379
10388
10397
10406
10415
10424
10433
10442
10451
10463
10472
10481
10491
10500
10510
10520
10528
10537
10546
10557
10562
10567
10583
10593
10598
10606
10611
10616
10621
10630
10637
10645
10694
10700
10706
10712
10718
10723
10728
10733
10738
10743
10748
10753
10758
10763
10768
10773
10778
10783
10788
10793
10798
10803
10808
10813
10818
10828
10834
10839
10844
10854
10859
10864
10869
10880
10886
10892
10898
10904
10910
10916
10922
10928
10934
10940
10945
10958
10965
10972
10980
10987
10994
11000
11006
11012
11018
11024
11030
11036
11042
11048
11078
11087
11094
11107
11112
11129
11151
11169
11183
11229
11248
11358
11365
11406
11428
11476
11569
11596
11639
11685
11722
11811
11824
11831
11838
11845
11852
11859
11865
11952
12073
12948
12995
13030
13073
13091
13341
13357
13366
13375
13385
13394
13403
13413
13423
13432
13441
13450
13459
13469
13483
13494
13507
13514
13522
13529
13538
13547
13556
13566
13577
13592
13616
13634
13658
13664
13668
13672
13679
13694
13710
13727
13747
13761
13807
13818
13829
13843
13854
13865
13876
13887
13943
13994
14086
14178
14185
14210
14235
14243
14251
14259
14267
14275
14283
14291
14299
14307
14315
14323
14331
14339
14347
14355
14363
14380
14400
14438
14455
14479
14498
14517
14537
14568
14592
14611
14630
14659
14688
14708
14729
14752
14766
14788
14804
14809
14814
14823
14828
14833
14838
14844
14849
14854
14860
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().