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

Re: matching fields in ascii or text files.

patrick@es.ucsc.edu (Patrick McEnaney) writes:
> I'm writing an idl gui script to cycle through fairly long files of
> data that are collected from a ctd and compare them with chlorophyll
> measurements from insitu sampling. I want to select the data from a
> specific depth for chlorophyll  and and write all values for that
> depth in another file. Just putting the data into excel files would be
> very cumbersome because the data are collected over a month long
> cruise and there are alot of measurements. Ultimately I'll use the
> script whenever I need to compare fields from cruise data. Can you
> suggest a way to construct such a matching routine in idl?

The solution is even easier in that case.

 wh = where(depth_list EQ depth)

Now WH are the indices of depths in DEPTH_LIST which have the same
depth as DEPTH.  Wow, I hope that was intelligible.

The problem with this approach is that if you want to select out many
many DEPTHs in a loop, you will start to slow down because you are
essentially doing an N^2 operation (ie, searching the entire
DEPTH_LIST every time).  In that case you may care to revert to
something else.


Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response