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

Home » Public Forums » archive » Variable sized bins in histogram, or find a bounding lat/lon box
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
Variable sized bins in histogram, or find a bounding lat/lon box [message #53472] Wed, 11 April 2007 07:19
Matt[2] is currently offline  Matt[2]
Messages: 69
Registered: March 2007
Member
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: readf and structures
Next Topic: How to plot coloured wire-mesh plot?

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

Current Time: Wed Oct 08 15:40:08 PDT 2025

Total time taken to generate the page: 0.00582 seconds