udf with z and t
Henrique Barbosa
hmjbarbosa at GMAIL.COM
Mon Oct 30 21:12:51 EST 2006
Hi Matt,
Thanks for the try, but it doesn't work.
Even with "set loopdim x" (or y, or z) grads does not
change the data transfer file... I mean, the file always have
idim=-1 and jdim=-1 (because I fixed x,y and varyied z,t).
It seems to me the 1st dim in the transfer file cannot
be anything different from "x"... and the 2nd dim cannot
be different from "y".... Eventhou the help files say
they can!
By the way, are you part of the grads devopment team?
Or do you know someone there who could address this issue?
Thanks,
Henrique
On 10/30/06, Matthias Munnich <munnich at atmos.ucla.edu> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Got it. Try
>
> ga-> set loopdim x
>
> before executing your UDF.
>
> ... Matt
>
> Henrique Barbosa wrote:
> > Mathias,
> >
> > The problem is a bit more complicated because the calculation I
> > want to do requires that I have, at the same time (i.e. at the same
> > call to the udf func), all Z and T values of the field.
> >
> > What tloop and define do is (from grads help):
> >
> > "When time is a varying dimension in the dimension environment, the
> > tloop function evaluates the expr at fixed times, then
> > reconstructs the time series to obtain a final result that is time
> > varying."
> >
> > Futher more, the grads help goes on and says:
> >
> > "The tloop function is provided as a way to obtain time series from
> > functions that themselves are not implemented to be able to
> > operate when time is a varying dimension."
> >
> > That's exactly my point! I want to create an UDF function that IS
> > implemented to operate when time is a varying dimension.
> >
> > As I said on my previous email, it seems it should work, since the
> > header of the transfer file used to communicate between grads and
> > the external executable has a field to tell which variables is
> > inside the archive. From grads help:
> >
> > "Format of the function data transfer file (...) Argument records:
> > (...) 1st record: This record contains 20 values, (...) 2 -- An
> > index to identify the i dimension (idim). Options for the index
> > are: -1 None 0 X dimension (lon) 1 Y dimension (lat) 2
> > Z dimension (lev) 3 T dimension (time) "
> >
> > But when a call my function with fixed (x,y) and varying (z,t), I
> > get idim=-1 and jdim=-1 when I read the transfer file inside the
> > fortran code.
> >
> > Thank you,
> >
> > Henrique
> >
> > On 10/30/06, Matthias Munnich <munnich at atmos.ucla.edu> wrote: Hi
> > Henrique,
> >
> > ga-> d tloop(myudf(expr))
> >
> > should work. You may like to read the discussion on "tloop"
> > http://grads.iges.org/grads/gadoc/gradfunctloop.html and "set
> > loopdim" in the docs to understand why this is necessary.
> >
> > It also explains why "define allundef=myudf(expr)" should also
> > work.
> >
> > ... Matt
> >
> > Henrique Barbosa wrote:
> >> Hi all,
> >
> >> I want to write a UDF that deals with field values varying in Z
> >> and T dimensions. From the grads help files, it seems that it
> >> should work:
> >
> >> http://www.iges.org/grads/gadoc/udf.html
> >
> >> ... At least there are fields in the header of the transfer file
> >> that tell if the first and second varying dimensions are either
> >> x, y, z or t.
> >
> >> My function is very simple, it only reads the transfer file and
> >> print the header info, and returns a undefined field. But when I
> >> call it with fixed (x,y) and varying (Z,T), grads call the
> >> function many times.
> >
> >> I mean, instead of calling the function only once with the 2D
> >> subset:
> >
> >> x=cte, y=cte, z=z_min...z_max,t=t_min...t_max
> >
> >> Grads calls the udf one time for each pair (z,t), always passing
> >> only a single value.
> >
> >> Does anyone know how to pass a varying (Z,T) to a UDF function?
> >
> >> Or is that feature that will only be implemented in the future?
> >
> >> I am using grads-1.9b4, precompiled binaries (rh9), on a Suse
> >> 10.1 intel platform (i386).
> >
> >> Thank you,
> >
> >> Henrique
> >
> >
> >>
>
> - --
> - --------------------------------
> Matthias Munnich
> Univ. of California, Los Angeles
> Inst. of Geophysics and Planetary Physics
> 3845 Slichter Hall
> Los Angeles, CA 90095-1567
> Phone: +1-310-794 5899
> Fax: +1-310-206 3051
> Email: munnich at atmos.ucla.edu
> - --------------------------------
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFRqfVidaDTh/cfhYRAoWUAJsETqs7ye30M7o8AQkX1AquJKIn/wCdH4Di
> wfTGv9eGizCHjqyMVviCNyc=
> =lpEJ
> -----END PGP SIGNATURE-----
>
More information about the gradsusr
mailing list