[Thread Prev][Thread Next][Index]
[ferret_users] a hint for reading integer data in fortran format
Hi all -
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).
Here's an example of reading the following mixed integer and floating
point data:
id date time lat lon t ve vn speed varlat varlon vart
3534 2000/02/12 0 -2.012 166.466 27.967 -52.645
-7.595 53.190 6.750e-05 9.691e-05 4.851e-03
3534 2000/02/12 6 -2.019 166.368 28.110 -53.935
-10.895 55.024 1.936e-05 2.383e-05 3.229e-03
3534 2000/02/12 12 -2.054 166.256 27.835 -55.647
-19.555 58.983 6.430e-05 9.192e-05 4.877e-03
3534 2000/02/12 18 -2.095 166.152 27.680 -52.677
-16.896 55.320 5.124e-06 6.815e-06 2.570e-03
3534 2000/02/13 0 -2.120 166.052 28.110 -53.890
-14.347 55.767 1.137e-04 1.788e-04 3.767e-03
3534 2000/02/13 6 -2.151 165.943 28.359 -47.714
-23.681 53.268 1.236e-05 1.719e-05 2.461e-03
3534 2000/02/13 12 -2.213 165.867 27.960 -45.110
-23.439 50.837 6.994e-05 1.011e-04 4.977e-03
3534 2000/02/13 18 -2.243 165.768 27.788 -50.685
-12.386 52.176 1.049e-05 1.340e-05 3.165e-03
file/format=(f8.0,f5.0,1x,f2.0,1x,f2.0,f9.0,6f9.3)/
var="id,yr,mon,day,hr,lat,lon,temp,u,v,speed"/g=gind/sk=1 filename.dat
Even though the format given is incorrect (i.e. it would fail in
fortran code, because, for example, the month is actually in i2
format, not f2.0 as I have done above), a ferret listing of these
values is correct:
ID YR MON DAY HR LAT LON
TEMP U V SPEED
1 / 1: 3534. 2000. 2.000 12.00 0.00 -2.012 166.5 27.97
-52.65 -7.59 53.19
2 / 2: 3534. 2000. 2.000 12.00 6.00 -2.019 166.4 28.11
-53.94 -10.90 55.02
3 / 3: 3534. 2000. 2.000 12.00 12.00 -2.054 166.3 27.83
-55.65 -19.56 58.98
4 / 4: 3534. 2000. 2.000 12.00 18.00 -2.095 166.2 27.68
-52.68 -16.90 55.32
5 / 5: 3534. 2000. 2.000 13.00 0.00 -2.120 166.1 28.11
-53.89 -14.35 55.77
6 / 6: 3534. 2000. 2.000 13.00 6.00 -2.151 165.9 28.36
-47.71 -23.68 53.27
7 / 7: 3534. 2000. 2.000 13.00 12.00 -2.213 165.9 27.96
-45.11 -23.44 50.84
8 / 8: 3534. 2000. 2.000 13.00 18.00 -2.243 165.8 27.79
-50.69 -12.39 52.18
Billy K
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Privacy Policy | Disclaimer | Accessibility Statement