[Thread Prev][Thread Next][Index]

Re: [ferret_users] write missing value into output netcdf



Hi -
Just to amplify what Ryo says, I think he's got the right answer. (See "immediate mode" in the documentation, ferret.pmel.noaa.gov/Ferret/documentation/users-guide/variables-xpressions/EMBEDDED-XPRESSIONS which lets you use an expression within the syntax of a Ferret command.)

The syntax `largenum,p=8` returns the value of largenum with 8 digits of precision. Because ALL variables in Ferret are single-precision, you cannot get more than about accurate 7 digits of precision, so asking for more than that will not improve the result.

Ansley

On 11/29/2011 3:44 PM, Ryo Furue wrote:
Haoping,

The confusion is because Ferret expects expressions only in limited
contexts.

| yes? let largenum=2^100
|
This works because the right-hand side is evaluated when largenum
is.

| yes? set variable/bad=largenum var1      (this attempt failed)
|
This doesn't work because largenum isn't regarded as an expression.
"largenum" is simply treated as text (I'm guessing).

What you need is

   set variable/bad=`largenum,p=8` var1

to evaluate the expression "largenum".

In this case, the expression largenum is evaluated and the result
is converted to text, which is used to set "bad" (again,
I'm partially guessing).

Notice the "p=8" part.  The default precision may or may not be
sufficient to transfer all the digits.  (Try omitting the ",p=" part
and see what's the resulting bad value is.)

| yes? set variable/bad=2^100 var1 (this attempt passes but the missing

Likewise,

   set variable/bad=`2^100,p=8` var1

would do.

Regards,
Ryo


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement