Converting new type DATE-OBS to UT
tonisee wrote on May 14, 2008
Hello!
In the headers of my FITS files, only DATE-OBS keyword in the new format is presented, it is already in UTC, e.g.:
DATE-OBS = '2008-05-14T08:57:00'
Since many tasks need keyword UT, it's probably most easiest to write small CL script which parses DATE-OBS from files in @list and creates needed UT-keyword by subtracting part of the string after character T.
My question is: which would be the best way to do this?
I tried many combinations of imgets, hselect, substr and hedit but didn't get anything useful. I'll bet that the solution is something that simple that I just overlook it. :oops:
Best regards
Tõnis
In the headers of my FITS files, only DATE-OBS keyword in the new format is presented, it is already in UTC, e.g.:
DATE-OBS = '2008-05-14T08:57:00'
Since many tasks need keyword UT, it's probably most easiest to write small CL script which parses DATE-OBS from files in @list and creates needed UT-keyword by subtracting part of the string after character T.
My question is: which would be the best way to do this?
I tried many combinations of imgets, hselect, substr and hedit but didn't get anything useful. I'll bet that the solution is something that simple that I just overlook it. :oops:
Best regards
Tõnis
Mike Fitzpatrick wrote on May 14, 2008
See the thread at http://iraf.net/phpBB2/viewtopic.php?t=86096&highlight=dateobs++script for a discussion of this. To give away the ending, the SETAIRMASS task may do what you want by setting the 'utmiddle' parameter to load the UT keyword.
Cheers,
-Mike
Cheers,
-Mike
Francisco Valdes wrote on May 14, 2008
You might also look at ASTHEDIT. I'm not sure if it has a specific operation for what you want but it can probably do what you want since it is an expression evaluator that has many built-in operators.
Yours,
Frank Valdes
Yours,
Frank Valdes
tonisee wrote on May 14, 2008
After digging in forum, re-re-..-reading scripting manual and testing different approaches, I found following solution:
---------------------------------------------------------
list = "a.lst"
while (fscan(list, s1) !=EOF) {
imgets(s1,"DATE-OBS")
hedit (s1,"UT",substr(imgets.value,12,19), add+, ver-)
}
---------------------------------------------------------
I agree, that this solution is pretty limited (what happens when DATE-OBS contains fraction of seconds.. :wink:) but it does what I need. Plain CL-script works now very well when using cl < script.
Setairmass requires sidereal time keyword to be presented in the header. After creating this keyword, it is indeed possible to add UT or UTMIDDLE (default) keyword using setairmass. The problem is/was, that for computing ST, UT is needed ;-) In my case, only the DATE-keyword (containing both date and time) was in the FITS header and ST has to be computed more or less "manually", like:
hedit @a.lst st '(6.6974-(2451543.5-@"ljd")/15.21842447+1.764417+@"UT"*1.002738)' add+ ver-
Actually, I found that when my DATE-OBS keyword was in the form:
DATE-OBS= '2007-03-14T18:36:20' and i added UT-keyword manually as 18:36:20,
setairmass file.fits ut=ut update+ created UTMIDDLE as:
UTMIDDLE= '2007-03-14T18:41:20.00'
Seems that setairmass creates UTMIDDLE always in such format (and it is totally fine for UTMIDDLE keyword).
At the moment I would conclude: in similar situation, one can create UT keyword containing just time only with parsing strings.
Also, thank you very much for your answers
Tõnis
---------------------------------------------------------
list = "a.lst"
while (fscan(list, s1) !=EOF) {
imgets(s1,"DATE-OBS")
hedit (s1,"UT",substr(imgets.value,12,19), add+, ver-)
}
---------------------------------------------------------
I agree, that this solution is pretty limited (what happens when DATE-OBS contains fraction of seconds.. :wink:) but it does what I need. Plain CL-script works now very well when using cl < script.
Setairmass requires sidereal time keyword to be presented in the header. After creating this keyword, it is indeed possible to add UT or UTMIDDLE (default) keyword using setairmass. The problem is/was, that for computing ST, UT is needed ;-) In my case, only the DATE-keyword (containing both date and time) was in the FITS header and ST has to be computed more or less "manually", like:
hedit @a.lst st '(6.6974-(2451543.5-@"ljd")/15.21842447+1.764417+@"UT"*1.002738)' add+ ver-
Actually, I found that when my DATE-OBS keyword was in the form:
DATE-OBS= '2007-03-14T18:36:20' and i added UT-keyword manually as 18:36:20,
setairmass file.fits ut=ut update+ created UTMIDDLE as:
UTMIDDLE= '2007-03-14T18:41:20.00'
Seems that setairmass creates UTMIDDLE always in such format (and it is totally fine for UTMIDDLE keyword).
At the moment I would conclude: in similar situation, one can create UT keyword containing just time only with parsing strings.
Also, thank you very much for your answers
Tõnis
Last post on May 14, 2008