dustem_write_qabs.pro 676 Bytes
PRO dustem_write_qabs,dir,st

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

;stop
Qstring='QABS_'
Estring='.DAT'
Nfiles=n_elements(st)
frmt="(50E15.5)"

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

END