[gradsusr] Some problems while writing GrADS user defined functions
Arlindo da Silva
dasilva at opengrads.org
Sun Apr 4 08:14:24 EDT 2010
2010/3/15 Vinícius Almeida <viniciusaalmeida at gmail.com>
> Hi Arlindo,
>
> My name is Vinicius Almeida and I am student of the Federal University of
> Rio de Janeiro, Brazil.
>
> I was reading the GrADS documentation for User Defined Functions from the
> OpenGrads website but I found myself confused while trying to write my own
> function.
>
>
What exactly did you read? I am yet to write detailed documentation for
writing extensions in v2.0, mainly because COLA does not endorse the
OpenGrADS interface. Here is a simple example for the Low Level API,
http://opengrads.org/wiki/index.php?title=Low-level_API_for_Writing_Extensions_in_GrADS_v2.0
There are plenty more examples under src/extensions with the opengrads
bundle source tarball.
I have clearly understood that I can write it anyway, I mean, using any
> programming language and then compile it to a .GEX file. Is it right?
>
In principle yes, in practice you will need at least a C wrapper and from
there you can interface to any language (as most languages provide an
interface to C). However, you can now write user defined functions using a
gs script, see this:
http://opengrads.org/doc/udxt/gsudf/
These are real UDFs to be used with "display", although they are written as
gs scripts.
> But I did not figure out the procedure I am meant to follow to have it
> enabled in GrADS display option. So I would like to know, if possible, which
> are the steps I should follow to write it (what is the structure of it) and
> how I should compile into a .GEX file.
>
>
See the examples under src/extensions and the URL above. Once you write an
extension and compile it into a .gex file you need an entry into the UDX
table so that GrADS can find your extension.
> It would be useful if you could give me a example in some programming
> language (python, fortran,...) and what should I do to make it works.
>
>
Make sure you understand the difference between the opengrads interfaces
(pygrads, gerl, tclgrads) and the user defined functions/commands. So far,
no UDF/UDC has been written in python, although in principle it could. But
if you are interested in python, in most cases you can skip the extensions
and do most things through pygrads.
Arlindo
--
Arlindo da Silva
dasilva at alum.mit.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20100404/6ec4048f/attachment-0003.html
More information about the gradsusr
mailing list