It's not entirely clear what your problem is, or perhaps you have several problems. If you have a complex variable called, say, z
, then you can pass its real and imaginary components to atan2
with a call such as
atan2(aimag(z),real(z))
The functions real
and aimag
extract the components of a complex number. If you are working with non-default kinds then these functions also understand kinds, so a call such as real(z,real64)
will, if real64
is a kind-type parameter, extract the real component of z
with real64
kind.
Note that these functions are both elemental
which means that they can be applied to each element of an array and return an array of elements; so a call such as
real(z_array)
will return an array of reals with the same shape as z_array
.
It looks to me as if you should be able to read the complex values directly from the file and then decompose them for your calls to atan2
.