      subroutine subinterp2(fm,glat,glon,syr,smn,sdy,sut,res)
C.................................................................Feb. 2015
C Gulyaeva Tamara <gulyaeva@izmiran.ru>
C
C Subroutine to interpolate data from IONEX maps (TEC. TECmed, TECstd)
C Input : fm='c' means TEC     tcMNDDUT.jYR
C		fm='m' means TECmed	 tmMNDDUT.jYR
C		fm='s' means TECstd	 tsMNDDUT.jYR
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 Outpur : res - value of TEC, TECmed, or TECstd (0.1TECU)
C 
C++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C Use tc,tm,ts interpolated from directories dtc, dem, dsi maps - update addresses for input file
C
	DIMENSION fhdat(0:72,71)	  ! maps TEC. TECmed, TECstd
	CHARACTER*1 fm
	CHARACTER*2 syr,smn,sdy,sut
      CHARACTER*45 infilef
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	read(syr,*) ryr
	iyr=int(ryr)
	read(sdy,*) rdy1
	 ndy1=int(rdy1)
	read(smn,*) rmn1
	imn1=int(rmn1)
C Use fc,hc predictions from directories dfc or dhc
crem	infilef='d:\web\graf\dfc\YR\MN\ut\fcMNDDUT.jYR' ! path and name of input file JPL
	infilef='d:\web\dts\YR\MN\tcMNDYUT.jYR' !path and name: input file JPL TEC
	infilef(12:13)=SYR
	infilef(15:16)=SMN
	infilef(28:29)=SYR
	infilef(20:21)=SMN
		if (fm.eq.'t') then  ! TEC median
	infilef(9:10)='ts'	   ! tc
	infilef(19:19)='c'
	 
	infilef(30:31)=sdy
	infilef(32:33)=sut
	else
	infilef='d:\web\dts\YR\MN\tcMN00UT.mYR' ! path and name of input median file JPL
	infilef(12:13)=SYR
	infilef(15:16)=SMN
	infilef(28:29)=SYR
	infilef(20:21)=SMN
c	infilef(19:19)='c'
c	infilef(22:23)=sdy
	infilef(24:25)=sut
	endif
 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