View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Asthedit and sexstr

Ian Waite wrote on Jun 03, 2009

Hi,
I have, in my fits header, a keyword "UTC-OBS". The format in this keyword is ##:##:## If I use asthedit to write the information into another keyword (to be passed into a completely different script), such as "UTSTART", I use UTSTART = sexstr(@'UTC-OBS'). Without the sexstr it returns the decimal equivalent (#.######), so the need for the sexstr. If the UT is less than 10:00, it returns #:##:##. For example: UTC-OBS = 09:23:20. But UTSTART = 9:23:20. Is there anyway of forcing the UTSTART to be identical, in other words: 09:23:20. My other program falls over if it doesn't get the two digits in the hours. The simple way is to then use hedit for the few files that needs updating; but I was hoping to automate it a bit more (thereby less chance of errors!)
With thanks,
Ian Waite.

Mike Fitzpatrick wrote on Jun 03, 2009

You can use a simple command file to force the leading zero for values less than 10, e.g. create a file called 'cmds' containing


$test = @'utc-obs'
if ($test < 10.0)
    utstart = '0' // sexstr ($test)
else
    utstart = sexstr($test))
endif
quit    


You would then run it using the command

cl> asthedit *.fits cmds


Cheers,
-Mike

Ian Waite wrote on Jun 03, 2009

Thanks Mike, it works a treat!

Last post on Jun 03, 2009