X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 18 Aug 2010 07:38 AM by  anon
Using the 'where' function makes converts a 2-d array to a 1-d array
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
18 Aug 2010 07:38 AM
    Hi all- I am using ENVI+IDL to calculate EVI from MODIS images. It uses a times series with each band becoming a band in a multi-band image. I then use the 'where' function to mask out values before calculating mean, max, min, median values. Unfortunately when I use the 'where' function my multi-band image becomes 1 diemensional, and my calculations do not work. They work fine before using the where function. Here is how I use the function good_data=temp[where(temp GT 0 AND temp LE 1)] Thanks for your help- Eric

    Deleted User



    New Member


    Posts:
    New Member


    --
    18 Aug 2010 07:51 AM
    I'm not sure exactly what you're trying to do with the WHERE function, but it sounds like you're misunderstanding it. WHERE returns a vector with the one-dimensional subscripts of the elements of the input variables that meet the criteria. So, your expression looks like it's finding all of the locations in the temp array that have values between 0 and 1, and then it's putting the values from those locations (removed from their original arrangement in the temp array) into a new variable called good_data. So, good_data is just a vector of values between 0 and 1. It's no longer an image (assuming that temp was an image). Is that the problem? What is it that you want good_data to be, exactly?

    Deleted User



    New Member


    Posts:
    New Member


    --
    18 Aug 2010 12:45 PM
    Thanks Whammer- Yes, I am misusing the function. What I would like to do within each stacked 11 band image is calculate the mean, median, max, and min for each pixel, and return this as a new image. All of the values should be between 0 and 1, however there are some irregularities (snow, water, ??) in the images that return negative values or values greater than 1. We would like to not include these values in the calculations as they are incorrect and would bias the statistical results. Your help is appreciated- Eric
    You are not authorized to post a reply.