[Top][All Lists]

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

[gnuastro-commits] master 00cf2dd: Warp: informative error message when

From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 00cf2dd: Warp: informative error message when input is a 3D cube
Date: Thu, 16 Jul 2020 16:24:37 -0400 (EDT)

branch: master
commit 00cf2dd3d3da0df248d3f9ea2becbe07b2619a41
Author: Mohammad Akhlaghi <>
Commit: Mohammad Akhlaghi <>

    Warp: informative error message when input is a 3D cube
    Until now, when the input to Warp was a 3D cube, it would produce an
    unreasonable output (because it is only designed for 2D images). Warp
    currently only complains about 3D images with the '--align' opertion.
    The new task #15729 has been defined for this job, but until it is done, we
    need to inform the users that Warp is not yet designed for 3D
    operations. So with this commit, an informative warning message is now
    printed and Warp is aborted.
    This bug was found by Leindert Boogaard.
    This fixes bug #58774.
 NEWS                         |  2 +-
 bin/warp/ui.c                | 13 +++++++++++++
 doc/announce-acknowledge.txt |  1 +
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 02c2aad..8bf882c 100644
--- a/NEWS
+++ b/NEWS
@@ -59,7 +59,7 @@ See the end of the file for license conditions.
   bug #58434: MakeCatalog crash when ordering is required and no usable pixels.
   bug #58455: Timezone is not portable and uses flag instead of seconds.
   bug #58696: Warp with --centeroncorner --scale making wrong size.
+  bug #58774: Warp' s output on a cube is a 2D image or wrong size.
diff --git a/bin/warp/ui.c b/bin/warp/ui.c
index e6a1a11..47f5bba 100644
--- a/bin/warp/ui.c
+++ b/bin/warp/ui.c
@@ -350,11 +350,24 @@ ui_check_options_and_arguments(struct warpparams *p)
                                              NULL, GAL_TYPE_FLOAT64,
+      /* Read the WCS and remove one-element wide dimension(s). */
       p->input->wcs=gal_wcs_read(p->inputname, p->cp.hdu, p->hstartwcs,
                                  p->hendwcs, &p->input->nwcs);
+      /* Currently Warp only works on 2D images. */
+      if(p->input->ndim!=2)
+        error(EXIT_FAILURE, 0, "input has %zu dimensions but Warp currently "
+              "only works on 2D datasets (images).\n\n"
+              "We do plan to add 3D functionality (see "
+              ", so please get in "
+              "touch if you need it (any further interest, support or help "
+              "would be useful)", p->input->ndim);
+      /* Get basic WCS information. */
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index 602c6ea..489ac99 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -2,6 +2,7 @@ Alphabetically ordered list to acknowledge in the next release.
 Marjan Akbari
 Carlos Allende Prieto
+Leindert Boogaard
 Alexey Dokuchaev
 Raúl Infante Sainz
 Zahra Sharbaf

reply via email to

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