subroutine parfile_read(par_file,ierr) c c Subroutine that reads in the processing information from the c specified input parameter files. The information is stored in c a common block. c originally written by Fortunat Kind c modified by a.tento 06/03 c implicit none character*200 par_file integer ierr c character*200 line, key, remainder integer nunit, i include 'parameters.h' c c call glun(nunit,ierr) if (ierr .ne. 0) goto 40 open(unit=nunit,file=par_file,status='old') c ierr=0 do 1 i = 1, 987654321 read(nunit,'(a80)',end=20) line if ( line(1:22) .eq. '### section processing' ) goto 2 1 continue 2 continue C jump all comment and empty lines, but display the relevant parts, C until the end of the processing section do 3 i = 1, 987654321 read(nunit,'(a200)',end=30) line if ( line(1:18) .eq. '### end processing' ) goto 4 if ((line .ne. '') .and. (line(1:1) .ne. '#')) then call strtok(line,key,remainder,':') if (key .eq. 'freq_spacing') then freq_spacing=remainder else if (key .eq. 'offset_rem') then offset_rem=remainder else if (key .eq. 'taper') then taper=remainder else if (key .eq. 'instrument_resp') then instrument_resp=remainder write(*,400)key ierr = 2 else if (key .eq. 'smooth') then smooth=remainder else if (key .eq. 'merge_type') then merge_type=remainder else if (key .eq. 'single_component') then single_component=remainder write(*,400)key ierr = 2 else if (key .eq. 'average_type') then average_type=remainder write(*,400)key ierr = 2 else if (key .eq. 'average_spectra_out') then average_spectra_out=remainder else if (key .eq. 'single_win_out') then single_win_out=remainder else if (key .eq. 'filter_out') then filter_out=remainder else c................... undefined key was used, returning error or Warning ierr=1 write(*,300)key,par_file return end if end if 3 continue c 4 close(nunit) return c c 20 write (*,*) ' ERROR in parfile_read:' write (*,*) ' line ''### section processing'' not found in file' write(*,100)par_file ierr=1 return 30 write (*,*)' WARNING in parfile_read:' write (*,*)' following file ended before ''### end processing''' write(*,100)par_file close(nunit) ierr=2 return 40 write (*,*) ' ERROR in parfile_read:' write (*,*) ' could not find free unit number for parameter', # ' file' ierr=1 return c 300 format(' ERROR : undefined parameter key : ''',a32, # ''' in file :',/,1x,a200) 100 format(1x,a200) 400 format(' WARNING: parameter ''',a,''' obsolete:', # ' not taken into account') c end