2nd try : Nearest defined neighbor function

Stephen R McMillan smcmillan at PLANALYTICS.COM
Tue Jan 6 11:45:28 EST 2009


Patrick,
What if an undefined point has more than one "nearest neighbor" and are of 
different values?  Do you want to assign an average of these, the highest, 
lowest, etc.?  I'm assuming each gridpoint has up to eight nearest 
neighbors in complex coastal areas.  For example, you could get the max 
nearest neighbor using something like this:

'define newvar= max(max(var,x=-152,x=-150),y=262,y=264)'

Then assign result to point (in this case, x=-151, y=263) using the 'set 
defval var...' command.

Similarly, you could use 'define var= min(min...' to get min value of 
nearest 8-neighbor or the "aave" command to get average of nearest 
neighbor.

Hope this helps....
Stephen McMillan




Patrick Reuter <preuter at LABRI.FR> 
Sent by: GRADSUSR at LIST.CINECA.IT
01/06/2009 07:39 AM
Please respond to
GRADSUSR at LIST.CINECA.IT


To
GRADSUSR at LIST.CINECA.IT
cc

Subject
2nd try : Nearest defined neighbor function





Sorry for multiples, message was somehow rejected ..

Dear all,

I have a variable which is only defined over the sea, elsewhere there
are undefined values. Is there a function in Grads that can draw me a
map where at locations of undefined values, instead of leaving it
blank, draws me the value of the nearest defined value of the
8-neighborhood ? I know about the existence of 'smth9', but it does
not exactly what I want, since it smoothes out, and 'const', since you
have to specify a default value which I don't know since it should to
be determined from the nearest neighbor !

Can anybody help?

Thanks in advance

Patrick




***************************************************
The information contained in this e-mail message is intended only for the use of the recipient(s) named above and may contain information that is privileged, confidential, and/or proprietary.  If you are not the intended recipient, you may not review, copy or distribute this message.  If you have received this communication in error, please notify the sender immediately by e-mail, and delete the original message.
***************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20090106/ecdde99f/attachment.html 


More information about the gradsusr mailing list