[Thread Prev][Thread Next][Index]

[ferret_users] backquote, precision, digits after decimal point



Hi Ferret users,

I have the feeling that we had the same discussion but the closest I found is

https://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2001/msg00214.html

which doesn't answer the particular question I have.

So, I wonder how you get zeros AFTER the decimal point from the backquote _expression_?  say "3.000"?

    yes? say `3,p=4` `3,p=-4`

I expected something like "3.0000" from this example but I got just "3". w= or zw= didn't help.  (By the way, what do you call the part of a fractional number after the decimal point in English? I mean the part "14" of "3.14", for example.)

The ferret manual says that this is by design:
http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/variables-xpressions/EMBEDDED-XPRESSIONS

Currently I got stuck. I need character strings like "26.0" for potential density labels in my plots and filenames but I don't know how to generate them.  (Okay, I do know some workarounds, which includes using SPAWN to call the unix/linux command "printf" or calling Ferret from within a shell script, but . . . )

As suggested in the above email thread, it would be nice if a comprehensive formatting is possible.  For example,

   `3,p=(F5.2)` -> " 3.00"

or perhaps

    let mylabel = printf("%5.2f", someexpression)

Fortran or printf formatting would be nice.

Regards,
Ryo

  NOAA/PMEL TMAP
  FERRET v7.3 (optimized)
  Linux 2.6.32-696.13.2.el6.x86_64 64-bit - 12/04/17
  11-Mar-18 13:14


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

Privacy Policy | Disclaimer | Accessibility Statement