subroutine merge_hv(l,smv,smn,sme,nf,n_win,buf, # jmin,jmax,ierr) c c merge horizontal spectra and compute h/v c output : smv merged/v smn = n/v sme = e/v c c originally written by Fortunat Kind (2 routines : merge_horcomp.f c and derive_hv.f) c modified by a.tento 05/03 v.1.0 c c implicit none real smv, smn, sme, buf integer ierr, jmin, jmax, nf, n_win, l dimension buf(nf),smv(nf,n_win),smn(nf,n_win),sme(nf,n_win) c include 'parameters.h' c c real sq2 parameter (sq2 = 1.4142135623731 ) integer k, nw character sep2*1 parameter (sep2 = ':') character*200 argout(20) c c ierr = 0 call split3(merge_type,argout,sep2,nw) c if (argout(1) .eq. 'arithmetic') then do 1 k = jmin, jmax buf(k) = 0.5*(smn(k,l) + sme(k,l)) 1 continue elseif (argout(1) .eq. 'geometric') then do 2 k = jmin, jmax buf(k) = sqrt(smn(k,l) * sme(k,l)) 2 continue elseif (argout(1) .eq. 'quadratic') then do 3 k = jmin, jmax buf(k) = sqrt(smn(k,l)**2 + sme(k,l)**2)/sq2 3 continue elseif (argout(1) .ne. 'complex') then write(*,*)' ERROR : ''merge type'' option wrongly set :' write(*,100)merge_type ierr = 1 return endif c c if (argout(1) .ne. 'complex') then do 10 k = jmin, jmax smn(k,l) = smn(k,l) / smv(k,l) sme(k,l) = sme(k,l) / smv(k,l) smv(k,l) = buf(k) / smv(k,l) 10 continue else do 11 k = jmin, jmax smn(k,l) = smn(k,l) / smv(k,l) sme(k,l) = smn(k,l) smv(k,l) = smn(k,l) 11 continue endif c c return c c 100 format(1x,a78) c c end