[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 34f0944: Arithmetic: --wcsfile option accepts
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 34f0944: Arithmetic: --wcsfile option accepts a none value |
Date: |
Sun, 5 Apr 2020 12:00:59 -0400 (EDT) |
branch: master
commit 34f0944805bb43a977d18a54e1a252ade446a561
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
Arithmetic: --wcsfile option accepts a none value
Until now there was no clean way to remove the WCS of a given FITS
file. With this commit, the Arithmetic program's `--wcsfile' option can be
given a value of `none'. In this situation, no WCS will be read/written in
the output.
---
NEWS | 1 +
bin/arithmetic/operands.c | 4 +++-
bin/arithmetic/ui.c | 4 ++--
doc/gnuastro.texi | 2 ++
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index 9d44ada..cd07f34 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ See the end of the file for license conditions.
Arithmetic:
- New `quantile' operator for coadding datasets.
- New `size' operator to report length of dataset in requested dimension.
+ - When `--wcsfile' is given the value `none', output will not have any WCS.
CosmicCalculator:
--listlines: list the pre-defined spectral line wavelengths and names
diff --git a/bin/arithmetic/operands.c b/bin/arithmetic/operands.c
index 9dd9b00..f50528a 100644
--- a/bin/arithmetic/operands.c
+++ b/bin/arithmetic/operands.c
@@ -267,6 +267,7 @@ operands_copy_named(struct arithmeticparams *p, char *name)
void
operands_add(struct arithmeticparams *p, char *filename, gal_data_t *data)
{
+ int readwcs;
size_t ndim, *dsize;
struct operand *newnode;
@@ -308,7 +309,8 @@ operands_add(struct arithmeticparams *p, char *filename,
gal_data_t *data)
/* If no WCS is set yet, use the WCS of this image and remove
possibly extra dimensions if necessary. */
- if(p->refdata.wcs==NULL)
+ readwcs = (p->wcsfile && !strcmp(p->wcsfile,"none")) ? 0 : 1;
+ if(readwcs && p->refdata.wcs==NULL)
{
dsize=gal_fits_img_info_dim(filename, newnode->hdu, &ndim);
p->refdata.wcs=gal_wcs_read(filename, newnode->hdu, 0, 0,
diff --git a/bin/arithmetic/ui.c b/bin/arithmetic/ui.c
index ad5a59b..f5c0547 100644
--- a/bin/arithmetic/ui.c
+++ b/bin/arithmetic/ui.c
@@ -232,7 +232,7 @@ parse_opt(int key, char *arg, struct argp_state *state)
static void
ui_read_check_only_options(struct arithmeticparams *p)
{
- if(p->wcsfile)
+ if(p->wcsfile && strcmp(p->wcsfile,"none"))
{
if(gal_fits_name_is_fits(p->wcsfile)==0)
error(EXIT_FAILURE, 0, "%s: file given to `--wcsfile' must be in "
@@ -362,7 +362,7 @@ ui_preparations(struct arithmeticparams *p)
/* In case a file is specified to read the WCS from (and ignore input
datasets), read the WCS prior to starting parsing of the arguments. */
- if(p->wcsfile)
+ if(p->wcsfile && strcmp(p->wcsfile,"none"))
{
/* Read the number of dimensions and the size of each. */
dsize=gal_fits_img_info_dim(p->wcsfile, p->wcshdu, &ndim);
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 6732ae5..f74f009 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -9275,6 +9275,8 @@ When this option is called multiple times, it is possible
to output one column m
FITS file that contains the WCS to be used in the @code{wcstoimg} and
@code{imgtowcs} operators of @option{--column} (see above).
The extension name/number within the FITS file can be specified with
@option{--wcshdu}.
+If the value to this option is @option{none}, no WCS will be written in the
output.
+
@item -W STR
@itemx --wcshdu=STR
FITS extension/HDU that contains the WCS to be used in the @code{wcstoimg} and
@code{imgtowcs} operators of @option{--column} (see above).
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master 34f0944: Arithmetic: --wcsfile option accepts a none value,
Mohammad Akhlaghi <=