Basic Time-Series Hydro-logical Data Analysis:Exercises (Part 1)

Time series dataset is a well-recognized data type for modeling and forecasting purposes. However, the application in R may vary depending on the research areas.

In this exercise set, we will explore basic analysis for time series hydrological data in R . We will also introduce the hydroTSM package; a useful package in hydrology. Hydro TSM is specifically built by Mauricio Zambrano-Bigiarini (2014) for hydrology analysis, including the datasets visualization.

Hydrological time series data can be generated from automatic recording instruments and/or manual recording by a human. In this part, we will focus on analyzing precipitation data of the Saugeen River (download here (Hipel and McLeod (1994)). Basic precipitation data analysis includes extracting the statistics summary and monthly and annual precipitation analysis accompanied by data visualization. The core of this exercise can be applied to flow and temperature variables as well.

Answers to the exercises are available here. If you obtained a different (correct) answer than those listed on the solutions page, please feel free to post your answer as a comment on that page.
Please install and load the package hydroTSM before starting the exercise.

Exercise 1
Read the precipitation dataset (.csv) file. Name it as saugeenP.

Exercise 2
Data screening and wrangling, including:
a. Do not delete significant meaning rows.
b. Changing column names into memorable ones.

Exercise 3
Checking and converting data type, including:
a. Change the value of precipitation into numerals.
b. Change the data type into zoo object. Name it as zoo_saugenP.
c. Subset data from 1988-01-01 to 1990-12-31.

Exercise 4
Extract the statistics summary of zoo_saugenP.

Exercise 5
Find the total year of observations.

Exercise 6
Find the average annual precipitation.

Exercise 7
Extract the total monthly precipitation analysis using daily2monthly function. Name it as saugeen_monthly_P.

Exercise 8
Create a total monthly precipitation boxplot.

Learn more about time series and Forecasting in the online course Time Series Analysis and Forecasting in R. In this course you will learn how to:

  • A complete introduction on Forecasting
  • Work thru an exponentional smoothing instruction
  • And much more

Exercise 9
Create a total monthly precipitation visualization using the matrixplot function.
a. Create a matrix of Saugeen_monthly_P.
b. Re-name the matrix column as the 12 months and the matrix row as a unique time of Saugeen_monthly_P.
c. Load the lattice package.
d. Print the matrix using matrixplot function.

Exercise 10
Create a set of daily and monthly visualizations, including time series, boxplot, and histogram in one display using the hydroplot function. Play with ptype,pfreq,and FUN argument.