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

Home » Public Forums » archive » Re: Mode and variation of cells in multiple grids (3-D problem)
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: Mode and variation of cells in multiple grids (3-D problem) [message #69667 is a reply to message #69660] Mon, 25 January 2010 16:49 Go to previous message
MarioIncandenza is currently offline  MarioIncandenza
Messages: 231
Registered: February 2005
Senior Member
On Jan 25, 12:47 pm, Ed Hyer <ejh...@gmail.com> wrote:
> 1) The number of different values in the matched grids;
> 2) The mode, that is, the frequency of the most common value.

So, what I ended up with was something like this:

allgrids=[[[grid1]],[[grid2]],etc.]
matchcount=allgrids *0b; initialize
for i1=0,ngrids-1 do for i2=0,ngrids-1 do matchcount[*,*,i1] +=
(allgrids[*,*,i1] eq allgrids[*,*,i2])
magnitude_of_mode = max(matchcount,dim=3,imode)
value_of_mode = allgrids[imode]

So 2 for-loops still needed, but across the shortest dimension.

--Edward H.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Reading McIDAS Grid files
Next Topic: Re: CURSOR skips a few beats :-(

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

Current Time: Sat Oct 18 10:27:30 PDT 2025

Total time taken to generate the page: 0.88072 seconds