summaryrefslogtreecommitdiff
path: root/lib/flat1.f90
diff options
context:
space:
mode:
Diffstat (limited to 'lib/flat1.f90')
-rw-r--r--lib/flat1.f9029
1 files changed, 13 insertions, 16 deletions
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
-