[gradsusr] fortran UDFs is it possible?

Arlindo da Silva dasilva at opengrads.org
Fri Jun 6 23:29:24 EDT 2014

On Wed, Jun 4, 2014 at 5:26 AM, Francesco Pasi <pasi at lamma.rete.toscana.it>

> Dear Arlindo
> I am sorry to disturb you again, but I am in the middle of the river
> crossing...
> We have during the years written a lot of udf for grads1.9 in FORTRAN, but
> now I need v2 for new functionalities.
> So I am evaluating how to make run our old UDF in the new version.
> On the wiki (
> http://opengrads.org/wiki/index.php?title=User_Defined_Extensions)
> <http://opengrads.org/wiki/index.php?title=User_Defined_Extensions>
> it seems that the how to write UDF in fortran is not yet been documented.
> Do you have some examples of how could we do that?
> If it's not possible, one option might be to translate in C?

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:


Untar, and look under


The following extensions have fortran in them:






 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:


  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:



    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:


   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

   Good Luck,


PS: Please post questions like these to the mailing list.

Arlindo da Silva
dasilva at alum.mit.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20140606/a44d5b08/attachment.html 

More information about the gradsusr mailing list