Sunspots

Thomas Kelley
Northeastern University, Physics
Author Profile

Summary

In this assignment, students use MATLAB to import raw sunspot data and output processed sunspot data.


Learning Goals

This assignment is used to teach students the basics of importing and exporting files in the context of sunspot data. The students should know how to:
1) import a large data file using multiple MATLAB functions.
2) use indexing to filter data.
3) export processed data to multiple file formats.

Context for Use

This assignment works well with a class of 5 to 15 students. It typically takes the majority of a 90-minute class period. Students should understand the basics of MATLAB, MATLAB indexing, and file handling; completing the MATLAB On Ramp should be enough.

Description and Teaching Materials

Given the attached files, students should import the columns as variables into MATLAB (or comparable program) using the commands load, readtable, csvread, and the Import Data tab. The students then should filter out the missing data (indicated by a value of -1). Finally, they should write the filtered data to new files using the functions writetable, csvwrite, and xlswrite; have them also save the variables as .mat files.
The sunspot data is contained in the attached files. sunspotsbyday.csv contains daily observed sunspot numbers for the last 198 years; the columns are
1) Year
2) Month
3) Day
4) Year in decimal form
5) Sunspot number (SSN)
6) Daily standard deviation of the input sunspot numbers from individual stations
7) Number of observations that day
8) Indicates preliminary data - useless for our purposes. It should be filtered out.

sunspotsbyyear.csv contains yearly mean sunspot numbers; the columns are:
1) Year
2) Yearly mean sunspot number
3) Yearly mean standard deviation of the input sunspot numbers from individual stations
3) Number of observations used to compute the yearly mean total sunspot number
4) Indicates preliminary data - useless for our purposes. It should be filtered out.

These files are also freely available at http://www.sidc.be/silso/datafiles
Daily Sunspot Data (Comma Separated Values 2.1MB Aug16 18)
Yearly Sunspots (Comma Separated Values 7kB Aug16 18)


Teaching Notes and Tips

The assignment is meant to be semi-independent. I usually walk the students through one method of importing and exporting, but allow them to think about how to filter the data. After the students work for a while, it's a good idea to come back together as a class and talk about 1) the filtering and 2) the pros and cons of each method of importing/exporting data.

Assessment

Students meet the goals of this assignment by submitting the code they used to import, filter, and export the files. You should also check that they possess the filtered files.

References and Resources