[Thread Prev][Thread Next][Index]

Re: [ferret_users] format of numeric labels: 2.0 x 10^5 and xfor/yfor ?

Hi Ryo,
It seems that (E8.0) is not a valid Fortran format description.  The definition of an E format is that it is always a 0, followed by a decimal point, and then at least one digit.  So E8.1 works  correctly, but E8.0 does not.  Ferret passes the format on to the Fortran WRITE statement and unfortunately here Fortran doesn't give us an error message.  Here's a reference

When using the E descriptor, the number will be NORMALIZED. This means the number is shifted over so that the first digit is in the tenths position. A leading zero and decimal are always present and a minus sign, if
needed. The exponent always requires 4 spaces; E, the sign and 2 digits.

Here is a more-complete reference on Fortran formatting. 

Look for the parts on a scale factor, kP.  If what we want is some digits before the decimal point, then start the format specification with 1P for 1 digit before the decimal.

yes? define axis/x=1:1000000:1/units=meters xmeters
yes? let xx = x[gx=xmeters]
yes? let sx  = sin(xx/10000)

yes? plot/set sx
yes? ppl xfor (E8.1) ! X axis labels are 0.1x10^6, 0.3x10^6,  etc
yes? ppl plot

yes? plot/set sx
yes? ppl xfor (1PE8.0) ! X axis labels are 1.x10^5, 3.x10^6,  etc
yes? ppl plot

Ryo Furue wrote:
Hi Ferreters,

I'm wondering if I can learn how the formatting machinery underlying
xfor/yfor works.  For example, outputs like "2.0 x 10^5" isn't
covered in the documentation of xfor:

For example, suppose that Ferret prints "2.0 x 10^5" by default
in the vertical axis of a plot by the PLOT command.  When you specify
"ppl yfor,(E8.0)" , you obtain "0.2 x 10^1" instead of
"2.0 x 10^5" . . . (The value 0.2 x 10^1 is even wrong!)
When you use "(1PE8.0)" , you obtain a correct "2. x 10^5".
The F format descriptor seems to be working as in the Fortran
language, but the E and G descriptors seem to show this strange

The version of Ferret I use is

        FERRET v6.07
        Linux(g77) 2.4.21-32 - 08/29/07
        28-Jan-08 15:35


[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement