<div dir="ltr"><div class="gmail_extra">On Wed, Jun 4, 2014 at 5:26 AM, Francesco Pasi <span dir="ltr"><<a href="mailto:pasi@lamma.rete.toscana.it" target="_blank">pasi@lamma.rete.toscana.it</a>></span> wrote:<br><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div style="font-family:Verdana;font-size:12pt;color:rgb(0,0,0)">
<div>Dear Arlindo </div><div>I am sorry to disturb you again, but I am in the middle of the river crossing...</div>
<div>We have during the years written a lot of udf for grads1.9 in FORTRAN, but now I need v2 for new functionalities.</div><div>So I am evaluating how to make run our old UDF in the new version.</div><div>On the wiki (<a href="http://opengrads.org/wiki/index.php?title=User_Defined_Extensions" target="_blank">http://opengrads.org/wiki/index.php?title=User_Defined_Extensions</a>)<a href="http://opengrads.org/wiki/index.php?title=User_Defined_Extensions" target="_blank"></a></div>
<div>it seems that the how to write UDF in fortran is not yet been documented.</div><div>Do you have some examples of how could we do that?</div><div>If it's not possible, one option might be to translate in C?</div>
</div>
</div></blockquote><div><br></div><div><br></div><div>While I have not documented how to write opengrads extensions in Fortran, several of the existing extensions are Fortran underneath. The main interface of the UDF to GrADS is in C, it is generally very thin. Start by downloading the latest source code from:</div>
<div><br></div><div> <a href="https://sourceforge.net/projects/opengrads/files/grads2/2.1.a2.oga.1/">https://sourceforge.net/projects/opengrads/files/grads2/2.1.a2.oga.1/</a><br></div><div><br></div><div>Untar, and look under </div>
<div><br></div><div> grads-2.1.a2/extensions</div><div><br></div><div>The following extensions have fortran in them:</div><div><br></div><div>
<p style="margin:0px;font-size:12px;font-family:Monaco;color:rgb(83,48,225);background-color:rgb(0,0,0)">fish<span style="color:rgb(245,245,245)">/</span></p>
<p style="margin:0px;font-size:12px;font-family:Monaco;color:rgb(83,48,225);background-color:rgb(0,0,0)">mf<span style="color:rgb(245,245,245)">/</span></p>
<p style="margin:0px;font-size:12px;font-family:Monaco;color:rgb(83,48,225);background-color:rgb(0,0,0)">orb<span style="color:rgb(245,245,245)">/</span></p>
<p style="margin:0px;font-size:12px;font-family:Monaco;color:rgb(83,48,225);background-color:rgb(0,0,0)">shfilt<span style="color:rgb(245,245,245)">/</span></p>
<p style="margin:0px;font-size:12px;font-family:Monaco;color:rgb(83,48,225);background-color:rgb(0,0,0)">tle<span style="color:rgb(245,245,245)">/</span></p></div><div><br></div><div> Take a look at fish/. The C interface to grads is fish.c which in turn calls the fortran code in ftn_fish.F: routines in ftn_fish.F are called from fish.c. Mike Fiorino's extensions under mf/ have ports of several of his old 1.9 UDFs to opengrads dynamic UDFs (now called extensions.) Look in here for a short description of the Level 0 API:</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><br>
</div><div><br></div><div> Notice that you don't have to rebuild grads to build the extensions but it it is a good idea to at least configure it (extensions include grads.h). Information about building opengrads from sources are here:</div>
<div><br></div><div> <a href="http://opengrads.org/wiki/index.php?title=OpenGrADS_Documentation">http://opengrads.org/wiki/index.php?title=OpenGrADS_Documentation</a><br></div><div><br></div><div>IMPORTANT: </div><div>
<br></div><div> Notice that COLA does not endorse this API for building GrADS extensions. For this reason I have not promoted its use. This Level 0 API while providing much flexibility requires that you understand some of the GrADS internals and must be recompiled with each new version of grads (much like extensions for perl, python, etc.) Read above for other caveats. All that I can say is that it works, it is much faster than the older file based UDFs and that it is highly portable. Besides myself, Mike Fiorino and a couple of generous developers, I am not aware of too many users out there writing opengrads extensions. Or at least they have not contributed these extensions back to the project. A few years back I put out a proposal for a supposedly simpler Level 1 API for building UDFs:</div>
<div><br></div><div> <a href="http://opengrads.org/wiki/index.php?title=User_Defined_Extensions_in_GrADS_v2.0">http://opengrads.org/wiki/index.php?title=User_Defined_Extensions_in_GrADS_v2.0</a><br></div><div><br></div>
<div> Since I got no feedback on it, it never got implemented. These days I have very time to work on GrADS, so the chances that it would be implemented any time soon is very slim. Unless, of course, we recruit new volunteers. </div>
<div><br></div><div> Good Luck,</div><div><br></div><div> Arlindo</div><div><br></div><div>PS: Please post questions like these to the mailing list.</div><div><br></div></div>-- <br>Arlindo da Silva<br>
<a href="mailto:dasilva@alum.mit.edu" target="_blank">dasilva@alum.mit.edu</a>
</div></div>