C+ C NAME: C ExtractMap C PURPOSE: C Extracts interpolated velocity and density IPS deconvolved maps. C CALLING SEQUENCE: subroutine ExtractMap(RS,RR,dRR,XCbeg,XCend,nLng,nLat,nRad,V,D, & XC3D,Vratio,Dratio,XCstrt,iLng,VS,DS) C INPUTS: C RS real height where V and D needed (AU) C RR real reference height (AU) C dRR real radial grid spacing (AU) C XCbeg real start Carrington variable of arrays C XCend real end Carrington variable of arrays C (if I__MOD=1 then XCend-XCbeg should be an integer) C nLng integer # longitudes covering [XCbeg,XCend] C nLat integer # latitudes covering [-90,90] deg C nRad integer # heliocentric distances C V(nLng,nLat) real velocity array at RR C D(nLng,nLat) real normalized density array at RR C XC3D(nLng,nLat,nRad) real shift amount from array C Vratio (nLng,nLat,nRad) real velocity ratio C Dratio (nLng,nLat,nRad) real normalized density (nr^2) ratio C XCstrt real Carrington variable at start of map to be extracted C iLng integer # longitudes to be extracted C OUTPUTS: C VS(iLng,nLat) real velocities at RS C DS(iLng,nLat) real normalized densities (nr^2) at RS C CALLS: C BadR4, FLINT C INCLUDE: C include 'mapcoordinates.h' C RESTRICTIONS: C If any of the extraction points is outside the range [1,nLng] by more than one, C then BadR4() is returned for density and velocity C PROCEDURE: C > The input arrays are defined at locations i=1,nLng. C Velocities and normalized densities are extracted at locations xLng+(i-1), i=1,iLng C > All grid points (I,J) at height RS are traced back to the reference surface RR C using the XC3D array. Density and velocity at each grid point at heigh RS are C calculated from the Vratio and Dration arrays. C > If the traced back position is outside the range [XCbeg,XCend] then it is scaled C back into the [XCbeg,XCend] by doing a mod(XC,XCend-XCbeg). C > Density and velocity at the source surface are calculated by interpolating on C the D and V arrays using the traced-back locations at the source surface. C > If I__MOD=2 then the traced-back position may end up outside [XCbeg,XCend]. If they C are more than 1 grid spacing away, the value BadR4() is returned for density and C velocity. Within one grid spacing the values are extrapolated. C MODIFICATION HISTORY: C MAR-1994, Paul Hick (UCSD/CASS); original version written at STELab C APR-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C Added arguments xLng and iLng to allow for extraction of a map covering C less than the full range from XCbeg to XCend C- real V (nLng,nLat) real D (nLng,nLat) real XC3D (nLng,nLat,nRad) real Vratio (nLng,nLat,nRad) real Dratio (nLng,nLat,nRad) real VS (iLng,nLat) real DS (iLng,nLat) integer N(3) real P(3) real Tiny /0.0/ include 'mapcoordinates.h' N(1) = nLng N(2) = nLat N(3) = nRad Bad = BadR4() XCrange = XCend-XCbeg xLng = XCindx(XCstrt) P(3) = RRindx(RS) ! P is location where D,V are needed do J=1,nLat P(2) = J do I=1,iLng P(1) = xLng-iLng+I VR = FLINT(3,N,Vratio ,P,Tiny) ! Velocity ratio at P DR = FLINT(3,N,Dratio ,P,Tiny) ! Normalized density ratio at P XL = FLINT(3,N,XC3D ,P,Tiny) ! Shift to trace P to RR P(1) = XCindx(XCfullX(P(1))+XL) ! P traced to RR on scale [1,nLng] VS(I,J) = FLINT(-2,N,V,P,Tiny) ! Velocity at RR if (VS(I,J) .ne. Bad) VS(I,J) = VS(I,J)*VR ! Velocity at RS DS(I,J) = FLINT(-2,N,D,P,Tiny) ! Norm density at RR if (DS(I,J) .ne. Bad) DS(I,J) = DS(I,J)*DR ! Norm density at RS end do end do return end