gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 470d4434: library (wcs.h): equinox also update


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 470d4434: library (wcs.h): equinox also updated in equatorial outputs
Date: Fri, 11 Nov 2022 13:53:36 -0500 (EST)

branch: master
commit 470d4434ab8460fdd855dda4e82ae5a6410c0ecb
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    library (wcs.h): equinox also updated in equatorial outputs
    
    Until now, when converting coordinate systems, the 'EQUINOX' keyword was
    not updated!
    
    With this commit, the year of the equinox is also updated as part of the
    conversion.
    
    This but was reported by Alejandro Serrano Borlaff.
    
    This fixes bug #63345.
---
 NEWS                         |  3 +++
 doc/announce-acknowledge.txt |  1 +
 lib/wcs.c                    | 18 +++++++++++-------
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/NEWS b/NEWS
index d7421177..d33eb8ba 100644
--- a/NEWS
+++ b/NEWS
@@ -74,6 +74,9 @@ See the end of the file for license conditions.
   bug #63340: Statistics printing zero for values smaller than 1e-6 and
               1e-14 for 32-bit or 64-bit floats respectively. Reported by
               Elham Saremi.
+  bug #63345: WCS coordinate change not accounting for new equinox (only
+              relevant for equatorial outputs). Reported by Alejandro
+              Serrano Borlaff.
 
 
 
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index 654805b2..7bb4529a 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -1,5 +1,6 @@
 Alphabetically ordered list to acknowledge in the next release.
 
+Alejandro Serrano Borlaff
 Sepideh Eskandarlou
 Giulia Golini
 Elham Saremi
diff --git a/lib/wcs.c b/lib/wcs.c
index 9332e6c2..0aef1ab7 100644
--- a/lib/wcs.c
+++ b/lib/wcs.c
@@ -960,18 +960,19 @@ wcs_coordsys_insys_pole_in_outsys(int insys, int outsys, 
double *lng2p1,
 
 
 static void
-wcs_coordsys_ctypes(int coordsys, char **clng, char **clat, char **radesys)
+wcs_coordsys_ctypes(int coordsys, char **clng, char **clat, char **radesys,
+                    double *equinox)
 {
   switch( coordsys)
     {
     case GAL_WCS_COORDSYS_EQB1950:
-      *clng="RA";   *clat="DEC";  *radesys="FK4"; break;
+      *clng="RA";   *clat="DEC";  *radesys="FK4"; *equinox=1950; break;
     case GAL_WCS_COORDSYS_EQJ2000:
-      *clng="RA";   *clat="DEC";  *radesys="FK5"; break;
+      *clng="RA";   *clat="DEC";  *radesys="FK5"; *equinox=2000; break;
     case GAL_WCS_COORDSYS_ECB1950:
-      *clng="ELON"; *clat="ELAT"; *radesys="FK4"; break;
+      *clng="ELON"; *clat="ELAT"; *radesys="FK4"; *equinox=1950; break;
     case GAL_WCS_COORDSYS_ECJ2000:
-      *clng="ELON"; *clat="ELAT"; *radesys="FK5"; break;
+      *clng="ELON"; *clat="ELAT"; *radesys="FK5"; *equinox=2000; break;
     case GAL_WCS_COORDSYS_GALACTIC:
       *clng="GLON"; *clat="GLAT"; *radesys=NULL;  break;
     case GAL_WCS_COORDSYS_SUPERGALACTIC:
@@ -1018,7 +1019,7 @@ gal_wcs_coordsys_convert(struct wcsprm *wcs, int 
outcoordsys)
                                     &lng2p1, &lat2p1, &lng1p2);
 
   /* Find the necessary CTYPE names of the output. */
-  wcs_coordsys_ctypes(outcoordsys, &clng, &clat, &radesys);
+  wcs_coordsys_ctypes(outcoordsys, &clng, &clat, &radesys, &equinox);
 
   /* Convert the WCS's coordinate system (if 'wcsccs' is available). */
 #if GAL_CONFIG_HAVE_WCSLIB_WCSCCS
@@ -1026,7 +1027,10 @@ gal_wcs_coordsys_convert(struct wcsprm *wcs, int 
outcoordsys)
   wcsccs(out, lng2p1, lat2p1, lng1p2, clng, clat, radesys, equinox, alt);
 #else
 
-  /* Just to avoid compiler warnings for 'equinox' and 'alt'. */
+  /* Just to avoid compiler warnings for 'equinox' and 'alt' (when WCSLIB
+     doesn't have the 'wcsccs' function): these will never be used: if
+     control comes here the function will abort! So don't worry about this
+     command having any kind of effect on the progrma. */
   if(alt) lng2p1+=equinox;
 
   /* Print error message and abort. */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]