C+ C NAME: C FillMap L C PURPOSE: C To fill maps at a given longitude with an average of the data from C the other longitudes. Found a big mistake 10/30/00 BVJ. IP and IM C were taking data from the wrong place. C (Unlike fillmaptN, this subroutine works only on 2 D Maps.) C There are six modes of operation for this filter C Modes 0, 2, 3 and 5 are used in ipshtd. Mode 5 is mostly cosmetic, C to make maps look good. C CATEGORY: C Data processing C CALLING SEQUENCE: C call FillMapL(Mode,XCbeg,XCend,nLng,nLat,Const,DMap) C INPUTS: C Mode integer 0 - only bad values are processed C 1 - all values are processed C 2 - only good values are processed, all weighted equally C 3 - make all 90 deg. longitudes the same value C 4 - make all valid 90 deg. longitudes the same value C 5 - make all 90 deg. longitudes the same value if equatorial longitudes are valid C XCbeg real Beginning rotation values C XCend real Ending rotation value C nLng integer # Longitude points C nLat integer # Latitude points C Const real Longitude filter constant (in terms of the numbers of intervals in one rotation) C DMap(nLng,nLat) real Input map C OUTPUTS: C DMap(nLng,nLat) real Output map C FUNCTIONS/SUBROUTINES: C PROCEDURE: C Bad values (indicated by BadR4()) are processed C MODIFICATION HISTORY: C MAY, 1999 B. Jackson (STEL,UCSD) C- subroutine FillMapL(Mode,XCbeg,XCend,nLng,nLat,Const,DMap) real DMap(nLng,nLat) ! Map C C Average the other non-Bad longitude values. C Bad = BadR4() ExpPWC = 50. C C This part Filters or smooths the data C NXC = (XCend-XCbeg) + 0.1 Lmod = nLng/NXC JJ = nLat/2 + 1 ! middle latitude C print *, NXC, Lmod do I=1,nLng do J=1,nLat DMNT = 0. ANDMNT = 0. Ithr = 0 if(DMap(I,J).eq.Bad.and.Mode.eq.0) Ithr = 1 if(Mode.eq.1) Ithr = 1 if(Ithr.eq.1) then do II=1,NXC IP = I + II*Lmod IM = I - II*Lmod if(IP.le.nLng) then if(DMap(IP,J).ne.Bad) then ExpPW = ((II*Lmod)/Const)**2 Expot = 999999. if(ExpPW.gt.ExpPWC) Expot = 0. if(Expot.ne.0.) Expot = Exp(-ExpPW) DMNT = DMNT + DMap(IP,J)*Expot ANDMNT = ANDMNT + Expot end if end if if(IM.ge.1) then if(DMap(IM,J).ne.Bad) then ExpPW = ((II*Lmod)/Const)**2 Expot = 999999. if(ExpPW.gt.ExpPWC) Expot = 0. if(Expot.ne.0.) Expot = Exp(-ExpPW) DMNT = DMNT + DMap(IM,J)*Expot ANDMNT = ANDMNT + Expot end if end if end do end if C C This part when Mode = 2, blends the data so that there is no seam C if(DMap(I,J).ne.Bad.and.Mode.eq.2) then do II=1,NXC IP = I + II*Lmod IM = I - II*Lmod if(IP.le.nLng) then if(DMap(IP,J).ne.Bad) then DMNT = DMNT + DMap(IP,J) ANDMNT = ANDMNT + 1. end if end if if(IM.ge.1) then if(DMap(IM,J).ne.Bad) then DMNT = DMNT + DMap(IM,J) ANDMNT = ANDMNT + 1. end if end if end do end if C C This part when Mode = 3, sums all valid data at + or - 90 deg. C if(Mode.ge.3.and.I.eq.1) then if(J.eq.1.or.J.eq.nLat) then do II=1,nLng if(DMap(II,J).ne.Bad) then DMNT = DMNT + DMap(II,J) ANDMNT = ANDMNT + 1. end if end do end if end if C if(ANDMNT.ne.0.) then if(Mode.eq.0)then DMap(I,J) = DMNT/ANDMNT end if if(Mode.eq.1)then if(DMap(I,J).eq.Bad)then DMap(I,J) = DMNT/ANDMNT else DMap(I,J) = (DMap(I,J) + DMNT)/(ANDMNT + 1.) end if end if if(Mode.eq.2)then DMap(I,J) = (DMap(I,J) + DMNT)/(ANDMNT + 1.) end if if(Mode.eq.3)then do II=1,nLng DMap(II,J) = DMNT/ANDMNT end do C print *, 'Mode = 3', I, J, DMNT, ANDMNT end if if(Mode.eq.4)then do II=1,nLng if(DMap(II,J).ne.Bad)then DMap(II,J) = DMNT/ANDMNT end if end do C print *, 'Mode = 4', I, J, DMNT, ANDMNT end if if(Mode.eq.5)then do II=1,nLng if(DMap(II,JJ).ne.Bad)then DMap(II,J) = DMNT/ANDMNT end if end do C print *, 'Mode = 5', I, J, DMNT, ANDMNT end if end if end do end do return end