2012-11-12 13:28:28 -05:00
|
|
|
subroutine pctile(x,npts,npct,xpct)
|
2012-10-11 14:33:50 -04:00
|
|
|
|
2020-12-05 11:09:27 -05:00
|
|
|
real x(npts)
|
|
|
|
real,allocatable :: tmp(:)
|
2012-10-11 14:33:50 -04:00
|
|
|
|
2023-10-18 08:01:47 -04:00
|
|
|
if(npts.lt.0 .or. npct.lt.0 .or. npct.gt.100) then
|
|
|
|
xpct=1.0
|
|
|
|
go to 900
|
|
|
|
endif
|
2020-12-05 11:09:27 -05:00
|
|
|
allocate(tmp(npts))
|
2012-10-31 14:33:56 -04:00
|
|
|
|
2020-12-05 11:09:27 -05:00
|
|
|
tmp=x
|
2015-11-17 20:28:12 -05:00
|
|
|
call shell(npts,tmp)
|
2012-11-12 13:28:28 -05:00
|
|
|
j=nint(npts*0.01*npct)
|
|
|
|
if(j.lt.1) j=1
|
|
|
|
if(j.gt.npts) j=npts
|
|
|
|
xpct=tmp(j)
|
2023-10-18 07:50:39 -04:00
|
|
|
deallocate(tmp)
|
2012-10-11 14:33:50 -04:00
|
|
|
|
2023-10-18 07:50:39 -04:00
|
|
|
900 return
|
2012-10-11 14:33:50 -04:00
|
|
|
end subroutine pctile
|