diff -ur wcstools-3.8.1/libwcs/wcs.c wcstools-3.8.1.new/libwcs/wcs.c --- wcstools-3.8.1/libwcs/wcs.c 2008-02-27 20:07:29.000000000 +0100 +++ wcstools-3.8.1.new/libwcs/wcs.c 2010-02-03 18:44:51.000000000 +0100 @@ -1,8 +1,8 @@ /*** File libwcs/wcs.c - *** July 25, 2007 + *** February 3, 2010 *** By Doug Mink, dmink@cfa.harvard.edu *** Harvard-Smithsonian Center for Astrophysics - *** Copyright (C) 1994-2007 + *** Copyright (C) 1994-2010 *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA This library is free software; you can redistribute it and/or @@ -90,7 +90,6 @@ static char wcserrmsg[80]; static char wcsfile[256]={""}; static void wcslibrot(); -void wcsrotset(); static int wcsproj0 = 0; static int izpix = 0; static double zpix = 0.0; @@ -334,7 +333,6 @@ int i, iproj; int nctype = 32; char ctypes[32][4]; - char dtypes[10][4]; /* Initialize projection types */ strcpy (ctypes[0], "LIN"); @@ -370,27 +368,28 @@ strcpy (ctypes[30], "PLT"); strcpy (ctypes[31], "TNX"); - /* Initialize distortion types */ - strcpy (dtypes[1], "SIP"); + /* First coordinate type */ if (!strncmp (ctype1, "LONG",4)) strncpy (ctype1, "XLON",4); - strcpy (wcs->ctype[0], ctype1); - strcpy (wcs->c1type, ctype1); - strcpy (wcs->ptype, ctype1); - /* Linear coordinates */ - if (!strncmp (ctype1,"LINEAR",6)) + if (!strncmp (ctype1,"LINEAR",6)) { wcs->prjcode = WCS_LIN; + strcpy (wcs->ctype[0], "LINEAR"); + } /* Pixel coordinates */ - else if (!strncmp (ctype1,"PIXEL",6)) + else if (!strncmp (ctype1,"PIXEL",5)) { wcs->prjcode = WCS_PIX; + strcpy (wcs->ctype[0], "PIXEL"); + } /*Detector pixel coordinates */ - else if (strsrch (ctype1,"DET")) + else if (strsrch (ctype1,"DET")) { wcs->prjcode = WCS_PIX; + strcpy (wcs->ctype[0], "PIXEL"); + } /* Set up right ascension, declination, latitude, or longitude */ else if (ctype1[0] == 'R' || ctype1[0] == 'D' || @@ -483,9 +482,13 @@ /* If not sky coordinates, assume linear */ else { wcs->prjcode = WCS_LIN; + strcpy (wcs->ctype[0], "LINEAR"); return (0); } + strcpy (wcs->c1type, wcs->ctype[0]); + strcpy (wcs->ptype, wcs->ctype[0]); + /* Second coordinate type */ if (!strncmp (ctype2, "NPOL",4)) { ctype2[0] = ctype1[0]; @@ -503,16 +506,18 @@ } else wcs->latbase = 0; - strcpy (wcs->ctype[1], ctype2); - strcpy (wcs->c2type, ctype2); /* Linear coordinates */ - if (!strncmp (ctype2,"LINEAR",6)) + if (!strncmp (ctype2,"LINEAR",6)) { wcs->prjcode = WCS_LIN; + strcpy (wcs->ctype[1], "LINEAR"); + } /* Pixel coordinates */ - else if (!strncmp (ctype2,"PIXEL",6)) + else if (!strncmp (ctype2,"PIXEL",5)) { wcs->prjcode = WCS_PIX; + strcpy (wcs->ctype[1], "PIXEL"); + } /* Set up right ascension, declination, latitude, or longitude */ else if (ctype2[0] == 'R' || ctype2[0] == 'D' || @@ -564,7 +569,9 @@ /* If not sky coordinates, assume linear */ else { wcs->prjcode = WCS_LIN; + strcpy (wcs->ctype[1], "LINEAR"); } + strcpy (wcs->c2type, wcs->ctype[1]); /* Set distortion code from CTYPE1 extension */ setdistcode (wcs, ctype1); @@ -2934,4 +2941,7 @@ * Feb 23 2007 Fix bug when checking for "DET" in CTYPEi * Apr 2 2007 Fix PC to CD matrix conversion * Jul 25 2007 Compute distance between two coordinates using d2v3() + * + * Jan 11 2010 Move declaration of wcsrotset() to wcs.h + * Feb 3 2010 Fix wcstype() to copy only first 8 char of CTYPEs into wcs */ diff -ur wcstools-3.8.1/libwcs/wcsinit.c wcstools-3.8.1.new/libwcs/wcsinit.c --- wcstools-3.8.1/libwcs/wcsinit.c 2009-03-24 20:58:36.000000000 +0100 +++ wcstools-3.8.1.new/libwcs/wcsinit.c 2010-02-03 18:46:16.000000000 +0100 @@ -1,8 +1,8 @@ /*** File libwcs/wcsinit.c - *** March 24, 2009 + *** February 3, 2010 *** By Doug Mink, dmink@cfa.harvard.edu *** Harvard-Smithsonian Center for Astrophysics - *** Copyright (C) 1998-2009 + *** Copyright (C) 1998-2010 *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA This library is free software; you can redistribute it and/or @@ -50,7 +50,6 @@ static void wcseq(); static void wcseqm(); static void wcsioset(); -void wcsrotset(); char wcschar(); /* set up a WCS structure from a FITS image header lhstring bytes long @@ -243,9 +242,6 @@ int nax; int twod; int iszpx = 0; - extern int tnxinit(); - extern int platepos(); - extern int dsspos(); wcs = (struct WorldCoor *) calloc (1, sizeof(struct WorldCoor)); @@ -423,25 +419,23 @@ ctype2[7] = 'N'; } } - strcpy (wcs->ctype[0], ctype1); - strcpy (wcs->ctype[1], ctype2); if (strsrch (ctype2, "LAT") || strsrch (ctype2, "DEC")) ilat = 2; else ilat = 1; - /* Read third and fourth coordinate types, if present */ - strcpy (wcs->ctype[2], ""); - hgetsc (hstring, "CTYPE3", &mchar, 9, wcs->ctype[2]); - strcpy (wcs->ctype[3], ""); - hgetsc (hstring, "CTYPE4", &mchar, 9, wcs->ctype[3]); - /* Set projection type in WCS data structure */ if (wcstype (wcs, ctype1, ctype2)) { wcsfree (wcs); return (NULL); } + /* Read third and fourth coordinate types, if present */ + strcpy (wcs->ctype[2], ""); + hgetsc (hstring, "CTYPE3", &mchar, 9, wcs->ctype[2]); + strcpy (wcs->ctype[3], ""); + hgetsc (hstring, "CTYPE4", &mchar, 9, wcs->ctype[3]); + /* Get units, if present, for linear coordinates */ if (wcs->prjcode == WCS_LIN) { if (!hgetsc (hstring, "CUNIT1", &mchar, 16, wcs->units[0])) { @@ -1380,4 +1374,7 @@ * Jun 27 2008 If NAXIS1 and NAXIS2 not present, check for IMAGEW and IMAGEH * * Mar 24 2009 Fix dimension bug if NAXISi not present (fix from John Burns) + * + * Jan 11 2010 Move all external declarations to header files + * Feb 3 2010 Do not copy CTYPE1 and CTYPE2 into wcs structure directly */