[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Correlate and NAN

How about using just the coincident valid data pairs that you can get
using FINITE and GET_INTERSECTION functions?

ind_1 = where(finite(data_set_1))
ind_2 = where(finite(data_set_2))
index = Setintersection(ind_1, ind_2)
result = correlate(data_set_1[index], data_set_2[index])

"Setintersection" is posted on David's home page,
http://www.dfanning.com/tips/set_operations.html. Although it is called
there *Setintersection*, although it does not *set* anything, it returns
what you need :-)


Ben Tupper wrote:
> Hello,
> I have two datasets that I would like to correlate using the CORRELATE
> function.  Each dataset has some members flagged as NANs; the NANs are
> not neccessarily coincident.   The online documentation makes no mention
> of NAN-handling, but the procedure in the lib directory indicates (see
> modifications history) that it handles NANs (although there is no
> keyword for it).  It doesn't really handle NANs the way I expect it
> to.   For example, repeated calls to the TOTAL function don't set the
> keyword NAN, so TOTAL doesn't check for NANs.
> I'm not sure if it is reasonable to involve NANs in a correlation... but
> it seems reasonable to request that the routine ignore NANs in the input
> arguments.
> Is there a simple solution to this NAN-jam?
> Thanks,
> Ben
> --
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 180 McKown Point Rd.
> W. Boothbay Harbor, ME 04575
> btupper@bigelow.org