Search code examples
indexingdata-manipulationlarge-data

Remove values from IDL array


I have a variable named wl which has a value range from 900 to 30000, another variable name f is dependent on it. I want to remove values below 1280 from both of these variables.

What I've done is

pO = WHERE(wl < 1280)

But when I remove them with remove it can't remove error since it needs an array of indices to remove and checking the type of pO yields long.


Solution

  • Long time no see. I found the answer to my question with IDL keyword WHERE. To select the range of indices to be subtracted from my wl, f and ivar variables what I did was

    ii = WHERE(wl LE 1280)
    REMOVE, ii, wl, f, iv  
    

    and tadaah, the values were removed. For values in between you can use

    jj = WHERE(wl LE 1280 AND wl GE 1200)
    REMOVE, jj, wl, f, iv  
    

    Happy IDLing