C+ C NAME: C SplineGridY C PURPOSE: C Interpolation of 2D arrays in vertical direction. C CATEGORY: C Interpolation using natural spline C CALLING SEQUENCE: subroutine SplineGridY(iFlag,YN1,YN2,YM1,YM2,NX,NY,ZN,MY,ZM) C INPUTS: C iFlag integer 1st bit set: flag bad point in output ZM if C nearest grid point in ZN is bad. C C 2nd bit set: if the range [YM1,YM2] extends C outside [YN1,YN2] then y-coordinates outside C [YN1,YN2] are mapped back inside C by a mod (YN2-YN1) operation. C YN1 real y-coordinate of 1st row of input ZN C YN2 real y-coordinate of last row of input ZN C YM1 real y-coordinate of 1st row of output ZM C YM2 real y-coordinate of last row of output ZM C NX integer horizontal dimension of ZN C NY integer vertical dimensions of ZN C ZN(NX,NY) real fnc-values C MY integer new vertical dimension C OUTPUTS: C ZM(NX,MY) real interpolated fnc-values C CALLS: C ArrR4Step, Say, SplineY C RESTRICTIONS: C The in- and output user-coordinate ranges must be non-zero C PROCEDURE: C > 1st bit of iFlag is set: for each grid point of the output grid the C nearest grid point of the output grid is determined. If this nearest C point was flagged (contained value BadR4()) then the value of the C output grid is also flagged. C !! `Nearest' means the nearest grid point in the C in the vertical direction only (along a single column). C C > For each column in ZN a spline is calculated, using all valid fnc-values C in that column. The ordinate for the spline is assumed to run from C YN1 to YN2. The spline is then used to interpolate fnc-values in C evenly spaced ordinate values between YM1 and YM2. C > If the column dimension is not changed, SplineGridY has the effect of C filling in the invalid function values (if 1st bit of iFlag is set) C MODIFICATION HISTORY: C JUL-1993, Paul Hick (UCSD/CASS) C APR-1994, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C added argument bFlag to control flagging of function values in the output array C MAY-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C added arguments MY and ZM to allow changes in horizontal dimension C Note that the old functionality is retained by setting MY=NY, ZM=ZN C Changed logical argument bFlag to integer argument iFlag. The original bFlag C functionality is now controlled by the first bit in iFlag. The second bit C is now used to contol the mod( YN2-YN1 ) behavior. C- integer iFlag real YN1 real YN2 real YM1 real YM2 integer NX integer NY real ZN(NX,NY) ! Input data array integer MY real ZM(NX,MY) ! Output data array character cSay*11 /'SplineGridY'/ parameter (NMAX = 1000) real YN(NMAX) real YM(NMAX) if (max(NY,MY) .gt. NMAX) call Say(cSay,'E','Not enough','scratch space. Increase parameter NMAX') call ArrR4Step(YN1,(YN2-YN1)/(NY-1),NY,YN) ! Input Y-coordinates call ArrR4Step(YM1,(YM2-YM1)/(MY-1),MY,YM) ! Output X-coordinates call SplineY(iFlag,NY,YN,MY,YM,NX,ZN,ZM) return end