All pastes #738242 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-10-16 03:31 UTC
rendered paste body
dates = open("dates.txt", "r")
MONTHLY = open('MONTHLY.TXT', "w")
SMOOTHED = open("SMOOTH.TXT", "w")

Year = 1945
Month = 1
Day = 31
SunSpot = 0
c = 0
sunavg = [ ]
for lines in dates:
    items = lines.split()
    if( len(items)< 4):
        break
    y, m, d, ss = lines.split()
    if int(d) == 1:
        Month = Month + 1
        if Year == 1945 and Month == 1:
            SunSpot == 0
        else:
            SunSpot == SunSpot + int(ss)
            sunspotavg = SunSpot/(Day - 1)
            sunavg.append(sunspotavg)
            Day = Day + 1
    else:
        SunSpot == ss
        Day = Day + 1
    if Month == 12:
        if int(d) == 1:
            Month == 1
        if Month == 13:
            Month == 1
            Year = Year + 1

Year = 1945
Month = 1
for x in sunavg:
    MONTHLY.write(str(Year))
    MONTHLY.write(str(Month))
    MONTHLY.write(str(sunavg))
    Month = Month + 1
    if Month == 13:
        Month == 1
        Year = Year + 1
MONTHLY.close()