Assess Climate Change Trends Anywhere in the World Using a Web-based Python Tool

Qianjin Zheng and Adnan Rajib, The H2I (Hydrology and Hydroinformatics Innovation) Lab, Department of Civil Engineering, University of Texas at Arlington

This tutorial was developed through a classroom cybertraining experiment at the Texas A&M University, Kingsville. A team of 10 undergraduate students participated in this experiment as part of EVEN2304: Computer Methods for Environmental Engineering. The course was offered by Dr. Adnan Rajib in Spring 2021.

Contact: adnan.rajib@uta.edu

Author Profile
Initial Publication Date: February 1, 2022

Introduction

The world's climate is changing rapidly. Future projections suggest frequent large storms and prolonged dry spells, increasing human exposures to flooding and drought1. With the recent advances in weather and climate predictions, we are now able to assess climate change trends by analyzing precipitation data. However, downloading, processing, and analyses of precipitation datasets are tedious and time-consuming tasks, not to mention these tasks require specific computer programming and software skills. This tutorial will introduce a python-based tool to automatically download, process, and analyze precipitation data, and create graphs for easy interpretation of climate change trends.

By using a global dataset called TerraClimate, the tool provides historical precipitation from 1958 to 2020 as well as the future climate model projections under a 4 degree Celsius warming scenario with respect to a 30-year baseline (1985-2015) (hereafter, referred to as the "climate change data")2-3.This tool works for any location in the world. We will choose the City of Houston in Texas, United States as an example.

The tool has two unique features:

  1. It is an end-to-end workflow that performs all data discovery, download, pre-processing, and analysis tasks in a semi-automatic manner, not limited to graph-plotting a given set of precipitation data.
  2. Students (or any potential user) can run this tool simply in a web browser without having to write python code or installing any software in local computers.

Tool URL: https://colab.research.google.com/drive/1KI9mh81zurFeoz2MphcGz7puKckY29CD?usp=sharing

Video Demonstration: https://youtu.be/0lfxPNh1rIs

Conceptual Outcomes

  • Students will understand how the world's climate is being affected by natural and human factors throughout the years by the statistical analysis of precipitation data over a selected period of time.
  • The precipitation charts derived from this tool will provide some insight on the vulnerability of the environment by looking at future projections of climate change.

Practical Outcomes

  • By completing this tutorial, students will learn how to develop and run python codes easily using a web-based platform called Google Colaboratory.
  • Students will learn how to create a climate change dataset by running the Google Colaboratory python code, downloading the output data, and performing visualization tasks on a local computer.

Time Required

It would take roughly 40 minutes to complete this tutorial (using the test case: precipitation changes in Houston, Texas, United States). The required time may vary with the total number of years included in your analysis and the internet connection quality.

Instructions

First, read this short tutorial carefully to set up your Google Colaboratory: Setting Up Google Colaboratory to Run Python Codes (Acrobat (PDF) 243kB Oct3 21)

Let's start by clicking on this link: https://colab.research.google.com/drive/1KI9mh81zurFeoz2MphcGz7puKckY29CD?usp=sharing. This will open a python code in your computer's web browser.

Watch this instructional video https://youtu.be/0lfxPNh1rIs to make yourself familiar with all the steps followed in this tutorial. You will see how we extracted historical precipitation data for a location in the City of Houston, United States. Here we plotted a graph showing the variation of historical precipitation between 1960 and 2015, as well as the projected future precipitation with respect to a baseline of 1985 and 2015. You can execute every step by merely clicking the play button or pressing "Ctrl+Enter". To run the Houston test case, no change in the code is necessary. You can, of course, run the tool for any location of interest in the world.

Relevant notes associated with each step are provided below.

If this is not the first time you have used this tool, then edit the following line of the code by deleting the "#" symbol. Deleting the "#" symbol will change this line of code from a statement to a command. You may then press the play button, this will clear any data that you have generated from this tool in your previous attempts. If this is your first time running this tool, you can start directly from Step 1.

