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

Home » Public Forums » archive » Re: segment vector with missing data
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: segment vector with missing data [message #63360 is a reply to message #63359] Tue, 04 November 2008 13:47 Go to previous messageGo to previous message
Brian Larsen is currently offline  Brian Larsen
Messages: 270
Registered: June 2006
Senior Member
While David is on the right track this might not be quite what you
want... This could be a label_regions problem if I understand
correctly.

you have something like
[1,2,3,NaN,4,3,4,3,NaN,NaN,NaN,4]
and you want
[1,2,3]
[4,3,4,3]
Do I have this right?

If so one solution is:
IDL> NaN=!values.f_nan
IDL> a=[1,2,3,NaN,4,3,4,3,NaN,NaN,NaN,4]
IDL> mask=finite(a)
IDL> mask=[0,mask,0] ; stupid edges in label_region
IDL> roi=label_region(mask)
IDL> roi=roi[1:n_elements(roi)-2]
IDL> print, roi
1 1 1 0 2 2 2 2
0 0
0 3

then use histogram and reverse_indices to pull out the different bins.
IDL> hist=histogram(roi, reverse_indices=ri)

read http://www.dfanning.com/tips/histogram_tutorial.html to figure
this out, I have to each time.





Brian


------------------------------------------------------------ --------------
Brian Larsen
Boston University
Center for Space Physics
http://people.bu.edu/balarsen/Home/IDL
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Moving to objects loses array functionality?
Next Topic: How does IDL locate netCDF?

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

Current Time: Thu Oct 09 21:08:33 PDT 2025

Total time taken to generate the page: 0.72248 seconds