comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » please help with ndvi calculation
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
please help with ndvi calculation [message #52835] Thu, 01 March 2007 21:09
beardown911 is currently offline  beardown911
Messages: 21
Registered: March 2007
Junior Member
Hello all,

I am new in idl programming, and have been trying to figure out to
write a simple code to calculate ndvi.

Here is what I've done, but gave weird value.
------------------------------------------------------
pro ndvi
image = read_tiff ('/rsi/idl62/training/data/image.tif')
help, image

sub = float(image[0,*,*]-image[1,*,*])
sum = float(image[0,*,*]+image[1,*,*])

ndvi_image = sub / sum

write_tiff, '/rsi/idl62/training/data/ndvi_test.tif', ndvi_image
end
-------------------------------------------------------
The image.tif have three bands(nir, red, green) 8 bit image.
The resulting ndvi image is still integer and values are totally
wrong.
Could anybody help me to fix this?

Thank you,
Phil
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How can I multi-plot in IDL with the coordinates set by myself?
Next Topic: Re: please help with ndvi calculation

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 22:11:07 PDT 2025

Total time taken to generate the page: 1.12123 seconds