C+ C NAME: C CopyDtoDV C PURPOSE: C Make density maps at the velocity map surface to the time C cadence of the velocity maps C CATEGORY: C Data processing C CALLING SEQUENCE: C call CopyDtoDVN(Mode,XCbe,XCtbeg,XCtend,XCtbegG,XCtendG,nLng,nLat,nTG,nTV,ConsT,DD,DDV,DDT,DDD) C INPUTS: C Mode integer 0 - transfer good time values only C 1 - transfer both good and average time values C 2 - Same as 1, but cut off filter after 1 time away C XCbe real Beginning V times (XCbeV) C XCtbeg real Beginning V time (XCtbegV) C XCtend real Ending V time (XCtendV) C XCtbegG real Beginning G time C XCtendG real Ending G time C nLng integer # Longitude points C nLat integer # Latitude points C nTG integer # G-level times C nTV integer # velocity times C ConsT real Time filter constant (in terms of time interval) C DD(nLng,nLat,nTG) real Density map C OUTPUTS: C DDV(nLng,nLat,nTV) real Velocity density map C SCRATCH ARRAYS: C DDT(nTG) real C DDD(nLng) real C FUNCTIONS/SUBROUTINES: C PROCEDURE: C Bad values (indicated by BadR4()) are not processed C MODIFICATION HISTORY: C NOV, 1999 B. Jackson (STEL,UCSD) C- subroutine CopyDtoDVN(Mode,XCbe,XCtbeg,XCtend,XCtbegG,XCtendG,nLng,nLat,nTG,nTV,ConsT,DD,DDV, & DDT,DDD) real DD(nLng,nLat,nTG), ! Density map & DDV(nLng,nLat,nTV) ! Velocity density map real XCbe(2,nTV) ! Velocity longitude index real DDT(nTG) real DDD(nLng) real dRR /.1/ C include 'MAPCOORDINATES.H' C Bad = badR4() ExpPWC = 50. do I=1,nLng do J=1,nLat do N=1,nTG DDT(N) = DD(I,J,N) end do do N=1,nTV ! interpolate for common time values nT = nTV nT1 = nT-1 TI = XCtvar(XCtfull(N)) dv = FLINT(-1,nTG,DDT,TI) if(dv.ne.Bad) then DDV(I,J,N) = dv else DDV(I,J,N) = Bad end if end do end do end do C C If no common time values are present, then average the interpolated C non-Bad time values. C if(Mode.ge.1) then XCtbegV = XCtbeg XCtendV = XCtend nTV1 = nTV-1 do J=1,nLat do N=1,nTV XCbeg = XCbe(1,N) XCend = XCbe(2,N) XCtbeg = XCtbegV XCtend = XCtendV nT1 = nTV-1 XCnTV = XCtfull(N) do I=1,nLng C if(I.eq.1.and.J.eq.1.and.N.eq.1) print *, I,J,N,DDV(I,J,N) C if(I.eq.40.and.J.eq.9.and.N.eq.1) print *, I,J,N,DDV(I,J,N) if(DDV(I,J,N).eq.Bad) then DDNT = 0. ANDDNT = 0. XC = XCvar(XCfull(I)) do NN=1,nTG do II=1,nLng DDD(II) = DD(II,J,NN) end do DDF = FLINT(-1,nLng,DDD,XC) if(DDF.ne.Bad) then XCtbeg = XCtbegG XCtend = XCtendG nT1 = nTG-1 XCnTG = XCtfull(NN) XCMXC = (XCnTV-XCnTG)/(XCtendV-XCtbegV)*nTV1 ExpPW = (XCMXC/CONST)**2 Expot = 999999. if(ExpPW.gt.ExpPWC) Expot = 0. if(Mode.eq.2.and.abs(XCMXC).gt.1.5) Expot = 0. if(Expot.ne.0.) Expot = Exp(-ExpPW) DDNT = DDNT + DDF*Expot ANDDNT = ANDDNT + Expot end if C if(I.eq.40.and.J.eq.9) print *, I,J,NN,XCnTV,XCnTG,XCMXC,ExpPW,DDF,DDNT,ANDDNT C if(I.eq.40.and.J.eq.9) print *, DDD end do if(ANDDNT.ne.0.) then DDV(I,J,N) = DDNT/ANDDNT else DDV(I,J,N) = BAD end if end if C if(I.eq.1.and.J.eq.1) print *, I,J,N,DDV(I,J,N) C if(I.eq.40.and.J.eq.9) print *, I,J,N,DDV(I,J,N) end do end do end do end if return end C+ C NAME: C CopyVtoVD N C PURPOSE: C Make density velocity maps at the density map surface to the time C cadence of the density maps C CATEGORY: C Data processing C CALLING SEQUENCE: C call CopyVtoVDN(Mode,XCbe,XCtbeg,XCtend,XCtbegV,XCtendV,nLng,nLat,nTV,nTG,ConsT,VV,VVD,VVT,VVV) C INPUTS: C Mode integer 0 - transfer good time values only C 1 - transfer both good and average time values C 2 - Same as 1, but cut off filter after 1 time away C XCbe real Beginning G (XCbeGG) C XCtbeg real Beginning G time (XCtbegG) C XCtend real Ending G time (XCtendG) C XCtbegV real Beginning V time (XCtbegV) C XCtendV real Ending V time (XCtendV) C nLng integer # Longitude points C nLat integer # Latitude points C nTV integer # velocity times C nTG integer # G-level times C ConsT real Time filter constant (in terms of time interval) C VV(nLng,nLat,nTV) real Velocity map C OUTPUTS: C VVD(nLng,nLat,nTG) real Density velocity map C SCRATCH ARRAYS: C VVT(nTV) real C VVV(nLng) real C FUNCTIONS/SUBROUTINES: C PROCEDURE: C Bad values (indicated by BadR4()) are not processed C MODIFICATION HISTORY: C NOV, 1999 B. Jackson (STEL,UCSD) Found error 11/14/00 in determining first part BVJ C- subroutine CopyVtoVDN(Mode,XCbe,XCtbeg,XCtend,XCtbegV,XCtendV,nLng,nLat,nTV,nTG,ConsT,VV,VVD, & VVT,VVV) real VV(nLng,nLat,nTV), ! Velocity map & VVD(nLng,nLat,nTG) ! Density velocity map real XCbe(2,nTG) ! Density longitude index real VVT(nTV) real VVV(nLng) real dRR /.1/ C include 'MAPCOORDINATES.H' C Bad = badR4() ExpPWC = 50. do I=1,nLng do J=1,nLat do N=1,nTV VVT(N) = VV(I,J,N) end do do N=1,nTG ! interpolate for common time values nT = nTG nT1 = nT-1 TI = XCtvar(XCtfull(N)) vd = FLINT(-1,nTV,VVT,TI) if(vd.ne.Bad) then VVD(I,J,N) = vd else VVD(I,J,N) = Bad end if end do end do end do C C If no common time values are present, then average the interpolated C non-Bad time values. C if(Mode.ge.1) then XCtbegG = XCtbeg XCtendG = XCtend nTG1 = nTG-1 do J=1,nLat do N=1,nTG XCtbeg = XCtbegG XCtend = XCtendG nT1 = nTG-1 XCnTG=XCtfull(N) XCbeg = XCbe(1,N) XCend = XCbe(2,N) do I=1,nLng C if(I.eq.1.and.J.eq.1.and.N.eq.1) print *, I,J,N,VVD(I,J,N) C if(I.eq.40.and.J.eq.9.and.N.eq.1) print *, I,J,N,VVD(I,J,N) if(VVD(I,J,N).eq.Bad) then VVNT = 0. ANVVNT = 0. XC = XCvar(XCfull(I)) do NN=1,nTV do II=1,nLng VVV(II) = VV(II,J,NN) end do VVF = FLINT(-1,nLng,VVV,XC) if(VVF.ne.Bad) then XCtbeg = XCtbegV XCtend = XCtendV nT1 = nTV-1 XCnTV = XCtfull(NN) XCMXC = (XCnTV - XCnTG)/(XCtendG-XCtbegG)*nTG1 Expot = 999999. ExpPW = (XCMXC/CONST)**2 if(Mode.eq.2.and.abs(XCMXC).gt.1.5) Expot = 0. C if(I.eq.30.and.J.eq.4.and.N.eq.20) print *, I,J,N,NN,XCMXC,CONST,ExpPW if(ExpPW.gt.ExpPWC) Expot = 0. if(Expot.ne.0.) Expot = Exp(-ExpPW) VVNT = VVNT + VVF*Expot ANVVNT = ANVVNT + Expot end if C if(I.eq.40.and.J.eq.9) print *, I,J,NN,XCnTV,XCnTG,XCMXC,EXpPW,VVF,VVNT,ANVVNT C if(I.eq.40.and.J.eq.9) print *, VVV end do if(ANVVNT.ne.0.) then VVD(I,J,N) = VVNT/ANVVNT else VVD(I,J,N) = BAD end if end if C if(I.eq.1.and.J.eq.1.and.N.eq.1) print *, I,J,N,VVD(I,J,N) C if(I.eq.40.and.J.eq.9) print *, I,J,N,VVD(I,J,N) end do end do end do end if return end