Teaching Data Analysis using MATLAB with WRF model output files

Oluseyi Akinola, Obafemi Awolowo University, Physics and Engineering Physics
Author Profile


The activity is aim at showing how MATLAB programing and functions can be used to extract and visualize WRF model output files. Students would be given a typical output file(s) from the model and are required to use MATLAB netCDF and other functions to extract, process, calculate and plot (both time series and spatial) of selected variable(s) from the files. Students need to have a good working knowledge of how to manipulate multiple dimensions atmospheric data files.

Learning Goals

It is very important for students working in the Atmospheric Physics option to possess the ability of working with model, satellite as well as reanalysis datasets. To do this required a good working knowledge of computational skills. MATLAB has very excellent collections of required tools to get this done. Students are expected to discuss the plots from the analysis done with a view to interpreting them and submit a write up on it.

Context for Use

The course is designed to teach graduate (master class) level students taking courses in Atmospheric Physics option as a laboratory activity to supplement the theoretical part of the course. The students must be familiar with netCDF files and how to manipulate it. A good working knowledge of MATLAB netCDF and other functions are required for student intending to take the class/laboratory.

Description and Teaching Materials

Students are expected to have MATLAB software on their individual PC where they create a folder named WRF_MATLAB. Download the model output files from a given google drive link and store the data in the folder created above. A general description of the atmospheric models are given to the students beforehand and why they are very important to the study of atmospheric phenomena both on land and the ocean. Also, the various application areas where the model outputs could be useful for our weather and climate system study would be highlighted. Sample MATLAB scripts would be provided to the students to jump start the work. Other common software could be used for the same purpose, I used MATLAB for its clarity and availability of support from the online resources and www.mathworks.com web page very resourceful, hence my preferences.
Sample_code (Microsoft Word 2007 (.docx) 15kB Sep11 20)

Teaching Notes and Tips

Students are expected to need help in the following area:

  1. Description of netCDF file formats as well as their multi-dimensional nature.
  2. Select the appropriate MATLAB netCDF functions.
  3. Extracting the needed variable(s) and do mathematical computation on them.
  4. Plot 2D data and select appropriate date and time format for WRF output files etc.


The assessment model for the class would be in form of grading the students:

  1. Code and proper indentation.
  2. Ability to describe the results from the analysis and their implications in a write up.