dustem_write_qabs.pro 1.64 KB
PRO dustem_write_qabs,dir,st,help=help

;+
; NAME:
;   dustem_write_qabs
;
; PURPOSE:
;   writes information relating to QABS parameters in the .DAT files 
;
; CATEGORY:
;    DustEMWrap, Distributed, LowLevel, Initialization
;
; CALLING SEQUENCE:
;   dustem_write_qabs,dir,st
;
; INPUTS:
;    st   : dustem data structure
;    dir  : output directory where file will be written
;
; OPTIONAL INPUT PARAMETERS:
;    None
;
; OUTPUTS:
;    None
;
; OPTIONAL OUTPUT PARAMETERS:
;    None
;
; ACCEPTED KEY-WORDS:
;    help     : writes this help
;
; COMMON BLOCKS:
;    None
;
; SIDE EFFECTS:
;    Files are written
;
; 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_write_qabs'
     goto,the_end
  ENDIF

  
;Caution: dir is the directory only
;Filenames are constructed inside the routine

;stop
Qstring='QABS_'
Estring='.DAT'
Nfiles=n_elements(st)
frmt="(50E15.5)"
stop
FOR i=0L,Nfiles-1 DO BEGIN
  filename=dir+Qstring+(*st(i)).material+Estring
  Nsizes=n_elements((*st(i)).sizes)
  OPENW,unit,filename,/get_lun
  printf,unit,Nsizes
  printf,unit,(*st(i)).sizes,format=frmt
  NLines=n_elements((*st(i)).qabs)
  NQabs=n_tags((*st(i)).qabs)
  vars=fltarr(NQabs,Nlines)
  FOR k=0L,NQabs-1 DO BEGIN
    vars(k,*)=((*st(i)).qabs).(k)
  ENDFOR
  FOR j=0L,Nlines-1 DO BEGIN
    printf,unit,vars(*,j),format=frmt
  ENDFOR
  close,unit
  free_lun,unit
ENDFOR

the_end:
END