summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2022-11-11 19:31:55 +0100
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2022-11-11 19:31:55 +0100
commit470d4434ab8460fdd855dda4e82ae5a6410c0ecb (patch)
treeea0ccd8dd48217086f70ac9c9b191d3303548888
parentb7f09b8892ceaa4f7ed1768e35f24132e91ce1d6 (diff)
downloadgnuastro-470d4434ab.tar.gz
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.
-rw-r--r--NEWS3
-rw-r--r--doc/announce-acknowledge.txt1
-rw-r--r--lib/wcs.c18
3 files changed, 15 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index d742117..d33eb8b 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 654805b..7bb4529 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 9332e6c..0aef1ab 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. */