<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
it would be very cool if grads included "nearest neighbor" functions.<BR>
maybe a UDF? how hard/complicated would it be to setup the math for each case: max, min, average? would a cause plotting to be somewhat slower/processor intensive?<BR><BR><BR>
<HR id=stopSpelling>
<BR>
Date: Tue, 6 Jan 2009 10:45:28 -0600<BR>From: smcmillan@PLANALYTICS.COM<BR>Subject: Re: 2nd try : Nearest defined neighbor function<BR>To: GRADSUSR@LIST.CINECA.IT<BR><BR><BR><FONT face=sans-serif size=2>Patrick,</FONT><BR><FONT face=sans-serif size=2>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:</FONT><BR><BR><FONT face=sans-serif size=2>'define newvar= max(max(var,x=-152,x=-150),y=262,y=264)'</FONT><BR><BR><FONT face=sans-serif size=2>Then assign result to point (in this case, x=-151, y=263) using the 'set defval var...' command.</FONT><BR><BR><FONT face=sans-serif size=2>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.</FONT><BR><BR><FONT face=sans-serif size=2>Hope this helps....</FONT><BR><FONT face=sans-serif size=2>Stephen McMillan</FONT><BR><BR><BR><BR><BR>
<TABLE width="100%">
<TBODY>
<TR vAlign=top>
<TD width="40%"><FONT face=sans-serif size=1><B>Patrick Reuter <preuter@LABRI.FR></B></FONT><BR><FONT face=sans-serif size=1>Sent by: GRADSUSR@LIST.CINECA.IT</FONT>
<FONT face=sans-serif size=1>01/06/2009 07:39 AM</FONT>
<TABLE border=1>
<TBODY>
<TR vAlign=top>
<TD bgColor=white>
<DIV align=center><FONT face=sans-serif size=1>Please respond to<BR>GRADSUSR@LIST.CINECA.IT</FONT></DIV></TR></TBODY></TABLE><BR><BR>
<TD width="59%">
<TABLE width="100%">
<TBODY>
<TR vAlign=top>
<TD>
<DIV align=right><FONT face=sans-serif size=1>To</FONT></DIV>
<TD><FONT face=sans-serif size=1>GRADSUSR@LIST.CINECA.IT</FONT>
<TR vAlign=top>
<TD>
<DIV align=right><FONT face=sans-serif size=1>cc</FONT></DIV>
<TD>
<TR vAlign=top>
<TD>
<DIV align=right><FONT face=sans-serif size=1>Subject</FONT></DIV>
<TD><FONT face=sans-serif size=1>2nd try : Nearest defined neighbor function</FONT></TR></TBODY></TABLE><BR>
<TABLE>
<TBODY>
<TR vAlign=top>
<TD>
<TD></TR></TBODY></TABLE><BR></TR></TBODY></TABLE><BR><BR><TT><FONT size=2>Sorry for multiples, message was somehow rejected ..<BR></FONT></TT><BR><TT><FONT size=2>Dear all,<BR></FONT></TT><BR><TT><FONT size=2>I have a variable which is only defined over the sea, elsewhere there<BR>are undefined values. Is there a function in Grads that can draw me a<BR>map where at locations of undefined values, instead of leaving it<BR>blank, draws me the value of the nearest defined value of the<BR>8-neighborhood ? I know about the existence of 'smth9', but it does<BR>not exactly what I want, since it smoothes out, and 'const', since you<BR>have to specify a default value which I don't know since it should to<BR>be determined from the nearest neighbor !<BR></FONT></TT><BR><TT><FONT size=2>Can anybody help?<BR></FONT></TT><BR><TT><FONT size=2>Thanks in advance<BR></FONT></TT><BR><TT><FONT size=2>Patrick</FONT></TT><BR><BR><BR><BR>***************************************************<BR>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.<BR>***************************************************<BR><br /><hr />It’s the same Hotmail®. If by “same” you mean up to 70% faster. <a href='http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broad1_122008' target='_new'>Get your account now.</a></body>
</html>