- Hello and welcome to Code Clinic. My name is Todd McLeod. Code Clinic is a course where you unique problems is introduced to a collection of lynda.com authors. In response, each author will create a solution using their programming language of choice. You can learn several things from Code Clinic. Different approaches to solving a problem, the pros and cons of different languages, and some tips and tricks to incorporate into your own coding practices. In this challenge, we'll work on a problem in Statistical Analysis and to some extent, handling big data.
It's common to use a computer to manipulate and summarize large amounts of information, providing important insights on how to improve or handle a certain situation. In this problem, we'll use weather data collected by the US Navy from Lake Pend Oreille in northern Idaho. Lake Pend Oreille is the fifth deepest fresh water lake in the United States. So deep, in fact, that the US Navy uses it to test submarines. As part of that testing, the US Navy compiles an exhaustive list of weather statistics: wind speed, air temperature, barometric pressure.
You can browse this data by pointing your web browser at http://lpo.dt.navy.mil You'll find several weather summaries, a web cam, and the raw data they collect every five minutes archived as standard text files. For anyone living or working on Lake Pend Oreille, weather statistics are an important part of everyday life. Average wind speed can be very different than median wind speed, especially if you're on a small boat in the middle of the lake.
In this challenge, each of our authors will use their favorite language to calculate the Mean and Median of the Wind Speed, Air Temperature, and Barometric Pressure recorded at Deep Moor Station for a given range of dates. First, let's briefly review Mean and Median. These are both statistics. To explain statistics, we need a set of numbers. How about 14 readings for Wind Gust at Deep Moor Weather Station on January 1, 2014. You can see the data at this website.
The first column is the day wind gust was recorded. The second column is the time it was recorded. And the third column is the wind gust in miles per hour. The Mean is also known as the average. To calculate the mean of a range of numbers, simply add the values in the set, then divide by the number of values. In this example, we add 14, 14, 11, 11, 11, 11, 11, three, seven, seven, seven, seven, four and eight.
Then divide the sum by 14, the count of numbers in the set. In this case, the mean is equal to nine. The Median is the number halfway between all the values in a sorted range of values. Think of the median as in the median strip of the road. It always marks the center of the road. To calculate the median, first sort the numbers from lowest to highest. If there's an odd number of values, then just take the middle number. If there's an even number of values, then calculate the average of the central two numbers.
In this case, there's an even number of values. So we sort, then take the average of the middle two values: eight and 11. The median is 9.5. So there's our first challenge. Pull statistics from a data set available online. Perhaps you want to pause and create a solution of your own. How would you solve the problem? In the next videos, I'll show you how I solved this challenge.
Released
2/16/2016Todd introduces challenges and then provides overviews of his solutions in Go. Challenges include topics such as statistical analysis, searching directories for images, and accessing peripheral devices.
Visit other courses in the series to see how to solve the same challenges in languages like C++, C#, JavaScript, PHP, Python, R, Ruby, and Swift.
Share this video
Embed this video
Video: Exploring Lake Pend Oreille