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

Home » Public Forums » archive » Re: Removing unwanted data from a structure
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: Removing unwanted data from a structure [message #84129] Fri, 26 April 2013 13:14 Go to next message
cab581 is currently offline  cab581
Messages: 7
Registered: April 2013
Junior Member
That pretty much solves it, I just have to adapt it to my specific structure.

Thanks very much.

As for 3), I must have been misinformed, or maybe the precise syntax I was using wasn't able to work with structures, but your suggestion works for me.
Re: Removing unwanted data from a structure [message #84134 is a reply to message #84129] Fri, 26 April 2013 10:08 Go to previous messageGo to next message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
A couple of things:

1) Do you have a structure of arrays? If so, then something like this should work:

FOR i=0, N_TAGS(str)-1 DO BEGIN
ind = WHERE(str.(i) LT -100, count)
IF count NE 0 THEN str.(i)[ind] = !VALUES.F_NAN
ENDFOR

2) A word of warning: if any of the fields are not floating point values, this won't work. Using the code as is will result in the "error" values assigned to zero, and a warning about Floating Illegal Operand will be issued. This is caused because the type of a field in a structure can not be changed.

3) I'm told that you can't use IF statements with structures

In what sense?
Re: Removing unwanted data from a structure [message #84277 is a reply to message #84129] Wed, 08 May 2013 11:47 Go to previous message
cab581 is currently offline  cab581
Messages: 7
Registered: April 2013
Junior Member
I'm back for more!

I'm trying to sift through my data to remove unwanted values. Previously I was removing data as it read out of a file, so the code worked fine. Now It's a bit more complex.

FOR I = 0, 17 DO BEGIN
FOR J = 0, 99 DO BEGIN
ind = where(STRUCT.(6)[J] GT MED[i,j], count)
IF count NE 0 THEN STRUCT.(6)[ind] = !values.F_Nan
MEAN[I,J] = MEAN(STRUCT.(6)[J], /double, /NAN)
ENDFOR
ENDFOR

I have lots of data. I have two dimensions (altitude, J and 10 degree latitude bins, I) within each data set. I have calculated the median (MED) for each I,J section in the structure. I want run through every single point in all of my files and remove those that are greater than that median. The problem with what I have written is that (I think!) it's looking for where every value across the whole of STRUCT.(6) are greater than the median, not the individual values within STRUCT.(6)

Thanks in anticipation
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL Workbench & jumping back to STOP/breakpoints
Next Topic: TIFF Read/Write Bug?

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

Current Time: Wed Oct 08 11:45:45 PDT 2025

Total time taken to generate the page: 0.00534 seconds