On Thu, Dec 1, 2011 at 5:01 PM, Arlindo da Silva <span dir="ltr">&lt;<a href="mailto:arlindo.dasilva@gmail.com">arlindo.dasilva@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#FFFFFF"><div>Henrique,</div><div><br></div><div>  This is a proposed API which has not been released. Your best bet is to download the opengrads sources and look at all the examples under extensions/. Start with the &quot;hello, world&quot; example under hello/. You can write extensions (UDFs or UDCs) in C, Fortran or even gs scripts.</div>

<div><br></div></div></blockquote><div><br></div><div>At this point only the low level API is available. You can find some information about this API here:</div><div><br></div><div>     <a href="http://opengrads.org/wiki/index.php?title=Low-level_API_for_Writing_Extensions_in_GrADS_v2.0">http://opengrads.org/wiki/index.php?title=Low-level_API_for_Writing_Extensions_in_GrADS_v2.0</a></div>
<div><br></div><div>For example, you could use this interface to re-implement any of the regular grads intrinsic functions in src/gafunc.c.  As I said, I have purposedely not documented the grads internal data structures involved, you need to know what you are doing to use this API. But with just a bit of &quot;monkey see, monkey do&quot; you should be able to create meaningful extensions with relatively minimum effort.</div>
<div><br></div><div>I should also mention that the <a href="http://opengrads.org/doc/udxt/libipc/">IPC extensions</a> include some functions</div><div><br></div><div>  IPC_save()</div><div>  IPC_load()</div><div>  IPC_pipe()</div>
<div><br></div><div>that could be used to emulate the functionality of the older UDF in GrADS v1.9. For example, IPC_save() can write any grads expression to a file (using a header very similar to the header in traditional UDFs), and IPC_load() can read similar files returning a grads expression. So, you can use IPC_save() to write to disk the input data for your UDF; you can use &quot;!&quot; to run you UDF applicatication, and IPC_load() to read the results of your UDF application. IPC_pipe() is a bit trickier to use, but it is very powerful (I used it to implement the GRIB-2 interface in GrADS v1.9). Combine this with the <a href="http://opengrads.org/doc/udxt/gsudf/">gsUDF capability</a> and you got yourself a bonafide UDF as in the good old days. Read the documentation above for more information.</div>
<div><br></div><div>  Good Luck,</div><div><br></div></div>-- <br>Arlindo da Silva<br><a href="mailto:dasilva@alum.mit.edu">dasilva@alum.mit.edu</a><br>