function gt_shape_cmd, item, header=header, string=string, short=short, spaces=spaces, x=x, y=y ; ;+ ;NAME: ; gt_shape_cmd ;PURPOSE: ; To extract the word corresponding to shape commanded and optionally ; return a string variable for that item. ;CALLING SEQUENCE: ; x = gt_shape_cmd(roadmap) ; x = gt_shape_cmd(index) ; x = gt_shape_cmd(index.sxt, /space) ;put single space before string ; x = gt_shape_cmd(index, space=3) ;put 3 spaces ; x = gt_shape_cmd(roadmap, /x) ;just return 1xN array of x shape ;METHOD: ; The input can be a structure or a scalar. The structure can ; be the index, or roadmap, or observing log. ;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 shape commanded, 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 13-Nov-91 by M.Morrison ; 22-Nov-91 (MDM) - Added "x" and "y" options ; 2-Jun-93 (MDM) - Made the output scalar if one element ; 1-Feb-2007 (Aki Takeda) - Modified to accept YLA FITS headers. ; Tag values (NAXIS1, NAXIS2) are used, instead of ; SHAPE_CM, which is truncated to scalar. ; 15-Aug-2008 (AkT) - Modified to use new YLA FITS keywords, ; (SHAPE_C1, SHAPE_C2) if exist. It not exist, ; (NAXIS1, NAXIS2) are used to avoid halt. ; - use TAG_EXIST function. ;- ; header_array = ' NX x NY' fmt = "(i4,'x',i3)" ;8 characters ; siz = size(item) typ = siz( siz(0)+1 ) if (typ eq 8) then begin ;Check to see if an index was passed (which has the "periph" tag ;nested under "sxt", or a roadmap or observing log entry was ;passed ; tags = tag_names(item) case 1 of ; (1-Feb-2007, AkT) (tag_exist(item,'GEN',/top)) : out = item.sxt.shape_cmd ; (17-Aug-2008, AkT) (tag_exist(item,'SIMPLE',/top)) : begin ; (17-Aug-2008, AkT) if (tag_exist(item,'SHAPE_C1',/top)) then $ ; (17-Aug-2008, AkT) out=transpose([[item.SHAPE_C1],[item.SHAPE_C2]]) $ ; (17-Aug-2008, AkT) else out=transpose([[item.NAXIS1],[item.NAXIS2]]) ; (17-Aug-2008, AkT) end else : out = item.shape_cmd ; (1-Feb-2007, AkT) endcase ; (1-Feb-2007, AkT) end else begin out = item end ; if (keyword_set(x)) then begin header_array = ' NX ' fmt = "(i4)" out = reform(out(0,*)) end if (keyword_set(y)) then begin header_array = ' NY' fmt = "(i3)" out = reform(out(1,*)) end out = gt_conv2str(out, conv2str, conv2short, header_array, header=header, $ string=string, short=short, spaces=spaces, fmt=fmt) ; if (n_elements(out) eq 1) then out = out(0) ;MDM added 2-Jun-93 ; return, out end