[Top][All Lists]

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

[gnuastro-commits] master 8294b1d: Fits: warning printed with --pixelsca

From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 8294b1d: Fits: warning printed with --pixelscale and +4 dimensional data
Date: Sun, 13 Jun 2021 21:58:14 -0400 (EDT)

branch: master
commit 8294b1d02802d5506818e9322e22e83a73bc009a
Author: Mohammad Akhlaghi <>
Commit: Mohammad Akhlaghi <>

    Fits: warning printed with --pixelscale and +4 dimensional data
    Until now, when Fits was called with the '--pixelscale' option, the
    area/volume of pixels in the input dataset was only printed when the
    dataset had 2 or 3 dimensions, followed by a new-line. As a result, when
    there were more than three dimensions, no new-line would be printed,
    causing problems when it was called in a loop (outputs from different files
    would be printed on the same line).
    With this commit, when there are more than three dimensions and
    '--pixelscale' is called with '--quiet', it will only print the pixel
    scales and a new line (no volume or area information will be printed).
 bin/fits/fits.c   | 10 ++++++++++
 doc/gnuastro.texi |  1 +
 2 files changed, 11 insertions(+)

diff --git a/bin/fits/fits.c b/bin/fits/fits.c
index 9512105..87e62fe 100644
--- a/bin/fits/fits.c
+++ b/bin/fits/fits.c
@@ -398,6 +398,15 @@ fits_pixelscale(struct fitsparams *p)
                              "%g (arcsec^2*A)\n", multip, multip*3600*3600,
+              /* Higher-dimensional data are not yet supported. */
+              if(ndim>=4 && p->cp.quiet==0)
+                error(EXIT_SUCCESS, 0, "WARNING: the '--pixelscale' "
+                      "option only prints area/volume information for "
+                      "2 or 3 dimensional datasets, this dataset is "
+                      "%zu dimensions! If you need this feature, please "
+                      "contact '%s'. To suppress this warning, please "
+                      "run with '--quiet'", ndim, PACKAGE_BUGREPORT);
@@ -413,6 +422,7 @@ fits_pixelscale(struct fitsparams *p)
         case 2: printf("%g\n", multip); break;
         case 3: printf("%g %g\n", pixelscale[0]*pixelscale[1], multip); break;
+        default: printf("\n");
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 08cc670..46fff2b 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -9187,6 +9187,7 @@ These numbers are followed by the pixel area (in the raw 
WCS units).
 For 3D datasets, this will be area on each 2D slice.
 Finally, for 3D datasets, a final number (the voxel volume) is printed.
 As a summary, in @option{--quiet} mode, for 2D datasets three numbers are 
printed and for 3D datasets, 5 numbers are printed.
+If the dataset has more than 3 dimensions, only the pixel-scale values are 
printed (no area or volume will be printed).
 @item --skycoverage
 @cindex Image's sky coverage

reply via email to

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