Join Patrick Royal for an in-depth discussion in this video Exploring Lake Pend Oreille, part of Code Clinic: Java.
Hello, and welcome to Code Clinic. My name is Patrick Royal. Code Clinic is a monthly course where a unique problem is introduced to a collection of lynda.com authors. In response, each author will create a solution using the programming language of their choice. You could 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. This month, we'll work on a problem in statistical analysis, and to some extent in 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 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 freshwater lake in the United States. It's 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, including wind speed, air temperature, and barometric pressure.
You can browse this data by pointing your web browser at lpo.dt.navy.mil. You'll find several weather summaries, a web cam, and the raw data that 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 every day life. Average wind speed can be very different from medium wind speed, especially if you were 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 the median of wind speed, air temperature, and barometric pressure recorded at the Deep Moor Station for given range of dates.
First, let's briefly review the mean and median. These are both statistics. To explain statistics, we need a set of numbers. How about 14 readings for wind gust at the Deep Moor Weather Station on January 1st, 2014. You can see the data at this web site. The first column is the day the wind gust was recorded. The second column is the time it was recorded. And the third column is the wind gust's speed 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 of the set and then divide by the number of values.
In this example we add 14+14+11+11 and so on, and then, we divide the sum by fourteen, which is a count of the numbers in the set. In this case, the mean is equal to nine. The median is the number half way between all the values in a sorted range of values. Think of the median as 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, and then take the average of the middle two values 8 and 11. The medium 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.
Patrick introduces challenges and provide an overview of his solutions in Java. 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 exact same challenges in languages like C#, C++, PHP, Python, and Ruby.
Skill Level Intermediate
Q: I am unable to access the Lake Pend Oreille data from outside the U.S.
A: A static copy of this data is provided <a href="https://github.com/lyndadotcom/LPO_weatherdata">here</a> for lynda.com members outside of the U.S