      program mapionex
C produce daily map in IONEX format from UT hourly maps
	dimension IM(12)
	DATA  IM/31,28,31,30,31,30,31,31,30,31,30,31/

	WRITE(*,*) 'Enter iYR and iMN for input: '
	read(*,*) iYR,iMN
	yr=float(iyr)
	if(int(yr/4.)*4.eq.iyr) THEN 
	im(2)=29
	ndnr=366
	                          ELSE
	IM(2)=28
	ndnr=365
	ENDIF
	ndays=im(imn)
	iyr_nex=iyr

	do idy=1,ndays
	if (idy.eq.ndays) then
	imn_nex=imn+1
	idy_nex=1
	else
	imn_nex=imn
	idy_nex=idy
	endif
	call submapd4(1,iyr,imn,idy,iyr_nex,imn_nex,idy_nex)
	call submapd4(2,iyr,imn,idy,iyr_nex,imn_nex,idy_nex)
	call submapd4(3,iyr,imn,idy,iyr_nex,imn_nex,idy_nex)
	call submapd4(4,iyr,imn,idy,iyr_nex,imn_nex,idy_nex)
	enddo
	pause ' '
	STOP
	end