pro gte_makebin,filename,data,header,units,ADD_TIME=ADD_TIME,_extra=e ; raw structure for program converting a data array into a binary file ; data must be as read with readdata.pro (vars, obs) ; mgs, 04/27/99 ; _EXTRA keywords passed to GTE_WRITEBIN: ; EXPERIMENT_NAME -> A string containing the name of the experiment. ; This should not be longer than 40 characters since it will ; be stored together with EXPERIMENT_NUMBER, ORIGINAL_FILE, ; and REVISION_DATE as first comment line. ; ; EXPERIMENT_NUMBER -> number of the experiment or flight number ; ; EXPERIMENT_DATE -> date of experiment ; ; ORIGINAL_FILE -> filename of original ASCII file ; ; REVISION_DATE -> data revision date as contained in the ; file descriptor of a GTE ASCII file. ; ; COMMENTS -> A string (array) with comments to be stored in the ; file. If any of the above four keywords is supplied, it ; will be added to comments as first line. if (n_elements(header) eq 0) then begin print,'gte_makebin: USAGE gte_makebin,filename,data,header,units' return endif ; add dummy time variables to data if requested if (keyword_set(ADD_TIME)) then begin jday = 0.*data[0,*] starth = 0.*data[0,*] starts = transpose( findgen(n_elements(data[0,*])) ) stops = starts + 1. tmpdata = [ jday, starth, starts, stops ] tmpdata = transpose( [ tmpdata, data ] ) tmpheader = [ 'JDAY', 'STARTHOUR', 'STARTSEC', 'STOPSEC', header ] endif else begin tmpdata = transpose(data) tmpheader = header endelse ; create dummy units if not given if (n_elements(units) eq 0) then units = replicate('unknown',n_elements(tmpheader)) ; create variable descriptors vardesc = gte_vardesc(n_elements(tmpheader)) vardesc.name = tmpheader vardesc.unit = units ; rename ALT to ALTP ind = where(tmpheader eq 'ALT') if (ind[0] ge 0) then vardesc[ind].name = 'ALTP' ; convert missing code to binary standard ind = where(tmpdata eq -9.999 OR tmpdata eq -9.9999 OR tmpdata eq -99.999 $ OR tmpdata eq -999.9 OR tmpdata eq -999.99) if (ind[0] ge 0) then tmpdata[ind] = -9.99E30 ; get data range for i=0,n_elements(tmpheader)-1 do begin okind = where(tmpdata[*,i] ne -9.99E30) dmin = min(data[okind,i],max=dmax) vardesc[i].range = [dmin, dmax] endfor ; help,vardesc,tmpdata gte_writebin,filename,tmpdata,vardesc,_extra=e return end