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 ?
Ferret can do this but you must be very careful that the [d=mydataset]
syntax is always included. Ferret will not allow you to have two
variables with the same name in the same dataset.
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 ?
The perl templates allow you to do all kinds of things that are
difficult to do in Ferret jnl scripts. This would be a very good way to
use perl pattern matching on an incoming variable name.