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

Home » Public Forums » archive » Re: Variable sized bins in histogram, or find a bounding lat/lon box
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: Variable sized bins in histogram, or find a bounding lat/lon box [message #53471 is a reply to message #53470] Wed, 11 April 2007 09:13 Go to previous message
Paolo Grigis is currently offline  Paolo Grigis
Messages: 171
Registered: December 2003
Senior Member
Because the grid is orthogonal and sorted, you could try

res1=value_locate(lats,target_lats)
res2=value_locate(lons,target_lons)

IDL> print,res1,res2
0 3 2
4 2 4

Is that what you need?

Ciao,
Paolo

Matt wrote:
> All, ( well, JD mostly, but feel free to jump in. )
>
> I'm trying to solve a problem that seems particularly suited to
> histogram. The main idea is that I'm trying to find the surrounding 4
> corner points of a given sample point within a semi-regular lat-lon
> grid. (Note: not the 4 nearest-neighbors, they must be the closest 4
> points in a rectangle that enclose the target point.)
>
> I'll try to break it down to its most simple. I know that I'll have
> some number of latitudes and another number of longitudes that
> represent the centers of grid-cells via their intersections. I don't
> know that they will be evenly spaced (note: that seemed key in my
> inability to come up with a fast solution).
>
> lats = [10, 20, 25, 30, 40]
> lons = [100, 120, 130, 135, 140, 155]
>
>
> I'll also have a set of lat/lon points that do not fall on a regular
> lat/lon grid.
>
> target_lats = [ 10.5, 39.1, 29., ... ]
> target_lons = [ 142.3, 130, 152.3, ... ]
>
>
> I'd like to know the lat/lon values of the initial locations that
> surround my target points.
>
> So for the first target point [10.5, 142.3], I'd hope to return:
>
> [20,140] [20,155]
>
> [10,140] [10,155]
>
>
> Or in fact, since I know the lats and lons are already sorted.
> Returning, indices [0 & 4] would give me the information I'm after.
>
>
> I think I can do this with two histograms one in lat one in lon. It's
> along the lines of ... if I can histogram the initial lats into a
> histogram with no more than 1 element per bin. And then histogram all
> of my target_lats with the same histogram min, max, and binsize. I
> should through the beauty and horror of reverse indices, be able to
> back out the indices of the target. But I'm just not quite there in
> full thought process.
>
> Does anyone have a brilliant idea? I've had a sleep on this already
> and the more I write and think about this, the more I think this might
> not be the best way to solve this problem. I'm going to proceed with
> a "where" solution which may be slow, but I understand it. But as an
> intellectual puzzle, I'd like to see how someone can bin data into
> variable sized bins via histogram. In the final breakdown, that's all
> I'm trying to do right?
>
>
> lats = [10, 20, 25, 30, 40]
>
> Bins = [[-inf, 15], (15, 22.5], (22.5 , 27.5], (27.5, 35], (35, +Inf]]
>
> Right?
>
>
> Any help is appreciated,
> Thanks.
> Matt
>
>
>
> --
> Matthew Savoie - Scientific Programmer
> National Snow and Ice Data Center
> (303) 735-0785 http://nsidc.org
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: May anyone share his IDLwave configuration file with me ?
Next Topic: idl segfaults in FC5

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

Current Time: Wed Oct 08 19:33:55 PDT 2025

Total time taken to generate the page: 0.00394 seconds