X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 05 Nov 2010 02:16 PM by  anon
idl-band math expression with a variable
 6 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
05 Nov 2010 02:16 PM
    Hi, It's my first time in a forum, i hope we can help each other. Well, I'm trying to calculate the WDVI index but I can't put the slope soil into the expression of math_doit, it doesn't recononise, it said that my variable is undefined. Also, I tested using with making a function of the index, but it doesn't work. So, my question is How can i put this variable in the band math expression??.. in this case "ss". The first expr is NDVI and the second is the WDVI. Here is a part of the scrip that i mentioned, I read the image and applied ENVI_VEG_SUPPRESS_DOIT to get the soil slope. Here, rj is a vector in bytes of the red band and ir of the NIR band. If someone knows a better form of calculate the soil slope please tell me, bacause i work with aerial photos and they are always in differentes possicions and sometime can include channels with water. num_index=2 coeff=LINFIT(rj, ir) YFIT = coeff[0] + coeff[1]*rj ss=coeff[1] fid_w1=[fid_w,fid_w] out_fid=lonarr(num_index) expr=['(float(b2)-float(b1))/(float(b2)+float(b1))','float(b2)-(ss)*(float(b1))'] for i=0,num_index-1 do begin envi_doit, 'math_doit', dims=dims, exp=expr[i], pos=[0,1], fid=fid_w1, /IN_MEMORY, r_fid=r_fid out_fid[i]=r_fid endfor Thanks in advance Mariella

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    09 Nov 2010 11:38 AM
    First, you cannot have an expression that has multiple equations in it (it cannot be an array). Each equation you want to use in Band Math will require another call to band math. In order to pass in a parameter as part of your expression, it must be converted to a string. For example: ENVI> ss=3.0 ENVI> expression = 'float(b2)- '+strtrim(string(ss),2)+' *(float(b1))' ENVI> help, expression EXPRESSION STRING = 'float(b2)- 3.00000 *(float(b1))'

    Deleted User



    New Member


    Posts:
    New Member


    --
    24 Nov 2010 07:34 AM
    Thanks MariM I see that my expression was wrong because I had to convert my variable into a string format, but I don't understand why you said that I can't make an array of expressions, and call one by one with a "for". Because I was tested in the same program that I sent and it works very good. And tell me please, what do you think about ENVI_VEG_SUPPRESS_DOIT to get the soil slope or maybe you know a better way to calculate the soil slope for an image. Thanks a lot Marita

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    24 Nov 2010 09:26 AM
    Yes, I didn't see your for loop, so this does work because you are calling the routine in each loop with a separate expression. The vegetation supporession tool is designed to remove the vegetation spectral signature from an image so you can see the underlying features. It is not a way to calculate slope. Slope is calculated from a digital elevation model.

    Deleted User



    New Member


    Posts:
    New Member


    --
    15 Dec 2010 11:46 AM
    Hello MariM and IDL community I was talking about soil slope of the vegetation index - WDVI ( slope of the linear trend between Red and IR bands of a fraction of soil ). That's because i want to program the extraction of bands values of differents images in differents positions, and without vegetation extraction if the fraction of soil includes vegetation, the linear trend is more dispersed. I'm not sure of using it because the slope is better, but there is a little dispersed too. So, i would like to know how ENVI_VEG_SUPPRESS_DOIT remove the vegetation spectral signature?? Also I'm starting working with WIDGETS, but i can't understand how can I create a widget for georeference images with control points identified in the program and that I can check and modify them in the widget. I'll appreacite any help about widgets logic and structures!!! an 'llll Thanks Marita

    Deleted User



    New Member


    Posts:
    New Member


    --
    15 Dec 2010 11:55 AM
    Hello MariM and IDL community I was talking about soil slope of the vegetation index - WDVI ( slope of the linear trend between Red and IR bands of a fraction of soil ). That's because i want to program the extraction of bands values of differents images in differents positions, and without vegetation extraction if the fraction of soil includes vegetation, the linear trend is more dispersed. I'm not sure of using it because the slope is better, but there is a little dispersed too. So, i would like to know how ENVI_VEG_SUPPRESS_DOIT remove the vegetation spectral signature?? Also I'm starting working with WIDGETS, but i can't understand how can I create a widget for georeference images with control points identified in the program and that I can check and modify them in the widget. I'll appreacite any help about widgets logic and structures!!! an 'llll Thanks Marita

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    21 Dec 2010 10:03 AM
    There is a reference in the ENVI help regarding Vegetation Suppression you might read to help interpret the results from this tool.
    You are not authorized to post a reply.