      program extprime
C.......................................................Feb. 2018
C extract foF2 from PRIME_foF2 maps
C
      	DIMENSION im(12)
	CHARACTER*68 outfile
	CHARACTER*2 AYR,AMN,ADY,AUT,ST
	DATA  IM/31,28,31,30,31,30,31,31,30,31,30,31/
C
CTEMP for Canberra:
       st='cb'
      glat=-35.3 !Temp
	glon=149.1 !Temp
	AUT='02' !Local noon at UT+02h
	outfile='cbnoondp.res'
	OPEN(12,file=outfile,access='APPEND')
	write(*,22) st
	write(12,*) st
C   lt=ut+glon/15. = ut+10.; LT=12 at UT=2
  123     write(*,*) 'Enter YR'
	read(*,22) AYR
	read(ayr,*) ryr
	jyr=int(ryr)
C+	AYR='17'
	if(int(ryr/4.)*4.eq.jyr) THEN 
 	im(2)=29
	                          ELSE
	IM(2)=28
	ENDIF

C+134    write(*,*) 'Enter MN (MN=00 for stop)'
C+	read(*,22) AMN
C+	if (amn.eq.'00') STOP
C+	read(amn,*) rmn
C+	jmn=int(rmn)
C+	if (jmn.gt.12) STOP
	mnend=12
	if (jyr.eq.17) mnend=6 ! temp
C mon-to-mn cycle
       DO 60 kmn=1,mnend
	call blet2(kmn,AMN)
C
Ctemp	AMN=YYMMDD(3:4)
C+       write(*,*) 'Enter DY start,DY end'
C+	read(*,*) KDY1,KDY2
	ndnr=im(kmn)
   22 format(A2)
   23 format(1X,3A2,3X,F4.1)
C+	DO 50 kdy=kdy1,kdy2
	DO 50 kdy=1,ndnr
	call blet2(kdy,ADY)
	call subinterp2p(glat,glon,ayr,amn,ady,aut,res)
	fof2=res/10.      
	write(*,23) ayr,amn,ady,fof2
	write(12,23) ayr,amn,ady,fof2
  50	continue

  60	continue
C
      if (jyr.lt.17) goto 123
	close(unit=12)
	pause ' '
	STOP
	END