| 
									
										
										
										
											2012-11-12 18:28:28 +00:00
										 |  |  | subroutine pctile(x,npts,npct,xpct)
 | 
					
						
							| 
									
										
										
										
											2012-10-11 18:33:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-05 11:09:27 -05:00
										 |  |  |   real x(npts)
 | 
					
						
							|  |  |  |   real,allocatable :: tmp(:)
 | 
					
						
							| 
									
										
										
										
											2012-10-11 18:33:50 +00: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 18:33:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-05 11:09:27 -05:00
										 |  |  |   tmp=x
 | 
					
						
							| 
									
										
										
										
											2015-11-18 01:28:12 +00:00
										 |  |  |   call shell(npts,tmp)
 | 
					
						
							| 
									
										
										
										
											2012-11-12 18:28:28 +00: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 18:33:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-18 07:50:39 -04:00
										 |  |  | 900 return
 | 
					
						
							| 
									
										
										
										
											2012-10-11 18:33:50 +00:00
										 |  |  | end subroutine pctile
 |