C.....................................................................
	subroutine submageq(alat,alon,ns)
C...........................................................Dec/2012
C alat, alon - geographic coordinates (input)
C ns=1 (North), ns=0 (South) = output
	dimension glats(361),glons(361) ! geogr. coordinates of magnetic equator
	DATA  glats/
     *  -3.1, -2.9, -2.7, -2.6, -2.4, -2.2, -2.1, -1.9, -1.7, -1.5, -1.4
     *, -1.2, -1.0,  -.9,  -.7,  -.5,  -.3,  -.2,   .0,   .2,   .3,   .5
     *,   .7,   .9,  1.0,  1.2,  1.4,  1.5,  1.7,  1.9,  2.1,  2.2,  2.4
     *,  2.6,  2.7,  2.9,  3.1,  3.2,  3.4,  3.5,  3.7,  3.9,  4.0,  4.2
     *,  4.3,  4.5,  4.6,  4.8,  4.9,  5.1,  5.2,  5.4,  5.5,  5.7,  5.8
     *,  6.0,  6.1,  6.2,  6.4,  6.5,  6.6,  6.8,  6.9,  7.0,  7.1,  7.2
     *,  7.4,  7.5,  7.6,  7.7,  7.8,  7.9,  8.0,  8.1,  8.2,  8.3,  8.4
     *,  8.5,  8.6,  8.7,  8.8,  8.8,  8.9,  9.0,  9.1,  9.1,  9.2,  9.3
     *,  9.3,  9.4,  9.4,  9.5,  9.5,  9.6,  9.6,  9.7,  9.7,  9.7,  9.8
     *,  9.8,  9.8,  9.9,  9.9,  9.9,  9.9,  9.9,  9.9,  9.9,  9.9,  9.9
     *,  9.9,  9.9,  9.9,  9.9,  9.9,  9.9,  9.8,  9.8,  9.8,  9.7,  9.7
     *,  9.7,  9.6,  9.6,  9.5,  9.5,  9.4,  9.4,  9.3,  9.3,  9.2,  9.1
     *,  9.1,  9.0,  8.9,  8.8,  8.8,  8.7,  8.6,  8.5,  8.4,  8.3,  8.2
     *,  8.1,  8.0,  7.9,  7.8,  7.7,  7.6,  7.5,  7.4,  7.2,  7.1,  7.0
     *,  6.9,  6.8,  6.6,  6.5,  6.4,  6.2,  6.1,  6.0,  5.8,  5.7,  5.5
     *,  5.4,  5.2,  5.1,  4.9,  4.8,  4.6,  4.5,  4.3,  4.2,  4.0,  3.9
     *,  3.7,  3.5,  3.4,  3.2,  3.1,  2.9,  2.7,  2.6,  2.4,  2.2,  2.1
     *,  1.9,  1.7,  1.5,  1.4,  1.2,  1.0,   .9,   .7,   .5,   .3,   .2
     *,   .0,  -.2,  -.3,  -.5,  -.7,  -.9, -1.0, -1.2, -1.4, -1.5, -1.7
     *, -1.9, -2.1, -2.2, -2.4, -2.6, -2.7, -2.9, -3.1, -3.2, -3.4, -3.5
     *, -3.7, -3.9, -4.0, -4.2, -4.3, -4.5, -4.6, -4.8, -4.9, -5.1, -5.2
     *, -5.4, -5.5, -5.7, -5.8, -6.0, -6.1, -6.2, -6.4, -6.5, -6.6, -6.8
     *, -6.9, -7.0, -7.1, -7.2, -7.4, -7.5, -7.6, -7.7, -7.8, -7.9, -8.0
     *, -8.1, -8.2, -8.3, -8.4, -8.5, -8.6, -8.7, -8.8, -8.8, -8.9, -9.0
     *, -9.1, -9.1, -9.2, -9.3, -9.3, -9.4, -9.4, -9.5, -9.5, -9.6, -9.6
     *, -9.7, -9.7, -9.7, -9.8, -9.8, -9.8, -9.9, -9.9, -9.9, -9.9, -9.9
     *, -9.9, -9.9, -9.9, -9.9, -9.9, -9.9, -9.9, -9.9, -9.9, -9.9, -9.8
     *, -9.8, -9.8, -9.7, -9.7, -9.7, -9.6, -9.6, -9.5, -9.5, -9.4, -9.4
     *, -9.3, -9.3, -9.2, -9.1, -9.1, -9.0, -8.9, -8.8, -8.8, -8.7, -8.6
     *, -8.5, -8.4, -8.3, -8.2, -8.1, -8.0, -7.9, -7.8, -7.7, -7.6, -7.5
     *, -7.4, -7.2, -7.1, -7.0, -6.9, -6.8, -6.6, -6.5, -6.4, -6.2, -6.1
     *, -6.0, -5.8, -5.7, -5.5, -5.4, -5.2, -5.1, -4.9, -4.8, -4.6, -4.5
     *, -4.3, -4.2, -4.0, -3.9, -3.7, -3.5, -3.4, -3.2, -3.1/
	DATA  glons/
     *   0.0,   .9,  1.9,  2.9,  3.9,  4.9,  5.9,  6.9,  7.8,  8.8,  9.8
     *, 10.8, 11.8, 12.8, 13.8, 14.7, 15.7, 16.7, 17.7, 18.7, 19.7, 20.7
     *, 21.6, 22.6, 23.6, 24.6, 25.6, 26.6, 27.6, 28.5, 29.5, 30.5, 31.5
     *, 32.5, 33.5, 34.5, 35.4, 36.4, 37.4, 38.4, 39.4, 40.4, 41.4, 42.4
     *, 43.4, 44.4, 45.3, 46.3, 47.3, 48.3, 49.3, 50.3, 51.3, 52.3, 53.3
     *, 54.3, 55.3, 56.3, 57.3, 58.3, 59.3, 60.3, 61.3, 62.3, 63.3, 64.3
     *, 65.3, 66.3, 67.3, 68.3, 69.3, 70.3, 71.3, 72.3, 73.3, 74.3, 75.3
     *, 76.3, 77.3, 78.3, 79.3, 80.4, 81.4, 82.4, 83.4, 84.4, 85.4, 86.4
     *, 87.4, 88.4, 89.4, 90.5, 91.5, 92.5, 93.5, 94.5, 95.5, 96.5, 97.6
     *, 98.6, 99.6,100.6,101.6,102.6,103.6,104.7,105.7,106.7,107.7,108.7
     *,109.7,110.7,111.8,112.8,113.8,114.8,115.8,116.8,117.9,118.9,119.9
     *,120.9,121.9,122.9,123.9,124.9,126.0,127.0,128.0,129.0,130.0,131.0
     *,132.0,133.0,134.0,135.1,136.1,137.1,138.1,139.1,140.1,141.1,142.1
     *,143.1,144.1,145.1,146.1,147.1,148.1,149.1,150.1,151.1,152.1,153.1
     *,154.1,155.1,156.1,157.1,158.1,159.1,160.1,161.1,162.1,163.1,164.1
     *,165.1,166.1,167.1,168.1,169.1,170.1,171.1,172.0,173.0,174.0,175.0
     *,176.0,177.0,178.0,179.0,180.0,180.9,181.9,182.9,183.9,184.9,185.9
     *,186.9,187.8,188.8,189.8,190.8,191.8,192.8,193.8,194.7,195.7,196.7
     *,197.7,198.7,199.7,200.7,201.6,202.6,203.6,204.6,205.6,206.6,207.6
     *,208.5,209.5,210.5,211.5,212.5,213.5,214.5,215.4,216.4,217.4,218.4
     *,219.4,220.4,221.4,222.4,223.4,224.4,225.3,226.3,227.3,228.3,229.3
     *,230.3,231.3,232.3,233.3,234.3,235.3,236.3,237.3,238.3,239.3,240.3
     *,241.3,242.3,243.3,244.3,245.3,246.3,247.3,248.3,249.3,250.3,251.3
     *,252.3,253.3,254.3,255.3,256.3,257.3,258.3,259.3,260.4,261.4,262.4
     *,263.4,264.4,265.4,266.4,267.4,268.4,269.4,270.5,271.5,272.5,273.5
     *,274.5,275.5,276.5,277.6,278.6,279.6,280.6,281.6,282.6,283.6,284.7
     *,285.7,286.7,287.7,288.7,289.7,290.7,291.8,292.8,293.8,294.8,295.8
     *,296.8,297.9,298.9,299.9,300.9,301.9,302.9,303.9,304.9,306.0,307.0
     *,308.0,309.0,310.0,311.0,312.0,313.0,314.0,315.1,316.1,317.1,318.1
     *,319.1,320.1,321.1,322.1,323.1,324.1,325.1,326.1,327.1,328.1,329.1
     *,330.1,331.1,332.1,333.1,334.1,335.1,336.1,337.1,338.1,339.1,340.1
     *,341.1,342.1,343.1,344.1,345.1,346.1,347.1,348.1,349.1,350.1,351.1
     *,352.0,353.0,354.0,355.0,356.0,357.0,358.0,359.0,360.0/

C
C =================================================
	if (alon.lt.0.) alon=alon+360.
	do i=1,360
	    if ((alon.ge.glons(i)).and.(alon.lt.glons(i+1))) then
	xlat=glats(i)+(glats(i+1)-glats(i))*(alon-glons(i))/(glons(i+1)
	&-glons(i))
	if (alat.gt.xlat) then
	ns=1
	else
	ns=0
	endif
	exit
	     endif   
	enddo
  	return
	end
C..............................................................................................
