Commit bcae176502515fd08be7eae911c0d0f4c265014b
1 parent
b3211d62
Exists in
master
tidied up reading of densities
Showing
1 changed file
with
7 additions
and
13 deletions
Show diff stats
src/idl/dustem_read_qabs_lv.pro
... | ... | @@ -54,7 +54,6 @@ IF keyword_set(help) THEN BEGIN |
54 | 54 | ENDIF |
55 | 55 | |
56 | 56 | |
57 | - | |
58 | 57 | st='' |
59 | 58 | Nmax=10000L |
60 | 59 | sts=strarr(Nmax) |
... | ... | @@ -71,18 +70,15 @@ ENDWHILE |
71 | 70 | Nsizes=fix(str) |
72 | 71 | |
73 | 72 | ;Get sizes |
74 | -readf,unit,st | |
75 | -sizes=float(str_sep(strcompress(strtrim(st,2)),' ')) | |
73 | +readf,unit,str | |
74 | +sizes=float(str_sep(strcompress(strtrim(str,2)),' ')) | |
76 | 75 | Ncol=Nsizes |
77 | 76 | |
78 | -IF keyword_set(read_densities) THEN BEGIN | |
79 | - readf,unit,st | |
80 | - ;stop | |
81 | - IF st EQ '#### Qabs ####' THEN BEGIN | |
82 | - message,'Problem with size dependent densities in Qabs.DAT',/continue | |
83 | - ;stop | |
84 | - ENDIF | |
85 | - densities=float(str_sep(strcompress(strtrim(st,2)),' ')) | |
77 | +; test read the next line to see if it contains densities | |
78 | +readf,unit,str | |
79 | +first_char=strmid(str,0,1) | |
80 | +IF first_char ne '#' THEN BEGIN | |
81 | + densities=float(str_sep(strcompress(strtrim(str,2)),' ')) | |
86 | 82 | ENDIF ELSE BEGIN |
87 | 83 | densities=fltarr(Nsizes)+la_undef() |
88 | 84 | ENDELSE |
... | ... | @@ -130,7 +126,6 @@ close,unit |
130 | 126 | free_lun,unit |
131 | 127 | |
132 | 128 | qsca_str=sts[0:nlines-1] |
133 | -;stop | |
134 | 129 | |
135 | 130 | Nlines=n_elements(qsca_str); -- ORIGINAL |
136 | 131 | ;Nlines=n_elements(qabs_str) |
... | ... | @@ -139,7 +134,6 @@ qabs_values=fltarr(Nlines,Ncol) |
139 | 134 | qsca_values=fltarr(Nlines,Ncol) |
140 | 135 | |
141 | 136 | FOR i=0L,Nlines-2 DO BEGIN |
142 | - ;print,i | |
143 | 137 | qabs_values[i,*]=str_sep(strcompress(strtrim(qabs_str[i],2)),' ') |
144 | 138 | qsca_values[i,*]=str_sep(strcompress(strtrim(qsca_str[i],2)),' ') |
145 | 139 | ENDFOR | ... | ... |