C+ C NAME: C CopyDtoDVN C PURPOSE: C Make density maps at the velocity map time cadence. Velocity and density maps of the same latitude and longitude C grid spacing must be input. The Carrington rotation beginning and endings at each time are imput, but can change C with time as long as their interval lengths remain constant. Thus, either a corotating (tested) or an inertial C set of maps can be converted. C If Mode = 0, then only an interpolated value of the density map is transferred. C If Mode = 1, then an interpolated value of the density map is transferred plus an interpolated map out to many C sigma in time at that longitude. C If Mode = 2, then the interpolated value is cut off at the 1.5 times the velocity temporal interval - C i.e. one time from the non-valid value in time. 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*8 Beginning V time (XCtbegV) C XCtend real*8 Ending V time (XCtendV) C XCtbegG real*8 Beginning G time C XCtendG real*8 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 the velocity time interval) C DD(nLng,nLat,nTG) real Density map C OUTPUTS: C DDV(nLng,nLat,nTV) real Density map interpolated at the velocity time cadence C SCRATCH ARRAYS: C DDT(nTG) real C DDD(nLng) real C CALLS: C PROCEDURE: C Bad values (indicated by BadR4()) are not processed in Mode 0 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 /0.1/ real*8 XCtbeg,XCtend,XCtfull,X,XCtbegV,XCtendV,XCtbegG,XCtendG include 'mapcoordinates.h' Bad = BadR4() ExpPWC = 50.0 do J=1,nLat ! Latitudes are at the same grid locations at the boundary do I=1,nLng ! Longitudes and do N=1,nTG DDT(N) = DD(I,J,N) end do do N=1,nTV ! Interpolate for available density values at the velocity times nT = nTV nT1 = nT-1 TI = XCtvar(XCtfull(N)) DDV(I,J,N) = FLINT(-1,nTG,DDT,TI,0.00002) end do end do end do C If no density values are present at the given velocity time, then fill in these values if possible using interpolated C non-Bad time values at the same longitude and latitude, but at different density times. 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.0 ANDDNT = 0.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,0.00002) if (DDF .ne. Bad) then XCtbeg = XCtbegG XCtend = XCtendG nT1 = nTG-1 XCnTG = XCtfull(NN) XCMXC = (XCnTV-XCnTG)/sngl(XCtendV-XCtbegV)*nTV1 ExpPW = (XCMXC/CONST)**2 Expot = 999999.0 if (ExpPW .gt. ExpPWC) Expot = 0.0 if (Mode .eq. 2 .and. abs(XCMXC) .gt. 1.5) Expot = 0.0 if (Expot .ne. 0.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.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 CopyVtoVDN C PURPOSE: C Make velocity maps at the density map time cadence. Velocity and density maps of the same latitude and longitude C grid spacing must be input. The Carrington rotation beginning and endings at each time are imput, but can change C with time as long as their interval lengths remain constant. Thus, either a corotating (tested) or an inertial C set of maps can be converted. C If Mode = 0, then only an interpolated value of the velocity map is transferred. C If Mode = 1, then an interpolated value of the velocity map is transferred plus an interpolated map out to many C sigma in time at that longitude. C If Mode = 2, then the interpolated value is cut off at the 1.5 times the density temporal interval - C i.e. one time from the non-valid value in time. 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 the density 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 CALLS: C PROCEDURE: C Bad values (indicated by BadR4()) are not processed in Mode 0 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 /0.1/ real*8 XCtbeg,XCtend,XCtbegV,XCtendV,XCtbegG,XCtendG include 'mapcoordinates.h' Bad = BadR4() C print *, 'Inputs Inside CopyVtoVDN', Mode,XCtbeg,XCtend,XCtbegV,XCtendV,nLng,nLat,nTV,nTG,ConsT ExpPWC = 50.0 do J=1,nLat ! Latitudes are at the same grid locations at the boundary do I=1,nLng ! Longitudes and do N=1,nTV VVT(N) = VV(I,J,N) end do do N=1,nTG ! Interpolate for available velocity values at the density times nT = nTG nT1 = nT-1 TI = XCtvar(XCtfull(N)) VVD(I,J,N) = FLINT(-1,nTV,VVT,TI,0.00002) C if(I.eq.40.and.J.eq.4.and.N.eq.23) print *, I,J,N,VVD(I,J,N) C if(I.eq.40.and.J.eq.4.and.N.eq.24) print *, I,J,N,VVD(I,J,N) end do end do end do C If no velocity values are present at the given density time, then fill in these values if possible using interpolated C non-Bad velocity values at the same longitude and latitude, but at different times. 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) print *, I,J,N,VVD(I,J,N) C if(I.eq.40.and.J.eq.4.and.N.eq.23) print *, I,J,N,VVD(I,J,N) C if(I.eq.40.and.J.eq.4.and.N.eq.24) 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) if (VVD(I,J,N) .eq. Bad) then VVNT = 0.0 ANVVNT = 0.0 XC = XCvar(XCfull(I)) ! This is the density and/or velocity longitude location at this time do NN=1,nTV do II=1,nLng VVV(II) = VV(II,J,NN) end do VVF = FLINT(-1,nLng,VVV,XC,0.00002) C if(I.eq.40.and.J.eq.4.and.N.eq.23) print *, I,J,N,NN,XC,VVF if (VVF .ne. Bad) then XCtbeg = XCtbegV XCtend = XCtendV nT1 = nTV-1 XCnTV = XCtfull(NN) XCMXC = (XCnTV - XCnTG)/sngl(XCtendG-XCtbegG)*nTG1 Expot = 999999.0 ExpPW = (XCMXC/CONST)**2 if (Mode .eq. 2 .and. abs(XCMXC) .gt. 1.5) Expot = 0.0 if (ExpPW .gt. ExpPWC) Expot = 0.0 if (Expot .ne. 0.0) Expot = Exp(-ExpPW) C if(I.eq.30.and.J.eq.4.and.N.eq.40) print *, I,J,N,NN,XCMXC,CONST,ExpPW,VVF,VVNT,Expot,ANVVNT C if(I.eq.40.and.J.eq.4.and.N.eq.23) print *, I,J,N,NN,XCMXC,CONST,ExpPW,VVF,VVNT,Expot,ANVVNT C if(I.eq.40.and.J.eq.4.and.N.eq.24) print *, I,J,N,NN,XCMXC,CONST,ExpPW,VVF,VVNT,Expot,ANVVNT 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.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) print *, I,J,N,VVD(I,J,N) C if(I.eq.40.and.J.eq.4.and.N.eq.23) print *, 'FINAL VALUE',I,J,N,VVD(I,J,N) C if(I.eq.40.and.J.eq.4.and.N.eq.24) print *, 'FINAL VALUE',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