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

Home » Public Forums » archive » How to grid pixel level data where latitude and longitude are 2D arrays
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: How to grid pixel level data where latitude and longitude are 2D arrays [message #84958 is a reply to message #84956] Wed, 19 June 2013 14:17 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
masterjedirobyn@gmail.com writes:

> I am not familiar with the HIST_ND routine, but I have used hist_2d to
make frequency density plots before. I'm having trouble wrapping my head
around what the call to hist_nd would be. The syntax is
>
> hist=HIST_ND(V,[BINSIZE,MIN=,MAX=,NBINS=,REVERSE_INDICES=])
>
> and I have lat[409,13248],lon[409,13248],var[409,13248]. Would I call something like this:
>
> hist_lat=hist_nd(lat,binsize=1,min=-90,max=90,reverse_indice s=ri_lat)
> and
> hist_lon=hist_nd(lon,binsize=1,min=-180,max=180,reverse_indi ces=ri_lon)
>
> and then I would loop through -90 to 90 for lat and select the median from the bin (and -180 to 180 for lon), which would leave me with 1D lat and lon arrays? I could then use these arrays with an interpolate command, thus avoiding griddata altogether? I apologize if I'm completely wrong in how I understand this.

Well, Hist_ND is what Hist_2D was aspiring to be. :-)

Hist_ND is JD Smith's routine (and so, written extremely well). If you
can't find a copy on his web page, you can find a copy (probably older)
in the Public folder of the Coyote Library. The real reason to use it
here is that it returns the reverse indices for you. Hist_2D doesn't do
that.

http://www.idlcoyote.com/programs/public/hist_nd.pro

I would bin your lat and lon arrays (at the same time!) using Hist_ND.
Then, I would loop through each bin (360*180 of them), using the indices
for that bin to select the data values you want to use in calculating
the single data value for that bin. I suppose you can do this part in
various ways, but I would start by just getting the median value, I
think.


> After reading the article above on usegriddata.html, is the key part
> of that article the use of the map_proj routines? (i.e., using
> map_proj_init and map_proj_forward on the lats and lons before
> passing them to triangulate?)

I don't know if that is the "key part", but I can't get my head around
anything but rectangular grids, especially when it comes to map
projections, so I do EVERYTHING in XY space, not lat/lon space. At least
then I can explain what I am doing to someone. And, yes, it makes it
easier to form triangles when the points are not all bunched up in the
same location. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Cleaning up an inherited object...
Next Topic: convert .dat to .fits

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

Current Time: Wed Oct 08 17:23:38 PDT 2025

Total time taken to generate the page: 0.00408 seconds