function rdascii,lu,flnm,frame ; ; Read data from ascii file flnm, and return a frame structure: ; ; Four line header, to be used later as follows: ; line 1: top label ; line 2: x-axis label ; line 3: y-axis label ; line 4: bottom label ; on_ioerror,bad if (eof(lu)) then return,2 hdr = strarr(4) line = '' line = string(line,format="(a80)") nx=1 & ny=1 for i=0,3 do begin readf,lu,line hdr(i) = strtrim(line,2) endfor ; ; nx, xx: ; readf,lu,line nx = 0 reads,line,nx,format="(3x,i4)" xlab = '' reads,line,xlab,format="(10x,a16)" xlab = strtrim(xlab) xx = fltarr(nx) if (nx gt 1) then readf,lu,xx ; ; ny, yy: ; readf,lu,line ny = 0 reads,line,ny,format="(3x,i4)" ylab = '' reads,line,ylab,format="(10x,a16)" ylab = strtrim(ylab) yy = fltarr(ny) if (ny gt 1) then readf,lu,yy ; ; Now the data: ; zz = fltarr(nx,ny) readf,lu,zz ; ; Gonzalo files are line plots w/ ut on x-axis, field on y-axis ; at selected locations. Get lat,lon and loc name from hdr1: ; reads,hdr(1),glat,glon,format="(4x,f5.1,5x,f6.1)" locname = '' ; locname is 1st string in parens in hdr(1): open_paren = strpos(hdr(1),'(') close_paren = strpos(hdr(1),')') locname = strmid(hdr(1),open_paren+1,close_paren-open_paren-1) loccode = '' case locname of 'Fritz Peak': loccode = 'FPO' 'Mt.Johns' : loccode = 'MJO' else : print,'rdascii: unknown locname: ',locname endcase fname = strtrim(hdr(0)) sname = '' case fname of 'GREENLINE EMISSION (E5577) (RAYLEIGHS)': sname = 'E5577' 'E5577 DOPPLER TEMPERATURE (DEG K)' : sname = 'EDOPT' 'E5577 DOPPLER ZONAL WIND (M/S)' : sname = 'EDOPU' 'E5577 DOPPLER MERIDIONAL WIND (M/S)' : sname = 'EDOPV' 'OH EMISSION BANDS (KILO-RAYLEIGHS)' : sname = 'OHBAND' 'OH EMISSION BANDS DOPPLER TEMPERATURE (DEG K)' : sname = 'OHDOPT' 'OH EMISSION BANDS DOPPLER ZONAL WIND (M/S)' : sname = 'OHDOPU' 'OH EMISSION BANDS DOPPLER MERIDIONAL WIND (M/S)' : sname = 'OHDOPV' else: begin ; print,'rdascii: ignoring field: ',fname end endcase ; frame = {frame_struct, $ fname:fname, $ sname:sname, $ nx:nx, $ xx:xx, $ xlab:xlab, $ ny:ny, $ yy:yy, $ ylab:ylab, $ zz:zz, $ glat:glat, $ glon:glon, $ log10:0, $ locname:locname, $ loccode:loccode $ } return,0 bad: print,'>>> rdascii: i/o error reading from file ',flnm return,1 end