wcslib.h
Go to the documentation of this file.
/*============================================================================
WCSLIB 5.17 - an implementation of the FITS WCS standard.
Copyright (C) 1995-2017, Mark Calabretta
This file is part of WCSLIB.
WCSLIB is free software: you can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
WCSLIB 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 Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with WCSLIB. If not, see http://www.gnu.org/licenses.
Direct correspondence concerning WCSLIB to mark@calabretta.id.au
Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
http://www.atnf.csiro.au/people/Mark.Calabretta
$Id: wcslib.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $
*=============================================================================
*
* WCSLIB 5.17 - C routines that implement the FITS World Coordinate System
* (WCS) standard. Refer to the README file provided with WCSLIB for an
* overview of the library.
*
* Summary of wcslib.h
* -------------------
* This header file is provided purely for convenience. Use it to include all
* of the separate WCSLIB headers.
*
*===========================================================================*/
#ifndef WCSLIB_WCSLIB
#define WCSLIB_WCSLIB
#include "cel.h"
#include "dis.h"
#include "fitshdr.h"
#include "lin.h"
#include "log.h"
#include "prj.h"
#include "spc.h"
#include "sph.h"
#include "spx.h"
#include "tab.h"
#include "wcs.h"
#include "wcserr.h"
#include "wcsfix.h"
#include "wcshdr.h"
#include "wcsmath.h"
#include "wcsprintf.h"
#include "wcstrig.h"
#include "wcsunits.h"
#include "wcsutil.h"
#endif /* WCSLIB_WCSLIB */
wcserr_enable(1);
wcsprintf_set(stderr);
...
if (wcsset(&wcs) {
wcsperr(&wcs);
return wcs.err->status;
}
@endverbatim
In this example, if an error was generated in one of the prjset() functions,
wcsperr() would print an error traceback starting with wcsset(), then
celset(), and finally the particular projection-setting function that
generated the error. For each of them it would print the status return value,
function name, source file, line number, and an error message which may be
more specific and informative than the general error messages reported in the
first example. For example, in response to a deliberately generated error,
the @c twcs test program, which tests wcserr among other things, produces a
traceback similar to this:
@verbatim
ERROR 5 in wcsset() at line 1564 of file wcs.c:
Invalid parameter value.
ERROR 2 in celset() at line 196 of file cel.c:
Invalid projection parameters.
ERROR 2 in bonset() at line 5727 of file prj.c:
Invalid parameters for Bonne's projection.
@endverbatim
Each of the @ref structs "structs" in @ref overview "WCSLIB" includes a
pointer, called @a err, to a wcserr struct. When an error occurs, a struct is
allocated and error information stored in it. The wcserr pointers and the
@ref memory "memory" allocated for them are managed by the routines that
manage the various structs such as wcsini() and wcsfree().
wcserr messaging is an opt-in system enabled via wcserr_enable(), as in the
example above. If enabled, when an error occurs it is the user's
responsibility to free the memory allocated for the error message using
wcsfree(), celfree(), prjfree(), etc. Failure to do so before the struct goes
out of scope will result in memory leaks (if execution continues beyond the
error).
*/
wcsfree
int wcsfree(struct wcsprm *wcs)
Destructor for the wcsprm struct.
dis.h
wcshdr.h
lin.h
cel.h
prj.h
wcserr_enable
int wcserr_enable(int enable)
Enable/disable error messaging.
wcserr
Error message handling.
Definition: wcserr.h:225
wcsunits.h
wcsmath.h
spc.h
sph.h
prjfree
int prjfree(struct prjprm *prj)
Destructor for the prjprm struct.
wcsset
int wcsset(struct wcsprm *wcs)
Setup routine for the wcsprm struct.
celfree
int celfree(struct celprm *cel)
Destructor for the celprm struct.
fitshdr.h
wcsprintf_set
int wcsprintf_set(FILE *wcsout)
Set output disposition for wcsprintf() and wcsfprintf().
wcsperr
int wcsperr(const struct wcsprm *wcs, const char *prefix)
Print error messages from a wcsprm struct.
prjset
int prjset(struct prjprm *prj)
Generic setup routine for the prjprm struct.
wcsutil.h
wcsfix.h
wcsprintf.h
bonset
int bonset(struct prjprm *prj)
Set up a prjprm struct for Bonne&#39;s (BON) projection.
wcsini
int wcsini(int alloc, int naxis, struct wcsprm *wcs)
Default constructor for the wcsprm struct.
wcserr.h
wcs.h
tab.h
log.h
wcstrig.h
spx.h
celset
int celset(struct celprm *cel)
Setup routine for the celprm struct.