	 subroutine subratfh(AYEAR,AMN,ADY,iutcur,immcur)
C...................................................Oct 2024
C ratio Ri = TECobs/TECref ~ instant GIM / TEC CCIR_reference median  
C TECobs: 	tob(71,0:72)
C instant input files from Iriplas9maps.for:
C      tcm(71,0:72) !CCIR monthle median TECref 
C      f2m(71,0:72) !CCIR monthly median
C      h2m(71,0:72) !CCIR monthly median
C outfilef: proxy GIM-foF2
C outfileh: proxy GIM-hmF2
C                        
C
	CHARACTER*2 AYR,AMN,ADY
	CHARACTER*4 AYEAR
	CHARACTER*1 qs
	DIMENSION ires(71,0:72),ihm(71,0:72)
      REAL tcm(71,0:72),f2m(71,0:72),h2m(71,0:72),tob(71,0:72)        !m ~ CCIR median
	INTEGER itec(71,0:72),daynr
      COMMON /MTEC/itec
      COMMON /DAN/RZ,daynr,yds,imap,irun,qs,iutend,immend 
C irun=1 TECobs; =2 TEC-CCIR; =3 foF2-CCIR; =4 hmF2-ccir
C+
      AYR=AYEAR(3:4)
C
  33	format(5(1X,A2))
   1  continue
c-	if (ADY.eq.'00') STOP
        read(AYR,*) ryr
	iyr=int(ryr)
	if (iyr.lt.50) then
	IYEAR=2000+iyr
	        else
	IYEAR=1900+iyr
	        endif
C
   30 format(73(1X,F4.1))
   31 format(73(1X,I4))
   34 format(73(1X,F4.0))
C
       if (irun.eq.1) then
      do lat=1,71
      do lon=0,72
	tob(lat,lon)=itec(lat,lon)/10.
      enddo 
      enddo
	 RETURN	 
	 endif
C
       if (irun.eq.2) then
      do lat=1,71
      do lon=0,72
	tcm(lat,lon)=itec(lat,lon)/10.
      enddo 
      enddo
	 RETURN	 
       endif
C
       if (irun.eq.3) then
      do lat=1,71
      do lon=0,72
	f2m(lat,lon)=itec(lat,lon)/10.
      enddo 
      enddo
	 RETURN	 
       endif
C
       if (irun.eq.4) then
      do lat=1,71
      do lon=0,72
	h2m(lat,lon)=itec(lat,lon)/1.0
      enddo 
      enddo
       endif
C
	jmag=0      ! geogr => geomag !!!!!!!!!!!!!!!!!!!!!!!!
C -------------------------------------------------
       glat=90.0
	DO 123 ilat=1,71
	glat=glat-2.5
CC++++++++++++++++
C+ TLG Day-of-year reduced to 360.=> sday=season_day
      sday=daynr/yds*360.         ! north hemisphere
      IF(glat.GT.0.0) GOTO 5592
C TLG : sday for the sothern hemisphere:
      sday=sday+180.                ! south hemisphere
      if (sday.gt.360.) sday=sday-360. ! south hemisphere
CC++++++++++++++++
 5592	continue
C
C GLON cycle ------------------------
	glon=-185.0
C
	  DO 23 k=0,72
	glon=glon+5.0
	if (glon.lt.0.) glon=glon+360
	      CALL GEODIP(IYEAR,GLAT,GLON,AMLAT,AMLONG,JMAG)
	rat=tob(ilat,k)/tcm(ilat,k)				   !obs/med
	ratfc=sqrt(rat)
	ires(ilat,k)=nint(f2m(ilat,k)*ratfc*10.)	 !foF2 proxy
C+++++++++++++++++++++++++++++
	HMF2=h2m(ilat,k)
      IF (ratfc.ne.1.0) THEN					 !++
C Use model dh(dne/dnm):
C
      dlogne=2.0*alog10(ratfc)  !new
      call subdlogh(dlogne,amlat,sday,dlgh) !new
      rathhm=10.**dlgh !new
      if (rathhm.lt.0.8) rathhm=0.8
      HMF2=HMF2*rathhm !new	   
       ENDIF                                     !++
	ihm(ilat,k)=nint(hmf2)	  !hmF2 proxy
C++++++++++++++++++++++++++++++++++++++++++++++++++
   23	CONTINUE	   ! end glon cycle
  123	CONTINUE       ! end glat cycle
C
      irun=5
      DO ii=1,71
        DO kk=0,72
	itec(ii,kk)=ires(ii,kk)
        ENDDO
      ENDDO
      call mapionexfh(ayear,amn,ady,iutcur,immcur)  !
C
      irun=6
      DO ii=1,71
        DO kk=0,72
	itec(ii,kk)=ihm(ii,kk)
        ENDDO
      ENDDO
	call mapionexfh(ayear,amn,ady,iutcur,immcur)  !
C
C      pause ' '
	RETURN
	END