;+ ; NAME: sixty_string ; PURPOSE: ; Like the Goddard library's "sixty" but it returns strings of the ; format "DD:MM:SS". ; ; This is the inverse of ten_string. ; ; INPUTS: one can provide input in two ways: ; ; output = sixty_string( deg, min, sec) ; in which case the inputs are just concatenated and ; printed out as a string ; ; output = sixty_string( decimal_degrees ) ; in which case the input is passed to sixty(), and ; the output is concatenated and printed ; ; KEYWORDS: ; delim= Delimiter. Default is space ; /ROUND round seconds to an integer value ; /sign always print + or - (for declination) ; OUTPUTS: ; ; HISTORY: ; Began 2004-06-05 02:40:25 by Marshall Perrin ; 2004-07-01 Output format cleaned up slightly ; 2006-04-27 Default is now space as a delimiter, not colon ; 2006-05-30 Format hours/degrees with a leading 0 for single digits ; 2006-06-26 Added extra format code for negatives ;- function sixty_string,scalar1,scalar2,scalar3,noseconds=noseconds,$ round=round,delim=delim round=round,space=space,sectwo=sectwo,delim=delim, sign=sign if n_params() eq 3 then begin vec = [scalar1,scalar2,scalar3] endif else begin vec = sixty(scalar1) endelse if keyword_set(round) then secformat = '(I02.2)' else secformat = '(F06.3)' if ~(keyword_set(delim)) then delim= ' ' ;if keyword_set(sign) then sn = "+" else sn="" ;if vec[0] lt 0 then firstfmt = '(I03)' else firstfmt ='(I02)' if vec[0] gt 0 and ~(keyword_set(sign)) then firstfmt ='(I02)' else firstfmt = '(I+03)' ; regular version if ~(keyword_set(noseconds)) then $ return,string(fix(vec[0]),format=firstfmt)+delim+string(vec[1],format='(I02.2)')+ delim+string(vec[2],format=secformat) ; no seconds version if vec[0] lt 0 then $ return,string(fix(vec[0]),format=firstfmt)+delim+string(vec[1],format='(I02.2)') end