C+ C NAME: C ArrR4Mask C PURPOSE: C Apply mask to real*4 array C CALLING SEQUENCE: subroutine ArrR4Mask(N,A,AVal,TrueInt,TrueSlope,FalseInt,FalseSlope,C) C INPUTS: C N integer # elements in A C A(abs(N)) real real array to be processed C AVal real test value C TrueInt real y-intercept when A tests 'true' C TrueSlope real slope when A tests 'true' C FalseInt real y-intercept when A tests 'false' C FalseSlope real slope when A tests 'false' C C(abs(N)) real array to be 'masked' C OUTPUTS: C C(abs(N)) real modified real array C CALLS: C BadR4 C SEE ALSO: C Array_Info C PROCEDURE: C Each element in A is compared with value AVal. C Where A is equal to AVal (A .eq. AVal tests 'true') the value of C is C scaled linearly using TrueInt and TrueSlope. Where B is NOT equal to AVal C the value in C is scaled linearly using FalseInt and FalseSlope. C EXAMPLE: C call ArrR4Mask(N, A, BadR4(), 0.0,0.0, 0.0, 1.0, C) C C sets elements C to zero, where A is BadR4(), while not changing the 'good' values. C MODIFICATION HISTORY: C ???-????, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- integer N real A(*) real AVal real TrueInt real TrueSlope real FalseInt real FalseSlope real C(*) logical bTrue logical bFalse !$omp parallel private(bad,bTrue,bFalse,iA,iC,I,I1,I2,I3) bad = BadR4() bTrue = TrueInt .ne. 0. .or. TrueSlope .ne. 1. bFalse = FalseInt .ne. 0. .or. FalseSlope .ne. 1. iA = loc(A) iC = loc(C) call ArrayLoc2(iA,iC,abs(N),4,I1,I2,I3) !$omp do schedule(static) do I=I1,I2,I3 if (N .gt. 0 .or. C(I) .ne. bad) then if (A(I) .eq. AVal) then if (bTrue ) then if (TrueInt .eq. bad) then C(I) = bad else C(I) = TrueInt +TrueSlope *C(I) end if end if else if (bFalse) then if (FalseInt .eq. bad) then C(I) = bad else C(I) = FalseInt+FalseSlope*C(I) end if end if end if end if end do !$omp end do nowait !$omp end parallel return end