Blame view

src/idl/dustem_read_all_lv.pro 3.21 KB
eafc1f8f   Annie Hughes   updated help info
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
FUNCTION dustem_read_all_lv,dir_in,silent=silent,help=help

;+
; NAME:
;   dustem_read_all_lv
;
; PURPOSE:
;  Manages reading of information from .DAT files used by the
;  LV version of the fortran
;
; CATEGORY:
;    DustEMWrap, Distributed, MidLevel, Initialization
;
; CALLING SEQUENCE:
;   st=dustem_read_all_lv(dir_in)
;
; INPUTS:
;    dir_in  : directory where input files are found
;
; OPTIONAL INPUT PARAMETERS:
;    None
;
; OUTPUTS:
;    st : dustem data structure
;
; OPTIONAL OUTPUT PARAMETERS:
;    None
;
; ACCEPTED KEY-WORDS:
;    help     : writes this help
;
; COMMON BLOCKS:
;    None
;
; SIDE EFFECTS:
;
; RESTRICTIONS:
;    The DustEM fortran code must be installed
;    The DustEMWrap IDL code must be installed
;
; PROCEDURES AND SUBROUTINES USED:  
;
; EXAMPLES:
;
; MODIFICATION HISTORY:
;    Evolution details on the DustEMWrap gitlab.
;    See http://dustemwrap.irap.omp.eu/ for FAQ and help.  
;-

IF keyword_set(help) THEN BEGIN
  doc_library,'dustem_read_all_lv'
  st=0.
  goto,the_end
ENDIF


  
427f1205   Jean-Michel Glorian   version 4.2 merged
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
dir_in_dat=dir_in+'/les_DAT/'
dir_in_qabs=dir_in+'/les_QABS/'
dir_in_capa=dir_in+'/les_CAPA/'

;stop

;== note: the output keywords are set only for LV version
file=dir_in_dat+'GRAIN.DAT'
st_temp=dustem_read_grain(file,silent=silent,key_str=key_str,G0=G0)
Ngrains=n_elements(st_temp)
st_grains={keywords:key_str,G0:G0,Ngrains:fix(Ngrains),grains:st_temp}

file=dir_in_dat+'ISRF.DAT'
st_isrf=dustem_read_isrf(file,silent=silent,Nisrf=Nisrf)

;=== Read Qabs
;st_qabs=ptrarr(st_grains.ngrains)
st_qabs=ptrarr(Ngrains)
FOR i=0,Ngrains-1 DO BEGIN
a5d1ca4f   Annie Hughes   updated doc help
77
  Qabs_file=dir_in_qabs+'Q_'+st_grains.grains[i].type+'.DAT'
427f1205   Jean-Michel Glorian   version 4.2 merged
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
  st=dustem_read_qabs_lv(Qabs_file,silent=silent)
  st_qabs(i)=ptr_new(st)
ENDFOR

;=== Read heat capacities
;st_calor=ptrarr(st_grains.ngrains)
st_calor=ptrarr(Ngrains)
FOR i=0,Ngrains-1 DO BEGIN
  Calor_file=dir_in_capa+'C_'+st_grains(i).type+'.DAT'
  st=dustem_read_calor_lv(Calor_file,silent=silent)
  st_calor(i)=ptr_new(st)
ENDFOR

;=== Read lambda
file=dir_in_qabs+'LAMBDA.DAT'
st_lambda=dustem_read_lambda(file,silent=silent)

;stop

;=== Read size distribution files
;st_size=ptrarr(st_grains.ngrains)
;mod by NF on October 2009: KEY_STR has to be tested for SIZE_XXX.DAT, not the indiviual flags !
st_size=ptrarr(Ngrains)
IF stregex(key_str, 'SIZE', /bool) THEN BEGIN
   FOR i=0,Ngrains-1 DO BEGIN
      Size_file=dir_in_dat+'SIZE_'+st_grains(i).type+'.DAT'
      st=dustem_read_size(Size_file,silent=silent)
      st_size(i)=ptr_new(st)
   ENDFOR
ENDIF ELSE BEGIN
   st_size = ptr_new()
ENDELSE
;mod by NF on October 2009: KEY_STR has to be tested for SIZE_XXX.DAT, not the indiviual flags !

;stop

;add by NF on October 2009
;=== Read MIX files
st_mix = ptrarr(Ngrains)
FOR i=0,Ngrains-1 DO BEGIN
   IF stregex(st_grains(i).flag, 'MIX', /bool) THEN BEGIN
      Mix_file=dir_in_dat+'MIX_'+st_grains(i).type+'.DAT'
      st=dustem_read_mix(Mix_file,silent=silent)
      st_mix(i)=ptr_new(st)
   ENDIF ELSE BEGIN
      st_mix(i)=ptr_new()
   ENDELSE
ENDFOR
;add by NF on October 2009



;mod by NF on October 2009: add MIX structure
st={Ngrains:Ngrains,G0:G0,Keywords:key_str,grains:st_grains, $
    isrf:st_isrf,qabs:st_qabs,calor:st_calor,lambda:st_lambda,size:st_size,mix:st_mix}
;mod by NF on October 2009: add MIX structure

eafc1f8f   Annie Hughes   updated help info
135
the_end:
427f1205   Jean-Michel Glorian   version 4.2 merged
136
137
138
RETURN,st

END