Sea Level tutorial
Bel Kuhl and Olivia Spagnuolo
Introduction
Welcome to this lesson on changing sea levels. We’ll be looking at how the sea level is changing in different parts of the world. We’re going to use the computer to help us look at and understand data.
Change in Sea Level Since 1970
First, let’s take a look at this map showing how sea levels have changed since 1880. It shows the change in sea level compared to a baseline determined by the average sea level between 1993 and 2008.
As we can see in the graph, there is an upwards trend of sea level rise.
But how do we know there is an upward trend? How do we know what the sea level is in the first place? Check out this video to learn more about how scientists measure the sea level.
So, scientists use water level gauges as well as satellites to measure the sea level at any given time. They write down all the numbers they measure and collect it. This collection of numbers is called data.
After we have all that data (often called raw data), other scientists will analyze it and use it to create graphs. That’s what we’re going to do today! We’ll use the computer to code and analyze our data.
Click “Continue” to learn about coding!
Using R
We will use a coding language called “R”. Basically, “R” is a collection of commands that the computer understands. You can tell the computer one of the commands and it will know to do something.
For example one command the computer knows is multiplication! Try typing 5*3
in the box right below this. Then click the green play button that says “run code”
Press run code
What happened? Did you see the number 15 pop out?
The computer can also do very complicated things, like create graphs. We’ll learn more about that later in this tutorial.
The box above where you typed 5*3
is called a code chunk. You can type commands into any similar box and it will tell the computer to do various things.
Here’s another code chunk you can try typing something into. Maybe you want to try a division problem? Or maybe you want the computer to say hello to you? There’s a few different tabs you can click on to learn how to do cool things!
Want to try out your own code? Maybe another math problem? Here’s a place to do that. Otherwise click on the tabs to learn something new!
Would you like the computer to say hello to you?
First, type your name where the blank _______ is, in the second code chunk. Don’t delete the quotation marks.
Here’s an example:
Now your turn. Type your name instead of the blank _____ and then click play:
We can use r to find the largest number in a long list of numbers. To try this out, type a bunch of numbers inside the parentheses (______). Separate your numbers with a comma. Don’t delete anything else!
Here’s an example:
Now you try. Type your numbers after the first parenthesis and separate them with a comma. Then click run.
Now let’s run a function that will tell us which number is the biggest. Click the play button on this code chunk too.
Our data
Now we’re going to use coding to learn more about sea level. As we learned, scientists use satellites and water level gauges to measure the sea level. They collect all those numbers and it becomes data.
Let’s take a look at some sea level data for various coastal towns in the US. Click the blue box below to see the data.
Here, we see the average change in Sea Level recorded in various locations from 1970-2021. It’s pretty hard to get any meaningful information from just that table of information - there’s so many numbers to look at. Luckily, we can use R to better understand it and make graphs.
First, let’s try to understand a bit of what’s going on in the data table.
At the top of the table, there are bolded words. These are column titles and refer to the variable names.
Underneath the variable names, you’ll see individual entries for the data.
At the very bottom of the data table, you can click to different pages of data and see how many total entries there are.
How many data entries are there in the data?
✓318 data entries
✗99 data entries
✗10 data entries
✗400 data entries
The Avg
column shows the average change in sea level compared to WHAT????? year.
What was the average sea level change in Astoria in 1974?
✗1.002
✗0.06667
✓0.03383
✗-0.0432
Data Locations
Now let’s look at where the data comes from. Can you figure out all the locations where sea level data was measured? Look back at the data and try to find some of the locations!
It’s probably kind of hard to find all the different locations. Luckily, we can use R to help us. The command unique()
will tell us all the different data entries in one column. Let’s use it with the Location
column to find all the locations.
Press run code
The code we used to find the different locations is unique(sea_level$Location)
. Here’s what all the parts of it do:
unique
: outputs all the different data entries in a columnsea_level
: tells the computer to focus on the data set named ‘sea_level’$
: tells the computer we are about to tell it the name of a columnLocation
: this is the name of the column we want to focus on
Can you figure out a way to see all the different years in the data set?
Hint: Use the unique()
function again on a different column! Make sure you spell everything correctly and use the exact capitalization as in the dataset.
Here’s a map of all the locations we have in our data:
So, what do you think all this data is telling us?
Stop and think
How do you think the sea level has changed from 1970 to 2021?
Look back at the data and see if you can tell if it is rising or getting lower?
Is it easy or difficult to tell how it is changing?
Focus on Astoria (the location shown first in the data). How has the sea level in Astoria changed from 1970-2021?
Discuss with your neighbor how you think it is changing.
Graphing our data
It was probably difficult to tell how the sea level is changing overall. Luckily we can use coding to help us out. We can create different types of graphs through coding.
Astoria Scatterplot
Let’s start by focusing on Astoria and create a scatter plot. A scatter plot will plot a point for each individual data entry.
Press run code
What can you tell from this graph? Does it help you understand how sea level is changing in Astoria? What would you add to make it easier to tell how sea level is changing?
Astoria scatterplot with line of best fit
One thing we can do to help understand the graph is add a line of best fit. This will help us see the overall trend of how sea level is changing. We can add a line of best fit very easily by adding on one more command to our code.
Code Challenge: Can you spot what is different in this code compared to the previous graph code? What did we add to make a line of best fit? What color do you think the line will be?
Press run code
Stop and think
Talk with your neighbor about the graphs!
What do you notice?
What do you wonder?
What is the overall trend?
What else would you like to know?
Scatterplot of other locations
Although the data varies per year, there appears to be an upwards trend within this data. This is an indicator for rising sea levels in this area.
How does this compare to other locations within the United States? Let’s take a look at the 6 different locations across the US.
Let’s look at a linear trend of these locations.
Press run code
Stop and think
Talk with your neighbor about the graph!
What do you notice?
What do you wonder?
What is the overall trend in different locations?
What else would you like to know?
Bar graph of other locations
Turning to a more global scale, how does this compare to the low-lying island nation of Marshall Islands?
To represent this question, we can use a bar graph.
Stop and think
What is the difference between a bar graph and a scatterplot?
Why might we use a bar graph to compare locations?
Create a bar graph
Here’s the code to create a bar graph comparing the locations we previously looked at and the Marshall Islands.
Press run code
Stop and think
Talk with your neighbor about the graph!
How is a bar graph different than a scatterplot?
What information did you learn from the bar graph that you did not notice in the scatter plot?
Why might the sea level be rising faster in some locations than others?
What else would you like to know?
Congratulations!!
You finished this tutorial on sea level! Nice work! Hopefully you learned a little bit about how we can use coding to create graphs.
Data science can take on many forms, from data collection to coding. This is just a little nibble of the possibilities data science has to offer; there is so much more to chew on!