subroutine iriprof
	implicit real*8 (a-h,o-z)
	character*8 modx,id
c	tabulated profile set up by the IRI program IRINHPROF
      COMMON /XX/ MODX(2),X,PXPR,PXPTH,PXPPH,PXPT,HMAX                   
      COMMON R(6) /WW/ ID(10),W0,W(400)                                  
      EQUIVALENCE (EARTHR,W(2)),(F,W(6))
	dimension ht(1000),fn(1000)
	data modx(1) / 'IRIpro'/
	data ipass / 0 /
      ENTRY ELECTX                                                       
	if(ipass.eq.1) go to 102
	ipass = 1
	open(unit=3,file='irinh.dat',status='old')
	read(3,100) flat,flon,ssno,fmon,hour,hmf2,nht
100	format(6f8.0,i5)
	type*,' profile is for lat,lon,r,mon,lt',
     a          flat,flon,ssno,fmon,hour
	read(3,101) (ht(i),fn(i),i=1,nht)
101	format(6(f6.2,f6.3))
c
      HMAX = hmf2
102	x = 0.
	pxpr = 0.
	pxpth = 0.
	pxpph = 0.
      H=R(1)-EARTHR                                                      
	if(h.lt.ht(1).or.h.gt.ht(nht)) return
	nhm1 = nht - 1
	do 10 i = 1,nhm1
	ii = i
	if(h.ge.ht(i).and.h.lt.ht(i+1)) go to 30
10	continue
	stop' trouble in ELECTX'
30	continue
	x1 = fn(ii)/f
	x2 = fn(ii+1)/f
	x1 = x1 * x1
	x2 = x2 * x2
	grad = (x2 - x1) / (ht(ii+1) - ht(ii))
	x = x1 + (h - ht(ii)) * grad
cc	if(x.gt.1.) type*,
cc     a   ' IRIPROF ii,fn(ii),fn(ii+1),ht(ii),ht(ii+1),f,h,x',
cc     a             ii,fn(ii),fn(ii+1),ht(ii),ht(ii+1),f,h,x
	pxpr = grad
      RETURN                                                             
         END