[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 53137ee: Fits: Check for --datetosec, in case
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 53137ee: Fits: Check for --datetosec, in case keyword couldn't be read |
Date: |
Sat, 30 Mar 2019 18:41:21 -0400 (EDT) |
branch: master
commit 53137eea941e5d35f35e9a2eea1f45fa178045c6
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
Fits: Check for --datetosec, in case keyword couldn't be read
We recently added the `--datetosec' option to convert the date to the Unix
epoch time (in seconds). However, there was no check to see if the keyword
value could be read or not: causing confusing errors when the given keyword
didn't exist.
With this commit, a check has been added and Fits will crash when CFITSIO
couldn't parse the given keyword's value.
---
NEWS | 9 +++++----
bin/fits/keywords.c | 3 ++-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/NEWS b/NEWS
index 8456a8f..289ad44 100644
--- a/NEWS
+++ b/NEWS
@@ -36,10 +36,11 @@ GNU Astronomy Utilities NEWS -*-
outline -*-
Fits:
- Add "title" to group FITS keywords with `--write=/,"title name". This
- "title" is composed of two keyword records: a blank one, followed by
- another starting with `/' and ending in any string given to this
- option. Classifying the keywords into contextually similar groups
- greatly helps in visual inspection and is encouraged.
+ "title" is composed of two keyword records/lines: a blank one (all
+ whitespace), followed by another starting with `/' and ending in any
+ string given to this option. This visually separates the keywords and
+ acts as a title. Classifying the keywords into contextually similar
+ groups greatly helps in visual inspection and is encouraged.
- Calculate and write `CHECKSUM' and `DATASUM' integrity keywords into
the specified header using `--write=checksum' (for both) or
`--write=datasum' (only for `DATASUM').
diff --git a/bin/fits/keywords.c b/bin/fits/keywords.c
index 2220113..61bb435 100644
--- a/bin/fits/keywords.c
+++ b/bin/fits/keywords.c
@@ -407,7 +407,8 @@ keywords_date_to_seconds(struct fitsparams *p, fitsfile
*fptr)
char fitsdate[FLEN_KEYWORD];
/* Read the requested FITS keyword. */
- fits_read_key(fptr, TSTRING, p->datetosec, &fitsdate, NULL, &status);
+ if( fits_read_key(fptr, TSTRING, p->datetosec, &fitsdate, NULL, &status) )
+ gal_fits_io_error(status, NULL);
/* Return the number of seconds (and subseconds) that it corresponds
to. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master 53137ee: Fits: Check for --datetosec, in case keyword couldn't be read,
Mohammad Akhlaghi <=