subroutine intrp(rh1,rh2,rh,x1,x2,x) c c Linear interpolation of x between x1 and x2 at time rh c between rh1 and rh2. If rh1=0 than x=x2. c INPUT: c RH {real*8}: The requested time to interpolate to. c RH1 {real*8}: The lower boundary of the time interval. c RH2 {real*8}: The upper boundary of the time interval. c X1: {real*4}: Data value at the lower boundary. c X2: {real*4}: Data value at the upper boundary. c OUTPUT: c X: {real*4}: Interpolated data at time RH. c c The time variables are double precision because they are c large numbers (decimal hours from 1977) very close to each other. c real*8 rh1, rh2, rh c c Check if RH1 is zero indicating that no interpolation should c be made just the value of X2 taken. c c write(6,1295) rh1 1295 format('rh1: ', F8.1) if (rh1 .eq. 0.d0) then x = x2 return endif c c Fractional increment for x c frac = (rh-rh1)/(rh2-rh1) c c Interpolate c x = x1 + frac*(x2-x1) c return end