Question
Sunspots Data Solar storms can damage satellites. When will the next damaging solar storms occur? Major solar storms are usually associated with peaks in sunspot
Sunspots Data
Solar storms can damage satellites. When will the next damaging solar storms occur? Major solar storms are usually associated with peaks in sunspot activity, and sunspot activity is
periodic. The next expected peak in sunspot activity is the next likely time for damaging solar
storms. Sunspot data has been collected regularly for over 300 years, and the raw data is
available on the Web. Early data collection was monthly, but after World War II daily data
collection began, and that is the data we will use. Unfortunately, raw data is noisy so to do a
reasonable prediction the data needs to be smoothed (explained below). The standard sunspot smoothing is based on monthly averages. Your program will output 2 files, one is the monthly sunspots totaled. The other will be the smoothed sunspots per month. Smoothing functions can be used to eliminate noise.
Sunspots.csv datafile
You are provided an input file called sunspots.csv. This is a comma separated value file. The first value is the year, then the month, then day. The 4th value is a decimal form of the year, which we dont need. The 5th value is the number of sunspots observed. A -1 indicates no observation and will be assumed as zero for our purposes, there may also be non-numeric characters in the field, which can also be counted as zero. ( elegantly handle the exceptions ) The 6th column will not be used. You can use the .csv module for reading through the file.
Example
1818,01,01,1818.004, ?,1
1818,01,02,1818.007, ?,1
1818,01,03,1818.010, ?,1
1818,01,04,1818.012, ?,1
1818,01,05,1818.015, ?,1
1818,01,06,1818.018, ?,1
1818,01,07,1818.021, ?,1
1818,01,08,1818.023, 39,1
1818,01,09,1818.026, ?,1
1818,01,10,1818.029, ?,1
1818,01,11,1818.031, ?,1
1818,01,12,1818.034, ?,1
Monthtotal.csv datafile
The first file you will output will be the Monthtotal.csv file. It should contain 3 columns. First being the year, then the month and then the total sunspots observed for that month.
Example Output
1818,01,279
1818,02,314
MonthSmoothed.csv datafile
The smoothing algorithm roughly works by taking six months of data on either side of a month
and averaging. The algorithm has a strange twist in that the first and last months in the
smoothing average only supply half their months value. If the month and year is n7 a variable we will used to represent the month we are smoothing, then then the value for the month will be
smoothedvalue = (n1/2 + n2 + n3 + n4 + n5 + n6 +n7 + n8 + n9 +n10 + n11 + n12 + n13/2)/12
Example output
1818,7,568.2916666666666
1818,8,568.625
1818,9,552.9166666666666
1818,10,530.8333333333334
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started