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

Home » Public Forums » archive » hist_nd to place just one point on a grid
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
hist_nd to place just one point on a grid [message #53703] Tue, 24 April 2007 15:10
MarioIncandenza is currently offline  MarioIncandenza
Messages: 231
Registered: February 2005
Senior Member
IDL Wizards,

I use hist_nd a great deal. One of the important things I do with it
is match gridded maps to point data sets and vice versa. Like this:

IDL> histogram = hist_nd(transpose([[point_x],[point_y]]),
[dx_grid,dy_grid],min=[minx_grid,miny_grid],max=[maxx_grid,m axy_grid],reverse_indices=ri)

followed by:

IDL> matched_pts = point_x * 0.0; initialize array to hold sampled
output
IDL> for i=0l,n_elements(histogram)-1 do if(histogram[i] gt 0) then
matched_points[ri[ri[i]:(ri[i+1]-1)]] = gridded_data[i]

or:

IDL> grid_totals = gridded_data * 0.0; initialize array to hold
gridded output
IDL> for i=0l,n_elements(histogram)-1 do if(histogram[i] gt 0) then
grid_totals[i] = total(point_data[ri[ri[i]:(ri[i+1]-1)]])

My problem is that hist_nd is unhappy when the inputs [point_x] and
[point_y] contain only one point. I could code an exception for this
case, but surely there is a more elegant solution?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Multi-line titles in IDL
Next Topic: some news from GDL 0.9 pre4

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

Current Time: Sat Oct 11 09:20:18 PDT 2025

Total time taken to generate the page: 0.55959 seconds