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

Home » Public Forums » archive » Re: Rescaling byte (0-200) ndvi to -1 to 1 values
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
Re: Rescaling byte (0-200) ndvi to -1 to 1 values [message #80852] Fri, 20 July 2012 07:01 Go to next message
Narnia is currently offline  Narnia
Messages: 5
Registered: July 2012
Junior Member
Well, Dr. Coyote, you're the untouchable hero, I've drooling over your website quite a bit :P

On Friday, July 20, 2012 4:07:51 PM UTC+3, David Fanning wrote:
> Narnia writes:
>
> > You're my hero, thank you so much! It's perfect.
>
> Geez, I might start answering questions again!
>
> Cheers,
>
> David
>
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Rescaling byte (0-200) ndvi to -1 to 1 values [message #80853 is a reply to message #80852] Fri, 20 July 2012 07:05 Go to previous messageGo to next message
Narnia is currently offline  Narnia
Messages: 5
Registered: July 2012
Junior Member
That would be a good idea, Dr. Coyote; I've been 'drooling' over your website quite a bit :)

On Friday, July 20, 2012 4:07:51 PM UTC+3, David Fanning wrote:
> Narnia writes:
>
> > You're my hero, thank you so much! It's perfect.
>
> Geez, I might start answering questions again!
>
> Cheers,
>
> David
>
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Rescaling byte (0-200) ndvi to -1 to 1 values [message #80854 is a reply to message #80852] Fri, 20 July 2012 06:07 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Narnia writes:

> You're my hero, thank you so much! It's perfect.

Geez, I might start answering questions again!

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Rescaling byte (0-200) ndvi to -1 to 1 values [message #80855 is a reply to message #80854] Fri, 20 July 2012 06:03 Go to previous messageGo to next message
Narnia is currently offline  Narnia
Messages: 5
Registered: July 2012
Junior Member
You're my hero, thank you so much! It's perfect.


On Thursday, July 19, 2012 9:18:39 PM UTC+3, Narnia wrote:
> I'm using the eMODIS 10-day product from the USGS with this description: "MODIS NDVI data are stretched (mapped) linearly (to byte values) as follows:
> [-1.0, 1.0] -> [0, 200]
> Invalid Values: 201 - 255
>
> NDVI = (value – 100) / 100; example: [ (150 – 100) / 100 = 0.5 NDVI ]"
>
> I am trying thus to scale the data in ENVI just using Band Math [expression:((b1-100)/100)] and all the values I get are 0 across my entire image. Any thoughts as to why?
>
> Secondly, I need to do this for over 400 images; can someone suggest a quick script that can read and scale this data in IDL? I tried 'ScaledImage' but i keep getting errors as well...
>
> Thank you so much!
Re: Rescaling byte (0-200) ndvi to -1 to 1 values [message #80861 is a reply to message #80855] Thu, 19 July 2012 13:13 Go to previous messageGo to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Hello,

On 07/19/12 15:19, Narnia wrote:
> Thanks a lot, Paul, that makes sense of course but (I'm a real beginner with IDL), I'm still not sure how I would
> implement that as far as calling in the images and declaring that to run and scale all the images in my folder! :(

Well, let's assume you already have a function that reads the image data (I can't help with that one). Let's call it
"read_image" and assume it looks something like:

FUNCTION Read_Image, Filename
...open file...
...read image data...
RETURN, image_data
END

Your scaling function could look like

FUNCTION Scale_Image, Input_Image
output_image = FLOAT(Input_Image)
output_image = (output_image - 100.0) / 100.0
RETURN, output_image
END

Then you can loop over your filenames on the command line

IDL> files = FILE_SEARCH("path/to/data/emodis.filename.*")
IDL> FOR n = 0, N_ELEMENTS(files) DO BEGIN & scaled_image = Scale_Image(Read_Image(files[n])) & ...display... & ENDFOR

?

cheers,

paulv
Re: Rescaling byte (0-200) ndvi to -1 to 1 values [message #80863 is a reply to message #80861] Thu, 19 July 2012 12:19 Go to previous messageGo to next message
Narnia is currently offline  Narnia
Messages: 5
Registered: July 2012
Junior Member
Thanks a lot, Paul, that makes sense of course but (I'm a real beginner with IDL), I'm still not sure how I would implement that as far as calling in the images and declaring that to run and scale all the images in my folder! :(



On Thursday, July 19, 2012 9:18:39 PM UTC+3, Narnia wrote:
> I'm using the eMODIS 10-day product from the USGS with this description: "MODIS NDVI data are stretched (mapped) linearly (to byte values) as follows:
> [-1.0, 1.0] -> [0, 200]
> Invalid Values: 201 - 255
>
> NDVI = (value – 100) / 100; example: [ (150 – 100) / 100 = 0.5 NDVI ]"
>
> I am trying thus to scale the data in ENVI just using Band Math [expression:((b1-100)/100)] and all the values I get are 0 across my entire image. Any thoughts as to why?
>
> Secondly, I need to do this for over 400 images; can someone suggest a quick script that can read and scale this data in IDL? I tried 'ScaledImage' but i keep getting errors as well...
>
> Thank you so much!
Re: Rescaling byte (0-200) ndvi to -1 to 1 values [message #80868 is a reply to message #80863] Thu, 19 July 2012 11:41 Go to previous messageGo to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
On 07/19/12 14:18, Narnia wrote:
> I'm using the eMODIS 10-day product from the USGS with this description: "MODIS NDVI data are stretched (mapped)
> linearly (to byte values) as follows: [-1.0, 1.0] -> [0, 200] Invalid Values: 201 - 255
>
> NDVI = (value � 100) / 100; example: [ (150 � 100) / 100 = 0.5 NDVI ]"
>
> I am trying thus to scale the data in ENVI just using Band Math [expression:((b1-100)/100)] and all the values I get
> are 0 across my entire image. Any thoughts as to why?

IDL> value = 150
IDL> help, (value - 100) / 100
<Expression> LONG = 0

IDL> value = 150.0
IDL> help, (value - 100) / 100
<Expression> FLOAT = 0.500000

>
> Secondly, I need to do this for over 400 images; can someone suggest a quick script that can read and scale this data
> in IDL? I tried 'ScaledImage' but i keep getting errors as well...

I would write one myself. Mostly since the scaling is just a one-line operation. At least you know you're getting the
correct (or wrong) answer that way. :o)

cheers,

paulv
Re: Rescaling byte (0-200) ndvi to -1 to 1 values [message #84534 is a reply to message #80861] Mon, 20 May 2013 05:39 Go to previous message
k.shemsu is currently offline  k.shemsu
Messages: 1
Registered: May 2013
Junior Member
On Thursday, July 19, 2012 11:13:32 PM UTC+3, Paul van Delst wrote:
> Hello,
>
>
>
> On 07/19/12 15:19, Narnia wrote:
>
>> Thanks a lot, Paul, that makes sense of course but (I'm a real beginner with IDL), I'm still not sure how I would
>
>> implement that as far as calling in the images and declaring that to run and scale all the images in my folder! :(
>
>
>
> Well, let's assume you already have a function that reads the image data (I can't help with that one). Let's call it
>
> "read_image" and assume it looks something like:
>
>
>
> FUNCTION Read_Image, Filename
>
> ...open file...
>
> ...read image data...
>
> RETURN, image_data
>
> END
>
>
>
> Your scaling function could look like
>
>
>
> FUNCTION Scale_Image, Input_Image
>
> output_image = FLOAT(Input_Image)
>
> output_image = (output_image - 100.0) / 100.0
>
> RETURN, output_image
>
> END
>
>
>
> Then you can loop over your filenames on the command line
>
>
>
> IDL> files = FILE_SEARCH("path/to/data/emodis.filename.*")
>
> IDL> FOR n = 0, N_ELEMENTS(files) DO BEGIN & scaled_image = Scale_Image(Read_Image(files[n])) & ...display... & ENDFOR
>
>
>
> ?
>
>
>
> cheers,
>
>
>
> paulv

Hi Paul,

I have seen your suggestion, but I don't work in IDL. Can you tell me this process in ArcGIS? Thank you in advance for your kind support. KS
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Speeding up xy distance calculations using complex numbers
Next Topic: Re: IDL8 plot

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

Current Time: Wed Oct 08 11:32:53 PDT 2025

Total time taken to generate the page: 0.00780 seconds