Step 1: Install modules

Here you will install the python modules needed for this tool.

Step 2: Import modules

In this step, you are going to "call" the python packages/modules that you installed in the previous step. Once you call them, those packages/modules will be ready to perform specific geospatial functions in the subsequent steps.

Step 3: Download precipitation data

In this step, you will download both the historical data and climate change data by typing in an initial and a final year of your analysis shown in the text box below. As noted before, this tool is capable of downloading historical precipitation data for 1958-2020 and climate change data as future projections relative to 1985-2015. See how we selected the time range for our test case. In each line, we typed in the start and end year, and then pressed 'enter' to move on to the next line.

Step 4: Browse over an interactive global map and select your location of interest

As shown below you will find your location of interest by zooming in an interactive global map. Left-click to select the desired location and the map will display the longitude and latitude of the point you have chosen on the map.

Next, a text box will appear where you will type in the coordinate of your selected location exactly how it is displayed in the interactive map above. First, type in the latitude and press enter. Similarly, type in the longitude and press enter to complete this step.

Step 5: Post-processing netCDF files

In this step, the tool will read the netCDF files (the original format of the data that you just downloaded in Steps 3 and 4). Click here to learn more about netCDF files. This is one of the most widely used file formats for weather and climate data.

Part (i) of this step will extract the monthly precipitation data and save it as a CSV file. Part (ii) of step 5 will calculate the yearly total precipitation data and save it as a CSV file.

Step 6: Visualize how precipitation has been changing over the years in your location of interest

In this step, you will be able to generate time-series plots based on the data downloaded in the previous steps. For our test case, shown below are the time-series plots displaying the variation of precipitation between 1960 and 2015.

Can you tell how the extreme precipitation events have been changing in Houston? Hint: frequency of peak values in the monthly plot shown below.

This step will also allow you to compare the climate change data with the historical data during a 30-year baseline (1985-2015). See the time-series examples shown below.

Can you tell whether Houston is likely to have more floods in the future? Hint: greater peak values in the projected precipitation (blue) compared to the historical precipitation (red).

The yearly time-series plot shows smaller projected precipitation, but the monthly plot shows increased projected precipitation compared to the historical data. How do you interpret these results? Hint: Future annual precipitation in Houston may be less than what it currently gets, but the precipitation events may become more intense (for example, a big storm after a prolonged dry period).

Step 7: Performing statistical analysis of climate change

This tool is capable of automatically performing the statistical analysis of the precipitation data. Here in this step the summary statistics of monthly and yearly precipitation will be displayed after running the code.

Step 8: Download the time-series data and plots to your personal computer.

Now that you have analyzed the monthly and yearly precipitation data and created a visualization aid of time-series plots, you may now download the processed data and time-series plots to your local computer by running this step. An indicator that this step has been successfully completed is if you have downloaded "results.zip" to your computer. You can unzip the folder and open the time-series data using MS Excel.

Congratulations! You have completed this tutorial and successfully ran a python code using google colaboratory. You have now assessed climate change by statistically analyzing precipitation data over a selected period of time. Take a look at those time-series plots you created, think about how the climate is affected in this area. Rerun this tool with any location of interest!

References:

Golden, H., Lane, C.,Rajib, A., Wu, Q.(2021). Improving global flood and drought predictions: integrating non-floodplain wetlands into watershed hydrologic models, Environmental Research Lettershttps://doi.org/10.1088/1748-9326/ac1fbc

Abatzoglou, J.T., Dobrowski, S.Z., Parks, S.A., Hegewisch, K.C. (2018). Terraclimate, a high-resolution global dataset of monthly climate and climatic water balance from 1958-2015, Nature Scientific Datahttp://www.climatologylab.org/terraclimate.html

Qin, Y., Abatzoglou, J.T., Siebert, S. et al. (2020). Agricultural risks from changing snowmelt. Nature Climate Change, 10, 459–465. https://doi.org/10.1038/s41558-020-0746-8