[Thread Prev][Thread Next][Index]
customizing LAS: init script
Dear LASers,
An initialization script is usefull to forge a virtual variable, for
example, the sum of two actual variables....
In that case, there is one initialization script associated to one
particular variable.
Now, I want to process several input variables all in the same way: say,
for example, regridding them to a specific grid.
They will share the same initialisation script.
Usually, LAS expects from the initilization script to forge a specific
variable, as it is declared in XML file, let's say 'myvar'.
Suppose that 'myvar' is the result of an actual variable: 'original_var'
or more simply named 'myvar_'
Usually, this variable is created by means of a Ferret variable, using:
let myvar = expression (myvar_)
I believe that it is possible to have the original and forge variable
share the same name, as in:
let myvar = expression (myvar[d=mydataset])
I am not sure of this: could you confirm ?
Now, let's assume that I don't want my variables to share the same
name...
In the case the orginal variable is 'myvar_' the solution is
straightforward:
let $1 = expression ($1_)
since expected variable is given as a parameter to the script (here $1)
But in the case the name of the original variable is 'original_var', how
can I determine the original name from the expected name using Ferret
language in the initialization script, if it is possible at all ?
If I have been clear enough and you understand my problem, please, could
you suggest to me some way to solve it ?
Some ideas:
- if instead of an initialization script, we had an initialization
template, things would be easier, wouldn't they ?
- I designed also the following scheme: I programmed a preExecuteHook
function that executes a Ferret script for each requested variable
that script replaces the initialisation script
2) Second problem:
Let's suppose that two variables have the same name in two different
datasets and I want to compare them.
My initialization script will be called twice with the same variable
name as an input parameter...
And there will be a name conflict when it will be called the second
time:
let $1 = expression ($1_)
will supersede previous definition of $1
Please, tell me if there is a way to work around this ?
Some ideas:
- I am obliged to stick with the variable name expected by LAS since
the Perl code refers to it directly when comparing two variables.
line 1242 of Ferret.pl: $self->command("let var1_ =
$full_expr1");
It would be easier to deal with variable names if LAS only called
Ferret scripts or templates instead of directly sending instructions to
Ferret process.
- the key is: it would be OK if Ferret.pl referred to a Ferret symbol
initialized with variable name instead of referring to the variable name
itself.
Thanks in advance.
Jean-Marie Epitalon
CERFACS, Toulouse, France
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement