FUNCTION get_info2, item, infil=infil, noninteractive=noninteractive,$ longform=longform, itemnumber=itemnumber ;+ (9-Sep-94) ; NAME: ; get_info ; PURPOSE: ; Decode time and exposure information and return in a string array. ; INPUTS: ; item = a structure of roadmaps, index, or observing log entries ; OPTIONAL INPUT KEYWORDS: ; infil = The input SDA file name. If present, the routine ; prompts the user about writing an output file. ; noninteractive = If set, does not prompt user, but only returns ; the array. If infil is specified, the summary ; is written to an output file. ; longform = If set, also put out the percentage of the image ; which is available, and the heliocentric coord. ; itemnumber = If set, will compute the relative item number ; from this starting value. If a vector is passed, ; these values will be used instead of the default ; relative item number. ; OUTPUTS: ; Returned is a string array containing various information. ; HISTORY: ; Written, 18-sep-91, JRL ; Updated, 19-sep-91, JRL: Added noninteractive switch. ; Updated, 7-Nov-91, MDM: Used a different printed format ; Updated, 13-Nov-91, MDM - Used all "GT" routines so that it can be ; used with index as well as roadmap ; - Added DP_MODE/DP_RATE and changed to use ; DPE and printed the duration ; 17-Apr-92 (MDM) - Added compression in short notation ; 10-Oct-93 (MDM) - Added /ORIG switch to GT_RES so that this ; listing is always listing the original resolution ; 28-Oct-93 (MDM) - Added /LONGFORM option ; 9-Dec-93 (MDM) - Added SAA and TIM2NIGHT in the /LONG option ; 9-Sep-94 (GAL) - Added itemnumber=start_index switch so that the ; first number in the listings can be manually set ; to values other than the relative item number. ; 12-Jan-2012 (Aki Takeda) - Modified to accept Hinode/XRT headers. ; 1-Feb-2012 (Aki T) - minor bug fix. ;- ------------------------------------------------------------------------ ; ;MDM added starting here ; n = n_elements(item) if (n_elements(itemnumber) ne 0) then begin if (n_elements(itemnumber) eq 1) then begin iitem = indgen(n)+itemnumber endif else begin ; vector of item numbers if (n_elements(itemnumber) eq n) then iitem = itemnumber endelse endif else begin ; default relative item numbers iitem = indgen(n) endelse ; tags = tag_names(item) chk=tag_exist(item,'instrume') if chk eq 1 then inst=gt_tagval(item,'instrume') else inst=' ' ; *** handle Hinode/XRT case *** if (tags(0) eq 'SIMPLE') and (inst(0) eq 'XRT') then begin info_array = gt_conv2str(iitem, fmt='(i4)', /str) + ' ' + $ gt_day(item,/str,/y2k) + ' ' + gt_time(item,/str)+ ' ' + $ gt_filt1(item, space=2,/short) + '/' + $ gt_filt2(item, /string,/short) + ' ' + $ string(gt_exptime(item),format='(f8.4)')+' '+ $ strtrim(string(gt_tagval(item,'naxis1')),2)+'x'+ $ strtrim(string(gt_tagval(item,'naxis2')),2) if (keyword_set(longform)) then $ print,'Long form not available for XRT header.' ;---------------- endif else begin ; *** Yohkoh/SXT cases *** ;---------------- info_array = gt_conv2str(iitem, fmt='(i4)', /str) + ' ' + $ gt_day(item,/str,/y2k) + ' ' + gt_time(item,/str)+ ' ' + $ gt_dp_mode(item, space=2, /short) + '/' + gt_dp_rate(item, /string, /short) + $ gt_filta(item, space=2) + '/' + gt_filtb(item, /string) + $ gt_res(item, /space, /orig) + $ gt_expmode(item, /space) + gt_comp(item, /short, /space) + $ gt_dpe(item, /space) + gt_dpe(item, /str, /conv) + $ gt_shape_cmd(item, /space) ; if (keyword_set(longform)) then begin cen_str = gt_center(item,/cmd,/str,/helio) ss = where(gt_pfi_ffi(item, /true_ffi)) if (ss(0) ne -1) then cen_str(ss) = 'Full D' tim2orbit, item, saa=saa, tim2night=tim2night saa_str = strarr(n) + ' ' ss = where(saa) if (ss(0) ne -1) then saa_str(ss) = ' SAA' night_str = strarr(n) for i=0,n-1 do night_str(i) = string(tim2night(i), format='(f5.1)') info_array = info_array + $ gt_percentd(item, space=2) + ' ' + $ cen_str + gt_percentover(item, /space) + saa_str + night_str end ;-------- endelse ;-------- ; ;MDM idx2list,roadmap,['time','day','periph','explevmode','shape_cmd'],info_array ;MDM for i = 0,n_elements(info_array)-1 do info_array(i) = string(i,format='(i5)')+' '+info_array(i) ; Echo the information to the screen: if not keyword_set(noninteractive) then begin i = 0 & ans='' while i le n_elements(info_array)-1 do begin print,info_array(i) if ((i+1) mod 20) eq 0 then begin print,' ' & print,'',format='($,30x,a)' ans = get_kbrd(1) ; Get a character print,' ' if strupcase(strmid(ans,0,1)) eq 'Q' then i=n_elements(info_array) endif i=i+1 endwhile print,'Total Number of Images = ',n_elements(Info_array) endif ; not keyword_set(noninteractive) ; If infil is present, ask user if he wants to print the file: if n_elements(infil) ne 0 then begin if not keyword_set(noninteractive) then begin print,'* Write info_array to a file on your home directory? [def=N]',$ format='($,a)' ans = '' & read,ans,format='(a)' ; interactive mode and infil supplied endif else ans = 'Y' ; /noninter and infil supplied endif else ans = 'N' ; infil not supplied ; Write the data to a file if requested to do so if strmid(strupcase(ans),0,1) eq 'Y' then begin outfil = '~/log'+infil ; Write to user's home dir print,' Writing data to: ',outfil openw,lun,outfil,/get_lun printf,lun,infil for i=0,n_elements(info_array)-1 do printf,lun,info_array(i) free_lun,lun endif return,info_array end