From d63dd8d081a6fcd0715cd13f26df59fb831769d2 Mon Sep 17 00:00:00 2001 From: "Iain R. Learmonth" Date: Sun, 18 Oct 2015 18:51:00 +0100 Subject: Imported Upstream version 1.5.0 --- lib/flat1.f90 | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'lib/flat1.f90') diff --git a/lib/flat1.f90 b/lib/flat1.f90 index 526ab9bd..b9dfdd1d 100644 --- a/lib/flat1.f90 +++ b/lib/flat1.f90 @@ -1,30 +1,27 @@ -subroutine flat1(psavg,s2,nh,nsteps,nhmax,nsmax) +subroutine flat1(savg,iz,nsmo,syellow) - real psavg(nh) - real s2(nhmax,nsmax) - real x(8192),tmp(33) + real savg(iz) + real syellow(iz) + real x(8192) - nsmo=33 ia=nsmo/2 + 1 - ib=nh - nsmo/2 - 1 - do i=ia,ib - call pctile(psavg(i-nsmo/2),nsmo,50,x(i)) + ib=iz - nsmo/2 - 1 + nstep=20 + nh=nstep/2 + do i=ia,ib,nstep + call pctile(savg(i-nsmo/2),nsmo,50,x(i)) + x(i-nh:i+nh-1)=x(i) enddo do i=1,ia-1 x(i)=x(ia) enddo - do i=ib+1,nh + do i=ib+1,iz x(i)=x(ib) enddo - do i=1,nh - psavg(i)=psavg(i)/x(i) - do j=1,nsteps - s2(i,j)=s2(i,j)/x(i) - enddo - enddo + x0=0.001*maxval(x(1:iz)) + syellow(1:iz)=savg(1:iz)/(x(1:iz)+x0) return end subroutine flat1 - -- cgit v1.2.3