head	3.4;
access;
symbols;
locks
	cal103:3.4; strict;
comment	@ * @;


3.4
date	2004.02.11.00.23.05;	author mcalabre;	state Exp;
branches;
next	3.3;

3.3
date	2003.10.21.08.10.05;	author mcalabre;	state Exp;
branches;
next	3.2;

3.2
date	2003.09.09.04.40.16;	author mcalabre;	state Exp;
branches;
next	3.1;

3.1
date	2003.04.28.04.27.07;	author mcalabre;	state Exp;
branches;
next	3.0;

3.0
date	2003.04.01.04.16.39;	author mcalabre;	state Exp;
branches;
next	;


desc
@Program to test wcsprt(), the high-level WCSLIB routine which prints the
contents of a wcsprm struct.
@


3.4
log
@WCSLIB 3.4
@
text
@/*============================================================================
*
*   WCSLIB 3.4 - an implementation of the FITS WCS convention.
*   Copyright (C) 1995-2004, Mark Calabretta
*
*   This program is free software; you can redistribute it and/or modify it
*   under the terms of the GNU General Public License as published by the
*   Free Software Foundation; either version 2 of the License, or (at your
*   option) any later version.
*
*   This program 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
*   General Public License for more details.
*
*   You should have received a copy of the GNU 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, CSIRO
*                      PO Box 76
*                      Epping NSW 1710
*                      AUSTRALIA
*
*=============================================================================
*
*   twcsprt tests wcsprt() which prints the contents of a wcsprm struct.
*
*   $Id: twcsprt.c,v 3.3 2003/10/21 08:10:05 mcalabre Exp mcalabre $
*---------------------------------------------------------------------------*/

#include <stdio.h>
#include <string.h>

#include <wcs.h>

#ifndef __STDC__
#ifndef const
#define const
#endif
#endif


/* In real life these would be encoded as FITS header cards. */
const int NAXIS = 4;
const double CRPIX[4] =  {  513.0,  0.0,  0.0,  0.0};
const double PC[4][4] = {{    1.1,  0.0,  0.0,  0.0},
                         {    0.0,  1.0,  0.0,  0.1},
                         {    0.0,  0.0,  1.0,  0.0},
                         {    0.0,  0.2,  0.0,  1.0}};
const double CDELT[4] =  {-9.635265432e-6,  1.0,  1.0, -1.0};

char CTYPE[4][9] = {"WAVE-F2W", "XLAT-SZP", "TIME    ", "XLON-SZP"};

const double CRVAL[4] =  {0.214982042, -30.0, -2e3, 150.0};
const double LONPOLE  = 150.0;
const double LATPOLE  = 999.0;
const double RESTFRQ  =   1.42040575e9;
const double RESTWAV  =   0.0;

int NPV;
struct pvcard PV[10];		/* Projection parameters are set in main(). */


int main()

{
   register int i, j;
   struct wcsprm wcs;
   double *pcij;

   /* Set the PVi_m cards for the latitude axes.               */
   PV[0].i = 2;			/* Latitude is on axis 2.      */
   PV[0].m = 1;			/* Parameter number 1.         */
   PV[0].value = 2.0;		/* PVi_1.                      */

   PV[1].i = 2;			/* Latitude is on axis 2.      */
   PV[1].m = 2;			/* Parameter number 2.         */
   PV[1].value = 210.0;		/* PVi_2.                      */

   PV[2].i = 2;			/* Latitude is on axis 2.      */
   PV[2].m = 3;			/* Parameter number 3.         */
   PV[2].value = 60.0;		/* PVi_3.                      */

   NPV = 3;

   wcs.flag = -1;
   wcsini(1, NAXIS, &wcs);

   for (j = 0; j < NAXIS; j++) {
      wcs.crpix[j] = CRPIX[j];
   }

   pcij = wcs.pc;
   for (i = 0; i < NAXIS; i++) {
      for (j = 0; j < NAXIS; j++) {
         *(pcij++) = PC[i][j];
      }
   }

   for (i = 0; i < NAXIS; i++) {
      wcs.cdelt[i] = CDELT[i];
   }

   for (i = 0; i < NAXIS; i++) {
      strcpy(wcs.ctype[i], &CTYPE[i][0]);
   }

   for (i = 0; i < NAXIS; i++) {
      wcs.crval[i] = CRVAL[i];
   }

   wcs.lonpole = LONPOLE;
   wcs.latpole = LATPOLE;

   wcs.restfrq = RESTFRQ;
   wcs.restwav = RESTWAV;

   wcs.npv = NPV;
   for (i = 0; i < NPV; i++) {
      wcs.pv[i] = PV[i];
   }

   /* Extract information from the FITS header. */
   (void) wcsset(&wcs);

   printf("\nTesting WCSLIB wcsprt() routine\n");
   printf("-------------------------------\n");
   printf("\nContents of wcsprm struct:\n");
   wcsprt(&wcs);

   printf("\nSize of structs (bytes/ints):\n");
   printf("     linprm:%4d /%4d\n", sizeof(struct linprm), LINLEN);
   printf("     celprm:%4d /%4d\n", sizeof(struct celprm), CELLEN);
   printf("     prjprm:%4d /%4d\n", sizeof(struct prjprm), PRJLEN);
   printf("     spcprm:%4d /%4d\n", sizeof(struct spcprm), SPCLEN);
   printf("     wcsprm:%4d /%4d\n", sizeof(struct wcsprm), WCSLEN);

   return 0;
}
@


3.3
log
@WCSLIB 3.3
@
text
@d3 2
a4 2
*   WCSLIB 3.3 - an implementation of the FITS WCS convention.
*   Copyright (C) 1995-2003, Mark Calabretta
d32 1
a32 1
*   $Id: twcsprt.c,v 3.2 2003/09/09 04:40:16 mcalabre Exp mcalabre $
@


3.2
log
@WCSLIB 3.2: set wcs.flag = -1 to initialize memory management in wcsini().
@
text
@d3 1
a3 1
*   WCSLIB 3.2 - an implementation of the FITS WCS convention.
d32 1
a32 1
*   $Id: twcsprt.c,v 3.1 2003/04/28 04:27:07 mcalabre Exp mcalabre $
@


3.1
log
@WCSLIB 3.1
Print the size of the various WCSLIB structs.
@
text
@d3 1
a3 1
*   WCSLIB 3.1 - an implementation of the FITS WCS convention.
d32 1
a32 1
*   $Id: twcsprt.c,v 3.0 2003/04/01 04:16:39 mcalabre Exp mcalabre $
d90 1
@


3.0
log
@WCSLIB 3.0
@
text
@d3 1
a3 1
*   WCSLIB 3.0 - an implementation of the FITS WCS convention.
d32 1
a32 1
*   $Id$
d133 7
@
