[Thread Prev][Thread Next][Index]

Re: [ferret_users] a hint for reading integer data in fortran format



Hi Billy,

| It is not obvious how to read ASCII integer data into Ferret using
| FILE/FORMAT, since the only permitted formats are floating point (as
| far as I know). However, Ferret is willing to be fooled into reading
| integer data anyway, simply by referring to an value of N places
| (e.g. fortran format i8) as a floating point value with the same
| number of places (e.g. f8.0).

It seems that that is what the Fortran standard says.
(Since it's very hard to decipher the standardspeak of the standard
 document itself, let me cite the trusty Metcalf and Reid (1999).)
On input, the Fortran language is rather dangerously permissible.
With "F8.2", for example, an input string "314" is read as 3.14 .
That is, the fraction part ".2" in "F8.2" is honored even without
a decimal point in the input.  Likewise, the same string is read
as 314.0 with "F8.0".

In short, you can read an integer input with "F8.0" and the like.
(Of course, the destination must be a floating point variable.)
I guess Ferret can do it, too, because it's implemented in Fortran
(correct?).

Regards,
Ryo
--------
Metcalf & Reid. 1999. Fortran 90/95 Explained, 2nd Ed.
  Oxford University Press.


[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement