I am not pro in Fortran95, but I am writing a code in it and I found that I want to mask the array values with -9999, if it does not have certain values.
Example: I have an array 'X' has values vary from 0 to 32768, and I want to mask the values of the array, if 'X' value is not equal to 0,1,2,16 or 18. I solved it with the following syntax:
if (X.eq.0.or.X.eq.1.or.X.eq.2.or.X.eq.16.or.X.eq.18) then
X=X
else
X=-9999
end if
But there any other way to mask array values in FORTRAN 95?
There is the
wherestatement that can mask the array, but given the logical you have shown its a bit ugly