Exercise 1 - Thermal Wind¶
The goal is to explore the solution of the thermal wind equation between 2 WOCE stations in the Florida Straits. The thermal wind equation (in dimensional form) is
where
\(v\) is the horizontal velocity component across the line between the 2 stations in \(m / s\)
\(g\) is the acceleration due to gravity in \(m / s^2\)
\(f_o\) is the Coriolis parameter in \(s^{-1}\)
\(\rho_o\) is the reference density in \(kg / m^3\)
\(\rho\) is the varying density in \(kg / m^3\)
\(x\) is the horizontal distance between the 2 stations in \(m\)
There are 2 choices of boundary conditions that can be used to solve the equation:
A depth at which there is no motion
A surface height difference between the 2 stations
The code provided integrates 2 density profiles and uses the chosen boundary condition to calculate the velocity component profile on the line connecting the profiles.
Also provided are a pair of density profiles at stations in the Gulf Stream where it passes through the Florida Straits. These data were collected under the world project “WOCE” and are part of a large collection of data that is freely available on the web. The stations are at 26ºN and are 36.89 km apart.
Your assignment:

Explore the velocity profiles that result with various choices for the no motion depth and for various surface height differences between the two stations. The actual surface level at station 105 is probably about 40 cm higher than that at station 109.
Get the Python Code¶
Open up a terminal window and an editor. If you don’t have favourites that you use all the time, the Text Editor icon on the AIMS computers will bring up gedit for you with terminal, editor, and file navigator panes.
In the terminal,
clone the Git repository that contains the code and data
(as well as a PDF of this morning’s slides),
change to the thermal_wind
directory,
and start ipython with plotting enabled:
$ git clone git@github.com:UBC-MOAD/AIMS-Workshop.git
$ cd AIMS-Workshop
$ ipython --pylab
The Python functions we’re going to use in this exercise are in thermal_wind.py
.
You can explore the code by opening it in the editor pane.
The thermal_wind()
Function¶
The thermal_wind()
function has the following docstring that tells us about what it does,
its inputs,
its outputs,
and the exceptions that it may raise:
- thermal_wind.thermal_wind(stn1_profile, stn2_profile, no_motion_depth=None, surface_delta=None)[source]¶
Return the profile of horizontal velocity across the line between 2 density profile stations by integrating the density profiles and using the specified boundary condition (level of no motion, or surface height difference) to calculate the velocity.
- Parameters:
stn1_profile (string) – Name of file containing the density profile at station 1
stn2_profile (string) – Name of file containing the density profile at station 2
no_motion_depth (number) – Depth at which level of no motion boundary condition occurs in [m]
surface_delta (number) – Surface height difference between the 2 station in [m]
- Returns:
(depth, v_vel)
Profile of horizontal velocity across the line between the 2 stations- Return type:
tuple of
numpy.ndarray
- Raises:
IOError
ifstn1_profile
orstn2_profile
file cannot be read- Raises:
ValueError
if neitherno_motion_depth
orsurface_delta
are specified- Raises:
ValueError
if bothno_motion_depth
andsurface_delta
are specified- Raises:
ValueError
if depth intervals in the 2 station density profiles are unequal- Raises:
ValueError
ifno_motion_depth
exceeds depth of shallowest density profile
The plot_velocity_profile()
Function¶
The docstring from the plot_velocity_profile()
is:
An Example¶
In []: import thermal_wind
In []: depth, v = thermal_wind.thermal_wind('s109.dens', 's105.dens', surface_delta=0)
In []: thermal_wind.plot_velocity_profile(depth, v)
Now, it’s your turn…