function gt_corner_cmd, item, header=header, string=string, short=short, spaces=spaces, x=x, y=y ; ;+ ;NAME: ; gt_corner_cmd ;PURPOSE: ; To extract the word corresponding to corner commanded and optionally ; return a string variable for that item. ;CALLING SEQUENCE: ; x = gt_corner_cmd(index) ; x = gt_corner_cmd(index.sxt, /space) ;put single space before string ; x = gt_corner_cmd(index, space=3) ;put 3 spaces ; x = gt_corner_cmd(index, /x) ;just return 1xN array of x corner ;METHOD: ; The input can be a structure or a scalar. The structure can ; only be the index. ;INPUT: ; item - A structure or scalar. It can be an array. ;OPTIONAL INPUT: ; string - If present, return the string mnemonic (long notation) ; short - If present, return the short string mnemonic ; spaces - If present, place that many spaces before the output ; string. ; x - If present, just return the x (column) shape ; y - If present, just return the y (lines) shape ;OUTPUT: ; returns - The corner commanded in CCD pixel coordinates, a integer value ; or a string value depending on the switches used. It is a ; vector if the input is a vector. The default is a 2xN array ; where N is the size of the roadmap or index array. If ; you use the /X or /Y options, it is 1xN. ;OPTIONAL OUTPUT: ; header - A string that describes the item that was selected ; to be used in listing headers. ;HISTORY: ; Written 23-Nov-91 by M.Morrison ; 23-Nov-92 (MDM) - Added correction during the extraction of FFI values ; 23-Jun-93 (MDM) - Added call to FOVC2CORN_CMD so that it can work with ; the roadmap ; 15-Aug-2008 (Aki Takeda) - Modified to accept FITS headers as input. ; (requires CORNE_C1, CORNE_C2 Keywords.) ;- ; header_array = ' X0,Y0 ' fmt = "(i3,',',i3)" ;7 characters ; siz = size(item) typ = siz( siz(0)+1 ) if (typ eq 8) then begin ; tags = tag_names(item) case 1 of (tag_exist(item,'GEN',/top)) : out = item.sxt.corner_cmd ; index (tag_exist(item,'SIMPLE',/top)) : $ out=transpose([[item.CORNE_C1],[item.CORNE_C2]]) ; FITS else : out = fovc2corn_cmd(item) ;roadmap end end else begin out = item end ; if (typ eq 8) then begin ;MDM added 23-Nov-92 pfi_ffi = gt_pfi_ffi(item, /ffi) ss = where(pfi_ffi eq 1) if (ss(0) ne -1) then begin ;because of error during reformatting out(0,ss) = out(0,ss)*4 out(1,ss) = out(1,ss)*4 end end else begin message, 'INDEX not passed so cannot correct FFI if necessary', /info end if (keyword_set(x)) then begin header_array = ' X0' fmt = "(i3)" out = out(0,*) end if (keyword_set(y)) then begin header_array = ' Y0' fmt = "(i3)" out = out(1,*) end out = gt_conv2str(out, conv2str, conv2short, header_array, header=header, $ string=string, short=short, spaces=spaces, fmt=fmt) ; return, out end