Hi John,
Well, we just need to add to the external functions capabilities to
allow you to set more properties of a custom axis!
Might you be able to define the axis you want, and send a variable
defined on that axis into your external function as an argument? Then
you would specify that the result inherits its Z axis (for instance)
from that argument. Depends on what the function is doing, whether your
script will know enough ahead of time to let you define the axis
outside the function.
Ansley
John Donners wrote:
Hi Ansley,
thank you for your quick answer, as always. My problem comes
from external functions
that define custom axes. It is possible to set whether a custom
axis is MODULO or not,
which works fine. However, it is impossible to define the
properties DEPTH and T0 (time origin)
in an external function. The solution to set these properties
afterwards doesn't work, as you
mentioned.
It is possible to define a new axis as a copy of the dynamic
axis and then define a
new variable that is regridded to this new axis. However,
wouldn't this be a waste of memory
to make an extra copy of a variable just to set an axis
property, especially when I use large fields?
John
On 10 May 2007, at 03:58, Ansley Manke wrote:
Hi John,
Dynamic axes are intended to be created and deleted internally and not
really manipulated by Ferret commands. If you want control over axes,
I think you'd be better off defining them explicitly or inheriting the
definition from other known axes.
Ch4
Sec2.3. Dynamic
grids and axes
The commands DEFINE
AXIS and DEFINE GRID, described in the preceding section, should be
used when the grid or axis will be referenced more than once and/or
shared among several variables. In many cases it is more convenient to
use dynamic (a.k.a. "implicit") grids and axes.
What are you intending by
yes? let zz=z[gz=1:10:1]
" gz = " is used to specify the name of a grid or variable or axis, for
regridding, applying a transformation, or otherwise specifying an axis.
Here are a few general thoughts, things you can do with axis definition
and manipulation
1) Define a variable, with a dynamic axis.
yes? let zz = z[z=1:10:1]
yes? let z5 = z[z=1:100:5]
2) Take subset of the z axis of a variable; this will be on a dynamic
axis, and it inherits the properties of the axis from the variable
yes? use levitus_climatology
yes? let zz = z[gz=temp,k=1:10:1]
yes? sh grid zz
GRID (G002)
name axis # pts start end
normal X
normal Y
(AX005) DEPTH (m) 10 i- 0 300
normal T
or
yes?
yes? let zz = z[gz=temp,k=2:20:2]
yes? sh grid zz
GRID (G002)
name axis # pts start end
normal X
normal Y
(AX005) DEPTH (m) 10 i- 10 5000
normal T
3) of course, there's always the plain old DEFINE AXIS, with any
properties you want. It doesn't have to have units. See DEFINE
AXIS/FROM_DATA; the last three examples are a shorthand notation for
that.
yes? DEFINE AXIS/DEPTH/z=1:10:1 zaxis
yes? DEFINE AXIS/MODULO/Units=meters/x=1:280:7 xaxis
! Define an axis from a set of numbers, in this case
! values from the coordinates of a variable
yes? LET zz = z[gz=levitus_climatology,k=1:15:3]
yes? DEFINE AXIS/Z/DEPTH/UNITS=`temp,RETURN=units`
my_zaxis = zz
yes? LET zreg = z[z=0:5000:40]
yes? DEFINE AXIS/Z/DEPTH/UNITS=meters my_reg_zaxis = zreg
yes? DEFINE AXIS/Z/DEPTH/UNITS=meters my_reg_zaxis =
{0,8,16,32}
John Donners wrote:
Hi,
I'm having a problem with dynamic axes, that are either defined
'inline' (e.g. let xx=x[x=1:10:1]) or defined in an external function.
These axes are named '(AX015)'. During the processing of a Ferret
script these axis names can change, and that causes these axes to
not 'remember' their properties like DEPTH, MODULO and T0.
Here is a simple example:
yes? use levitus_climatology
yes? let zz=z[gz=1:10:1]
yes? show grid zz
GRID (G002)
name axis # pts start end
normal X
normal Y
(AX005) Z 10 r 1 10
normal T
yes? set axis/mod (ax005)
yes? show grid zz
GRID (G002)
name axis # pts start end
normal X
normal Y
(AX005) Z 10mr 1 10
normal T
yes? show data
currently SET data sets:
1>
/home/donners/software/ferret-5.81/fer_dsets/data/levitus_climatology.cdf
(default) name title I J K L TEMP TEMPERATURE 1:360 1:180 1:20 ... SALT
SALINITY 1:360 1:180 1:20 ...
yes? cancel data 1
yes? show grid zz
GRID (G001)
name axis # pts start end
normal X
normal Y
(AX002) Z 10 r 1 10
normal T
As you can see the name of the axis changed in the last step, and
together with that it is not a modulo axis anymore. I would like to
keep the setting of axis properties at the same point in my scripts, to
keep all the functionality at the same point.
Is there any solution to this problem?
Cheers,
John
--
~> ~> ~> ~> ~> ~> ~> ~> ~> ~> ~>
Ansley Manke, NOAA/PMEL ansley.b.manke@xxxxxxxx
7600 Sand Point Way NE, Seattle WA
Phone 206-526-6246, FAX 206-526-6744
--
~> ~> ~> ~> ~> ~> ~> ~> ~> ~> ~>
Ansley Manke, NOAA/PMEL ansley.b.manke@xxxxxxxx
7600 Sand Point Way NE, Seattle WA
Phone 206-526-6246, FAX 206-526-6744
|