Antonio Valentino wrote:
Is it possible to extract the module (and possibly the phase) of a
complex dataset using GDAL utilities or playing with the virtual driver?

If I use
  $ gdal_translate -ot Float64 src_dataset dst_dataset

on a complex src_dataset it seems to extract the real part.

Antonio,

I am not aware of any way to accomplish this with the virtual driver
or the commandline utilities. But I have added a small sample script doing
this with numpy and python if you would be interested in working from that.

  http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/python/samples/magphase.py

import gdal
import gdalnumeric
try:
    import numpy
except:
    import Numeric as numpy


src_ds = gdal.Open('complex.tif')
xsize = src_ds.RasterXSize
ysize = src_ds.RasterYSize

src_image = src_ds.GetRasterBand(1).ReadAsArray()
mag_image = pow(numpy.real(src_image)*numpy.real(src_image) \
                + numpy.imag(src_image)*numpy.imag(src_image),0.5)
gdalnumeric.SaveArray( mag_image, 'magnitude.tif' )

phase_image = numpy.angle(src_image)
gdalnumeric.SaveArray( phase_image, 'phase.tif' )


I was also impressed to discover today that the numpy manual is now
finally free.

  http://www.tramy.us/numpybook.pdf

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [EMAIL PROTECTED]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to