;------------------------------------------------------------- ; $Id: ctm_print_datainfo.pro,v 1.12 1999/03/24 04:17:41 mgs Exp $ ;+ ; NAME: ; CTM_PRINT_DATAINFO ; ; PURPOSE: ; Create and print a formatted list of DATAINFO records. ; This procedure can be used for direct printing, but it ; can also return a string array of the formatted output ; e.g. for use in a widget list. ; ; CATEGORY: ; CTM Tools ; ; CALLING SEQUENCE: ; CTM_PRINT_DATAINFO,DATAINFO [,keywords] ; ; INPUTS: ; DATAINFO -> One or more DATAINFO records, e.g. the result ; from CTM_GET_DATA. ; ; KEYWORD PARAMETERS: ; FIELDS -> (*** not yet implemented ***) A list of fields ; (structure tag names) to be printed. Default is ; CATEGORY, ILUN, TRACERNAME, TRACERNUMBER, ; UNIT, TAU0, STATUS, DIMENSIONS ; FIELDS can also include tags from the (global) FILEINFO ; structure (e.g. FILENAME). ; ; OUTPUT -> A named variable that will contain a string array ; with the formatted output including the title line but ; without the seperating lines. The title is not included ; if keyword /NOTITLE is set. ; ; /NOPRINT -> Don't print, only return formatted strings ; ; /NOTITLE -> Do not generate title line (will neither be printed ; nor included in OUTPUT. ; ; OUTPUTS: ; ; SUBROUTINES: ; ; REQUIREMENTS: ; ; NOTES: ; ; EXAMPLE: ; CTM_GET_DATA,DataInfo,File='',tracer=2 ; CTM_PRINT_DATAINFO,DataInfo ; ; *or* ; CTM_PRINT_DATAINFO,DataInfo,Output=r,/NOPRINT ; ; MODIFICATION HISTORY: ; mgs, 10 Nov 1998: VERSION 1.00 ; bmy, 11 Feb 1999: VERSION 1.01 ; - adjust format for double-precision TAU0 ; mgs, 16 Mar 1999: - added tracer number and removed STATUS ; - made cosmetic changes ; mgs, 23 Mar 1999: - print dimension as NA if not yet available ; ;- ; Copyright (C) 1998, 1999, Martin Schultz and Bob Yantosca, ; Harvard University ; This software is provided as is without any warranty ; whatsoever. It may be freely used, copied or distributed ; for non-commercial purposes. This copyright notice must be ; kept with any copy of this software. If this software shall ; be used commercially or sold as part of a larger package, ; please contact the author to arrange payment. ; Bugs and comments should be directed to mgs@io.harvard.edu ; or bmy@io.harvard.edu, with subject "IDL routine ctm_print_datainfo" ;------------------------------------------------------------- pro ctm_print_datainfo,DataInfo,fields=fields, $ output=output,noprint=noprint,notitle=notitle ; *** (fields keyword not yet implemented) *** seperator = string(replicate('-',60),format='(60A1)') if (n_elements(DataInfo) eq 0) then begin message,'No data records in DATAINFO!',/Continue return endif ; ================================================================ ; print title line and loop through datainfo records ; We compose a string array so that it can be returned e.g. for ; a widget list item ; ================================================================ if (not keyword_set(noprint)) then print,seperator s = ' CATEGORY ILUN TRACERNAME TRC UNIT TAU0 DIMENSIONS' for i=0,n_elements(DataInfo)-1 do begin dims = '' for j=0,2 do begin if (DataInfo[i].dim[j] gt 0) then $ dims = dims + string(DataInfo[i].dim[j],format='(i3)') $ else $ dims = dims + ' NA' endfor s = [ s , string(DataInfo[i].category, $ DataInfo[i].ilun, $ DataInfo[i].tracername, $ DataInfo[i].tracer, $ DataInfo[i].unit, $ DataInfo[i].tau0, $ dims, $ format='(A9,1X,I4,1X,A10,I4,1X,A6,1X,F9.2,1X,A)') ] endfor if (keyword_set(NOTITLE)) then s = s[1:*] output = s if (not keyword_set(NOPRINT) ) then begin ; loop necessary because of extra blanks otherwise for i=0,n_elements(s)-1 do print,s[i] print,seperator endif return end