;+ ; NAME: ; O_ADDKEY ; ; PURPOSE: ; add keywords to OSIRIS raw files ; ; EXPLANATION: ; Usually for SSCALE as many DRP modules don't work without it ; ; CALLING SEQUENCE: ; o_addkey, add=string ; ; INPUTS: ; add - string to be added to the filename to avoid overwriting ; ; OUTPUTS: ; fits file - can overwrite existing file ; ; OPTIONAL OUPUTS: ; ; ; OPTIONAL INPUT KEYWORDS: ; filedir, filename, add, key, value, comment ; ; EXAMPLE: ; o_addkey, add='key' ; ; ERROR HANDLING: ; none. Be careful about messing with your fits headers! ; ; RESTRICTIONS: ; one file at a time ; ; NOTES: ; none ; ; PROCEDURES USED: ; Functions: o_make_filename ; fxaddpar ; ; MODIFICATION HISTORY: ; 2007 Jul 30 jlyke ORIGINAL ;- PRO O_ADDKEY, filedir=filedir, file=file, add=add, $ key=key, value=value, comment=comment if ( not keyword_set(filedir) ) then begin filedir = './' endif if ( not keyword_set(file) ) then begin file = dialog_pickfile( title='File to add keyword', $ filter='*.fits', $ get_path=new_path, $ /MUST_EXIST ) ; separate the directory from the filename filedir = new_path temp = strsplit(file, '/', /extract) filename = temp[n_elements(temp)-1] endif if ( keyword_set(add) ) then begin outfile = o_make_filename(filename, add) endif else begin outfile=filename endelse if ( not keyword_set(key) ) then begin key = 'SSCALE' endif if ( not keyword_set(value) ) then begin value = '0.035 ' endif if ( not keyword_set(comment) ) then begin comment = ' Spec scale' endif data = readfits(filedir+filename, data_hdr) noise = readfits(filedir+filename, exten_no = 1) qual = readfits(filedir+filename, exten_no = 2) zeroth = n_elements(data[*,0,0]) first = n_elements(data[0,*,0]) second = n_elements(data[0,0,*]) ; update the header info fxaddpar, data_hdr, key, value, comment ; write out the file writefits, filedir+outfile, data, data_hdr writefits, filedir+outfile, noise, /append writefits, filedir+outfile, qual, /append END