      subroutine subinterp2tc(glat,glon,syr,smn,sdy,sut,res)
C.................................................................Jan 2024
C
C.................................................................Jan. 2017
C Gulyaeva Tamara <gulyaeva@izmiran.ru>
C
C Subroutine to interpolate data from IONEX maps (foF2, hmF2, TEC)
C Input : fm='f' means foF2
C		fm='h' means hmF2
C		fm='t' means TEC
C         glat - geographic latitute
C         glon - geographic longitude
C         syr - YEAR = '99' for 1999,'00' for 2000, etc.
C         smn - month
C         sdy - day of month
C         sut - hour, UT
C.................................................................
C Output : res - value of TEC (0.1TECU)
C 
C++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C Use fc,hc,tc interpolated from directories dts maps - update addresses for input file
C
	DIMENSION fhdat(0:72,71)	  ! maps fcF2,hcF2,TEC
	CHARACTER*1 fm
	CHARACTER*2 syr,smn,sdy,sut
      CHARACTER*45 infilef
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C 
C++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	fm='t'   ! TEC
	read(syr,*) ryr
	iyr=int(ryr)
	read(sdy,*) rdy1
	 ndy1=int(rdy1)
	read(smn,*) rmn1
	imn1=int(rmn1)
C 
	infilef='f:\web\dts\YR\MN\tcMNDDUT.jYR' ! path and name of input file JPL
	infilef(12:13)=SYR
	infilef(15:16)=SMN
	infilef(28:29)=SYR
	infilef(20:21)=SMN
	infilef(22:23)=sdy
	infilef(24:25)=sut
 204	format(73(1X,F4.0))
C
	OPEN(10,FILE=INFILEF)		

		do ilat=1,71
	read(10,204) (fhdat(k,ilat),k=0,72)	
	enddo
	close(unit=10)
C
C      interpolate for glat,glon
C Linear Interpolation   
	aglat=-90.
	res=0.
	res11=0.
	res12=0.
	res21=0.
	res22=0.
	do 161 ilat=1,70 ! select pair of lats-lines (k) & (k+1)
c	aglat=-87.5,-85,...,87.5
	aglat=-90.+2.5*ilat
	aglat2=aglat+2.5
C
	if ((glat.ge.aglat).and.(glat.le.aglat2)) then  !   <<<<1
C Select pair of longs embracing glong
	 clon=-185.
	along=glon
	if (along.ge.180.) along=along-360.0
	do j=0,71 ! select pair of longs (j) & (j+1)
	clon=clon+5.
	clon2=clon+5.
	if ((along.ge.clon).and.(along.lt.clon2)) then  ! +++2
	res11=fhdat(j,ilat)
	res12=fhdat(j+1,ilat)
	res21=fhdat(j,ilat+1)
	res22=fhdat(j+1,ilat+1)
	res1=res11+(res12-res11)/5.*(along-clon)
	res2=res21+(res22-res21)/5.*(along-clon)
	res=res1+(res2-res1)/2.5*(glat-aglat)
	endif											 ! +++2
	enddo	! end select pair of longs (j) & (j+1)
	exit
	endif											 !   <<<<1
  161 continue		   ! interpolation end
	close(unit=10)
	RETURN
	END