[Thread Prev][Thread Next][Index]

defining variables using IF-THEN-ELSE syntax



Hello Ferreters,

I'm hoping there is an elegant solution to this- I'm trying to redefine
my variable nav_lon so it will be monotonic (so I can use nav_lon to
define a new x axis), by adding 360 to nav_lon when nav_lon is negative.

However, I'm having problems with my IF statement because nav_lon is
both positive AND negative (118:180, -178:-62), so I don't get a scalar
output.  I've tried two primary tacks, with minor variations (i.e.
including and not including the LET command):

yes? IF `nav_lon LT 0` THEN LET nav_lon2= nav_lon + 360 ELSE LET
nav_lon2 = nav_lon
** ERROR: invalid command: grave accent doesnt evaluate to scalar
nav_lon LT 0

yes? IF `nav_lon LT 0 THEN nav_lon2 = nav_lon + 360 ELSE nav_lon2 =
nav_lon`
** ERROR: command syntax: options: "P=prec", "B=bad","W=width",
"ZW=zero-width" or "R=return-item"

I read a little in the users guide about P,B,W, and R syntax, but didn't
find it to really apply to my problem.  Any ideas?

Thanks,
Lia

-- 
Lia Ossiander

School of Oceanography		Phone: (206) 543-0632
Box 355351
University of Washington
Seattle, WA 98195-5351


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement