Hi Marco,
It looks like the /LIKE qualifier could be what you're after.
All attributes are inherited (apart from missing_value, scaling and offset). You can override some if you want.
e.g. (From the examples)
yes? let/like=temperature/title="Surface Temperature" sst = temperature[z=0:5@MAX]
so
let/like=aa bb=aa+666
let/like=bb/title="`bb,return=original_definition`" cc = bb
which should be the same as
let/like=aa/title="`bb,return=original_definition`" cc = bb
Cheers,
Russ
From: owner-ferret_users@xxxxxxxx <owner-ferret_users@xxxxxxxx> on behalf of Marco van Hulten <Marco.Hulten@xxxxxx>
Sent: Tuesday, 11 February 2020 3:46 AM To: ferret_users@xxxxxxxx <ferret_users@xxxxxxxx> Subject: [ferret_users] reusing information from variable definitions Hi all—
I am looking for a way to use information of a variable without user intervention (in a script). For instance, let/units="m/s" aa = 123. let bb = aa + 666. sh var bb bb = AA + 666. Recently, Ansley pointed out that even more information can be retrieved from variables, e.g. by SHOW VARIABLE/TREE. But can I use any of this information? Say, that I want to define a third variable cc as bb but with the units bb's terms that I don't know, so say `bb,return=original_definition` aa + 666. let/title="`bb,return=original_definition`" cc = bb I also want to get to use aa.units, by referring only to bb (I don't know aa). If a return function or method exists to retrieve the information, I could then just spawn AWK: def symb Units = spawn( "echo '`bb,return=original_definition`' | awk '{ print $1 }'" ) let/title="Original _expression_: `bb,return=original_definition`"/units="($Units)" cc = bb To recap: my goal is to get the units from a previous _expression_; to that end, I think I need a way to make use of SHOW VARIABLE[/TREE] information, or even more generally stdout. Is there a last-output symbol, maybe? (There is FER_LAST_ERROR.) —Marco |