Re: Am I having a blackout? [message #66650 is a reply to message #66648] |
Thu, 28 May 2009 14:34  |
Mark[2]
Messages: 4 Registered: May 2009
|
Junior Member |
|
|
-> due to the line wraps the layout is somewhat disturbed: the d2 is
after the d1 and also the negative values are in fact after the other
items on the line.
On May 28, 11:27 pm, Mark <Mark.Saven...@gmail.com> wrote:
> Hi all,
>
> I'm trying to read a very simple file with very basic commands, but it
> reads the wrong values for the last variable (d2): readf does not see
> it are negative values and reads only the last five digits. The first
> five items it reads OK. I guess I'm making a very trivial mistake
> here, but I don't see it. Anyone having a clearer mind than me?
> Thanks!
>
> Mark
>
> sum1 = 0.0
> sum2 = 0.0
> sum3 = 0.0
> sum4 = 0.0
> count = 0
> dummy1=''
> openr, unit, /get_lun, 'sunny_days.fits'
> while ~eof(unit) do begin
> readf, unit, format='(A8,F,F,F,F,F)', dummy1, dummy2, A, beta, d1,
> d2
> help, dummy1, dummy2, A, beta, d1, d2
> sum1 += A
> sum2 += beta
> sum3 += d1
> sum4 += d2
> count++
> end
> print, sum1/count, sum2/count, sum3/count, sum4/count
> end
>
> part of sunny_days.fits:
>
> 20050206 0.386216 1286.08 1.34860 0.133876
> -0.695917
> 20050207 0.391236 1080.36 1.19682 0.285981
> -0.127826
> 20050402 0.685645 1137.82 1.20061 0.112449
> -0.716363
> 20050411 0.727419 1096.23 1.21388 0.134878
> -0.556709
> 20050421 0.768319 1110.19 1.19086 0.136384
> -0.636537
> 20050422 0.772067 1133.38 1.26480 0.214946
> -0.528211
> 20050423 0.775750 1115.85 1.26544 0.196289
> -0.642749
> 20050614 0.878818 1109.71 1.21778 0.140585
> -0.640095
> 20050618 0.879916 1055.35 1.16299 0.103695
> -0.706452
> 20050619 0.880047 1071.56 1.15538 0.0915420
> -0.690452
>
> Full file at:http://www.markjoe.com/tmp/sunny_days.fits
|
|
|