TCTrack Tutorial
This page outlines a tutorial for using TCTrack to generate cyclone tracks using Tempest Extremes and TSTORMS.
We work though all steps of the process from obtaining and preparing data, installing and using TCTrack and the wrapped algorithms, to plotting some simple outputs.
Details are provided for installing and running multiple tracking algorithms, though you may choose to follow just one.
Installation
Warning
The tutorial currently only works for python 3.11 and above.
First, follow the installation instructions. Make sure to use a conda environment and install TCTrack from source (not from PyPI) so that the tutorial scripts are downloaded.
The next step is to install the trackers we want to call from TCTrack, in this case Tempest Extremes and TSTORMS.
To do this, first ensure that the following dependencies have also been installed:
NetCDF (with C++ bindings and Tempest Extremes and Fortran bindings for TSTORMS)
A C++ Compiler (for Tempest Extremes)
A Fortran Compiler (for TSTORMS) – ifort is assumed, though others are available
From your cloned version of TCTrack navigate to the tutorial/ directory at the top
level:
cd tutorial
This directory contains a number of pre-prepared scripts demonstrating a simple TCTrack workflow to provide an example of usage and take you through the process of detecting cyclone tracks from climate data.
To install Tempest Extremes source the installation script which will
clone and build Tempest Extremes locally under the tutorial directory, as
described on the Tempest Extremes pages,
and add the executables to the PATH.
Read carefully to understand and check that you are happy with what it will do before
running:
source install_tempest_extremes.sh
To install TSTORMS source the installation script to clone and build TSTORMS locally under the tutorial directory, as described on the TSTORMS pages. Read carefully to understand and check that you are happy with what it will do before running:
source install_tstorms.sh
Obtaining Data
We will use example data from CMIP6, specifically from the HadGEM model and the 1950-historical experiment. We will use just a subset of ASO (August, September, October) from 1951 to demonstrate the code and some preprocessing techniques.
This data can be obtained from the ESGF CEDA archive or direct from CEDA using the included fetch data script:
./fetch_data.sh
This will fetch the NetCDF data files using wget and place them in a data/
directory.
Again, read carefully to understand and check that you are happy with what it will do
before running.
Pre-processing of Data
From inside the conda environment run the regridding script to pre-process the data:
python regrid.py
This will pre-process the downloaded data as required for our codes and place it in
data_processed/.
This includes the following processes:
Target months (ASO) are extracted from the yearly files
The 3hr data is mapped to the same daily time values as the daily data
Single variables at single levels are extracted for TSTORMS inputs
Vorticity is calculated from velocity data (following regridding to surface grid)
A mean is taken over pressure levels of temperature
Note that since this requires significant IO it may take a little time to complete.
Note also the use of the Python del command where appropriate as the data consumes a
large amount of memory which we want to free when possible.
Running the code
To run Tempest Extremes over the data we use the enclosed Python script which will execute using the parameters from the [Ullrich2021] paper:
python run_tempest_extremes.py
Intermediate files will be placed in te_outputs/ whilst the resulting tracks file
will be output as tracks_tempest_extremes.nc.
These can be inspected using:
ncdump -h tracks_tempest_extremes.nc
To run TSTORMS over the data we use the enclosed Python script which will execute similarly to the [Vitart2001] paper:
python run_tstorms.py
Intermediate files will be placed in tstorms_outputs/ whilst the resulting tracks file
will be output as tracks_tstorms.nc.
These can be inspected using:
ncdump -h tracks_tstorms.nc
Visualising Results
Finally we can visualise the results by plotting the reacks from the output data files. This can be done by running the included plotting script:
python plot_tracks.py
which will generate a png figure of tracks plotted on a map using windspeed as a measure of intensity.
By default this will read from tracks_tempest_extremes.nc, but this can be changed in
the file.
Note that the plotting script requires the following Python packages to be installed in
the local environment: numpy, NetCDF4, matplotlib, and cartopy.