PRO reaprf, gas, file, prof ; ; 13-MAY-11 AD Print warning and set prof=-1 if profile not found ; Use GET_LUN rather than specific LUN ; 28-NOV-00 AD ; IDL procedure for reading in profile from RFM .atm file ; ; gas (in) string name of species (eg 'CH4', 'HGT') ; file (in) string name of .atm file (eg 'std.atm') ; prof (out) real arr profile (or -1 if profile not found) ; sgas = '*' + STRUPCASE(gas) + ' ' l = STRLEN(sgas) OPENR, LUN, file, /GET_LUN header = '!' nlev = 0 WHILE STRMID(header,0,1) EQ '!' DO READF, LUN, header READS, header, nlev prof = FLTARR(nlev) WHILE STRMID(header,0,l) NE sgas DO BEGIN READF, LUN, header IF STRLEN(header) LT l THEN header = header + ' ' header = STRUPCASE(header) IF STRMID(header,0,4) EQ '*END' THEN BEGIN PRINT, 'W-REAPRF: ' + gas + ' not found in file ' + file PROF = -1 FREE_LUN, LUN RETURN ENDIF ENDWHILE READF, LUN, prof FREE_LUN, LUN END