[Thread Prev][Thread Next][Index]
Re: [ferret_users] Variable Unknown Problem
Hi Again,
Just a correction to my last bit about the syntax for substituting
symbols. The first line of this should be
IF ($theVar1%0|XX>1|*>0%) THEN
and taking this line apart it says,
$theVar1%0
If symbol ($theVar1) has no value, substitute 0, or if it has the value
XX then substitute 1, and if it has ANY OTHER VALUE AT ALL (the *>0 part
of the command), substitute 0. Evaluate the symbol, using the syntax
($symbolname). So the argument of the IF is 1 only if ($theVar1) is XX.
Ansley
Ansley Manke wrote:
Hi John,
When you are doing a block IF statement, do not use the continuation
character \ . These are all separate commands but your use of the
continuation character concatenates them all into a single command.
You've given Ferret the single long command quoted in the error
message. I haven't checked all your commands in detail but your script
should work if you remove all the backslashes.
There is another syntax in Ferret for checking the value of script
arguments. It's a very compact syntax, but once you learn it, it's
more direct. (Look up "go scripts, writing GO tools in the Users Guide
index.) It lets you check a single value of a symbol or several
allowed values for argument 3. You can check for them as follows
IF ($theVar1%0|XX>1|>0%) THEN
IF ($3%0|temp>1|salt>1|u>1|v>1|*>0%) THEN
cancel region/z
let sig = z[gz=$3]
let depthValues = sig * ( depth + zeta )
...
The first line says, If symbol ($theVar1) has no value, substitute 0,
or if it has the value XX then substitute 1, and if it has no value at
all, substitute 0. Evaluate the symbol, using the syntax
($symbolname). So the argument of the IF is 1 only if ($theVar1) is XX.
The second line says, if ($3) has no value substitute 0. If it is
temp, salt, u, or v, substitute 1, and if it is anything else
substitute 0. So the argument to the second IF is true only if ($3)
is temp, salt, u, or v.
John Schattel wrote:
Hi All,
I am trying to execute some code (see at bottom) to regrid data that
is on a sigma vertical axis onto a grid that is on a depth coordinate
and am getting the error:
* **ERROR: variable unknown or not in data set:
DEPTHVALUES[X=@MIN,Y=@MIN,Z=@MIN,T=@MIN] cancel region/z let sig =
z[gz=u] let depthValues = sig * ( depth + zeta ) LET zmin =
`depthValues[x=@min,y=@min,z=@min,t=@min]` LET zmax =
`depthValues[x=@max,y=@max,z=@max,t=@max]` define
axis/z=`zmin`:`zmax`:10/units=meters/depth zdepth let var1OnDepth =
zaxreplace(u,depthValues,z[gz=zdepth]) let var1IsOnZ = "true" Command
file, command group, or REPEAT execution aborted *.
Any suggestions why Ferret doesn't recognize DEPTHVALUES?
Regards,
John
IF `strcmp("($theVar1)", "XX") ne 0.0` THEN \
(if `strcmp("($3)","temp") eq 0.0 or strcmp("($3)","salt") eq 0.0
or strcmp("($3)","u") eq 0.0 or strcmp("($3)","v") eq 0.0` then \
cancel region/z \
let sig = z[gz=$3] \
let depthValues = sig * ( depth + zeta ) \
LET zmin = `depthValues[x=@min,y=@min,z=@min,t=@min]` \
LET zmax = `depthValues[x=@max,y=@max,z=@max,t=@max]` \
define axis/z=`zmin`:`zmax`:10/units=meters/depth zdepth \
let var1OnDepth = zaxreplace($3,depthValues,z[gz=zdepth]) \
let var1IsOnZ = "true" \
else \
let var1IsOnZ = "false" \
endif) \
endif
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement