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

Home » Public Forums » archive » Re: Duplicate lat/long points
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: Duplicate lat/long points [message #64680] Wed, 14 January 2009 07:19 Go to next message
hethomas is currently offline  hethomas
Messages: 19
Registered: December 2008
Junior Member
Thank you both for your responses, they are definitely making me think
about alternative ways to tackle this.

However, Brian - I am struggling to see how you use histogram to do
this. Do you have an example of this that you wouldn't mind sharing so
that I can see more clearly what you mean?

Thanks again.

Helen
Re: Duplicate lat/long points [message #64685 is a reply to message #64680] Wed, 14 January 2009 05:38 Go to previous messageGo to next message
Brian Larsen is currently offline  Brian Larsen
Messages: 270
Registered: June 2006
Senior Member
One other way to do this that I use pretty often is with histogram and
reverse_indices. I have to read http://www.dfanning.com/tips/histogram_tutorial.html
just about each time to be sure I get it right, but its still worth
it. What this does for you is not look for points that are the "same"
but instead give you a regular grid of your chosen size. One benefit
of this in my opinion is that a change of one variable and you can do
high-res or low-res, e.g. 1 deg or 10 deg analysis.


Cheers,

Brian

------------------------------------------------------------ --------------
Brian Larsen
Boston University
Center for Space Physics
http://people.bu.edu/balarsen/Home/IDL
Re: Duplicate lat/long points [message #64688 is a reply to message #64685] Wed, 14 January 2009 05:10 Go to previous messageGo to next message
Juggernaut is currently offline  Juggernaut
Messages: 83
Registered: June 2008
Member
On Jan 14, 5:21 am, hethomas <het...@googlemail.com> wrote:
> From searching this forum for "duplicate points" I found that a while
> back, under the thread entitled "duplicates - a new twist" my problem
> was posted (almost exactly identically) by Martin Doyle.
> [ http://groups.google.com/group/comp.lang.idl-pvwave/browse_t hread/
> thread/470ca560db41c58a/df9dba74d5788f6c?lnk=gst&q=dupli cate
> +points#df9dba74d5788f6c ]
>
> In short, I have a list of latitude, longitude and data and need to
> combine any duplicate lat longs by summing the data value.
>
> Despite the many follow up answers to this I am still having problems
> with using the UNIQ function on both latitude and longtude as they
> each need to be sorted numerically for IDL to work.  Is anyone able to
> shed any light on this?! Or indeed, know of a quicker/easier method.
> There is a function in R called "aggregate" which appears to do
> exactly what I need, but I am unable to find an IDL equivalent.
>
> Any help is greatly appreciated!
>
> Helen

As I understand it I see the following solution although there could
be numerous faster more elegant ones this is my back of the hand
approach.
Arbitrary values...although they could be floating point, etc...
lats1 = [20,25,30,35,40,45,50,55]
lats2 = [15,25,35,35,40,42,32,28]
lons1 = [1,2,3,4,5,6,7,8]
lons2 = [0,2,6,2,5,9,7,8]
data1 = [1,2,3,4,5,6,7,8]
data2 = [10,11,12,13,14,15,16,17]
latIndices = where(abs(lats1-lats2) LT 1e-5)
IDL> print, latIndices
1 3 4
lonIndices = where(abs(lons1-lons2) LT 1e-5)
IDL> print, lonIndices
1 4 6 7
Now that you've found matching indices into both lat and lon space you
figure out where they're equal and use that to index your data for
summing
A description of setintersection can be found at
http://www.dfanning.com/tips/set_operations.html
inds = setintersection(latIndices, lonIndices)
IDL> print, inds
1 4
total = data1[inds] + data2[inds]
IDL> print, total
13 19
Which yields the correct answer as I see it. If this helps then
excellent...if not...not so much excellence. But keep poking for an
answer.
Best of Luck,
Bennett
Re: Duplicate lat/long points [message #64745 is a reply to message #64680] Thu, 15 January 2009 00:54 Go to previous message
russell.grew is currently offline  russell.grew
Messages: 74
Registered: February 2005
Member
You make a histogram where the bins are each latitude and also each
longitude.

It takes some thinking, but it works.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: idl workbench on linux does not support 64 bits
Next Topic: Re: question about array interpolation

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

Current Time: Wed Oct 08 11:42:40 PDT 2025

Total time taken to generate the page: 0.00698 seconds