Lab 2

advertisement
Name: ____________________________
Oceanographic & Meteorological Quantitative Methods – SO335 Lab 2 – (100 pts)
Using “real” data in MATLAB
At 9:45 p.m. on the evening of May 4, 2007, the small town of Greensburg, KS was
leveled by a very large, EF-5 rated tornado.
The ingredients for tornado formation have been understood for several decades: ample
atmospheric instability (measured by the Convective Available Potential Energy, CAPE)
and vertical wind shear. One of the more challenging forecasting aspects is to predict
whether storms will actually form, as many times the atmosphere has high CAPE and
shear, but no storms form. A common culprit for the suppression of severe storm
formation is the presence of a strong temperature inversion, colloquially known as a
“cap.” To diagnose the cap, meteorologists analyze vertical profiles of temperature and
dew point temperature, measured by balloon-launched radiosonde soundings, and these
are some of the best tools available to meteorologists in severe storm forecasting. The
evolution of the temperature inversion with time can provide clues as to whether the cap
is eroding: warming at the surface, often combined with moistening at the surface, and
cooling near the top of the inversion, can all signal an eroding cap and point toward an
atmosphere that is more conducive to explosive thunderstorm development.
Goal: The goal of this portion of the lab is to: (1) learn to access observed data from
internet repositories and import that data into MATLAB; and (2) to plot that data in
simple, two-dimensional figures that allow for basic thermodynamic analysis.
Task 1: Simple analysis and plotting.
Visit the University of Wyoming upper-air web page at
http://weather.uwyo.edu/upperair/sounding.html. Let’s first examine a graphical
representation of the temperatures above Dodge City, KS (DDC; station 72451), which is
the closest upper-air station to Greensburg. Make a GIF: Skew-T plot of the 2007-May04/12Z temperature data. Remember, 12Z is 7:00 a.m. local time in May in Kansas. The
result should look like that shown in the left panel of Figure 1.
Now, look at the 18Z “special” sounding from DDC. It is “special” because radiosonde
releases in the U.S. typically only occur at 00Z and 12Z, and are released at other times
1
only during extreme events. To view the 18Z data, you first have to look at all of the
images between 04/12Z and 05/00Z (you may have to broaden beyond those dates and
toggle back and forth – eventually the site will show you the 04/18Z sounding). The
Univ Wyoming site is smart enough to look for any special radiosonde data that might
have occurred in the off hours, and create plots of those data. Cycle through the
observations. Note that at 05/00Z, Dodge City was located behind the dry line, and as
such, the temperature profile was dry adiabatic from the surface to nearly 650 mb.
Figure 1: upper-air soundings for DDC for 12Z and 18Z 04 May 2007, day of the Greensburg, KS EF-5
tornado.
The first task of this lab is to locate these data (in text format) and import them into
MATLAB. There are many ways to do that; here is one method. In the UWYO web
portal, instead of making GIF: Skew-T data, choose Text: List. Highlight with the mouse
the 12Z data (no header rows—MATLAB is very picky about mixing letters and
numbers!) and copy and paste those data into an Excel workbook. You’ll likely have
them paste into Excel all in one column, which is a problem. To create multiple columns,
one option (of many) is to use the Text to Columns tool in Excel, which is under the Data
menu option. Select the entire column and then use Delimited, with Space as the
delimiter. Finish that, and you should have a nice Excel file with 11 columns (A-K) and
71 rows (if Column A comes in as all blanks, you should delete it). Save that excel file as
“ddc_12z_04may2007.xlsx” (again, save this file in your MATLAB working folder to
save yourself from hunting around for it later).
To import data from the Excel workbook in MATLAB, use the following command:
ddc_12z_04may2007 = xlsread('ddc_12z_04may2007.xlsx');
Here, ddc_12z_04may2007 is the output variable from the function xlsread. Doubleclick on that variable and look at it in the variable editor window.
1. (5 points) What do the first two rows look like? Why are there NaN values in those
two rows?
2
2. (5 points) What are the values of row 11, columns 1, 2, 3, 4, 7, and 8? Be sure to
include correct units.
3. (5 points) How warm was the atmosphere at 700 mb? One of the famous severe
storm meteorologists, Dr. Howard Bluestein of the University of Oklahoma, often says
that a 700 mb temperature of +12°C or higher represents an “unbreakable” cap
(presumably such a statement is based on his many years of experience with severe
storms). Was the 700 mb temperature at 12Z on 04 May 2007 indicative of an
unbreakable cap that day in southwest Kansas?
Let’s now plot the data. First, create three new variables from ddc_12z_04may2007,
pressure, temperature, and dew point temperature:
press_12z = ddc_12z_04may2007(:,1);
temp_12z = ddc_12z_04may2007(:,3);
dewpt_12z = ddc_12z_04may2007(:,4);
4. (5 points) Execute those three commands above. Describe what they did.
Once you’ve created press, temp, and dewpt, plot both temperature and dew point
temperature against pressure. Be sure to add lines of code to include labels for the x- and
y-axes, as well as a title. (If you forgot how to do that, look back at Lab 1 and use the
internet). Your results should resemble Figure 2.
figure(1)
clf
plot(temp_12z,press_12z,'r')
hold on
plot(dewpt_12z,press_12z,'g')
axis ij
legend('12z temperature','12z dew point temperature')
The plot syntax plots an “x” variable against a “y” variable, and then allows for some
extra information at the end, like the color of the line (‘r’ stands for red, ‘g’ for green). It
also allows for line style. The axis ij command inverted the y axis, making 1000 mb
3
appear at the bottom and 0 mb at the top. The legend command adds legend entries to
the figure. The default legend position is in the upper-right corner, although there are
many other options (help legend will show them).
Figure 2: Temperature (red curve) and dew point temperature (green curve) above DDC, 12Z 04 May 2007.
5. (5 points) What does the hold on command do?
Let’s do a few other things to “pretty up” the plot: increase the line thickness (default
value is 1), and move the x-axis a little more to the right (so the data aren’t scrunched up
against the edge):
figure(1)
clf
linewidth=2;
plot(temp_12z,press_12z,'r','linewidth',linewidth)
hold on
plot(dewpt_12z,press_12z,'g','linewidth',linewidth)
axis ij
legend('12z temperature','12z dew point temperature')
xlim([-80 30])
Notice the new variable, linewidth, that is defined as 2. By defining variables and then
using them in the code, we can make one quick change, and the rest of the code will
reflect it.
6. (5 points) What is the pressure level of the base of the inversion (where the
temperature stops climbing and starts falling again)? What is the temperature of that
level?
4
Task 2: More simple plotting.
Go back to the University of Wyoming data portal, grab the 18Z text data, and import it
into MATLAB, storing it as the variable “ddc_18z_04may2007”. Create similar pressure,
temperature, and dew point temperature variables, but this time use the 18Z data:
temp_18z, press_18z, dewpt_18z.
Plot the 18Z data in a new figure window (Fig. 2). Again, add appropriate title and axis
labels using the title, xlabel, and ylabel commands in MATLAB. This time, instead of
solid line, use a dashed line for both temperature and dew point temperature. The code
below suggests how to make the lines dashed, using the ‘--’ syntax:
figure(2)
clf
linewidth=2;
plot(temp_18z,press_18z,'r--','linewidth',linewidth)
hold on
plot(dewpt_18z,press_18z,'g--','linewidth',linewidth)
axis ij
legend('18z temperature','18z dew point temperature')
xlim([-80 30])
7. (10 points) Vertical wind shear. As mentioned in the introduction, instability is not the
only ingredient needed for severe thunderstorm formation. Vertical wind shear, or the
change in wind speed and direction with height, is also critical to generate rotating
updrafts. Calculate the surface to 6 km bulk wind shear for DDC at 18Z. Show all work.
a. To find the surface-to-6 km bulk wind shear, first find the u and v wind components of
the surface (row 3) and 6000 m (row 22) winds. (Note, the sounding doesn’t have wind
at exactly 6000 m, but 6096 m is close enough).
Surface:
u ________________
6 km: u ________________
v ________________
6 km: v ________________
b. Next, find the vector difference in winds, 6 km minus surface (find the iˆ and ĵ
components separately):
udiff  u6 km  usfc
5
c. Finally, calculate the magnitude of the vector difference:
udiff 
d. In the severe storms community, bulk wind shear of at least 40 knots is considered
sufficient for supercell thunderstorms (Rasmussen 2003). Comment on the bulk wind
shear observed in the 18Z sounding at DDC.
Task 3: Double plotting.
Plot both soundings in the same figure window. Modify the title, legend entries, and axes
labels, as appropriate. The 12Z data should be plotted using solid lines, and the 18Z data
plotted using dashed lines.
Task 4: Compare two soundings.
For the final task, we want to harness the power of MATLAB to empirically compare the
two soundings (not just qualitatively look at them on a figure). The best way to compare
the temperatures at 12Z with the temperatures at 18Z is to subtract them. However, if
you look at the two different sounding data, you’ll notice that the observations are made
at highly irregular pressure levels. For example, while the first observation in each
sounding is made at 915 mb (row 3 in ddc_12z_04may2007 and ddc_18z_04may2007),
the next observation (row 4) at 18Z is at 853 mb, while row 4 at 12Z is at 901.6 mb.
Thus, we cannot simply subtract the two. One solution is to first linearly interpolate the
temperature and dew point temperature data. If we choose the same regularly-spaced
interpolant for both soundings, then we can subtract the interpolated data (because each
row in interpolated data will match).
To do that, we will use the function interp1, which according to MATLAB help
command:
help interp1
YI = interp1(X,Y,XI) interpolates to find YI, the values of the
underlying function Y at the points in the array XI.
6
In plain-speak, that means that if you have a variable Y that is defined at irregular points
X, you can interpolate Y onto a smooth variable XI. The new values of Y will be stored
in YI.
For us, let’s do the following. First, define our pressure interpolation points. Let’s
interpolate every 1 mb, from 915 mb to 15 mb:
press_interp = 915:-1:15;
This command creates a variable press_interp that is 1 x 901. Double-click on it in the
workspace window and look at it.
8. (5 points) What does 915:-1:15 actually do? What if you put 915:1:15 (instead of -1)?
Finally, what would 915:-0.5:15 do? (You can try these in MATLAB and look at them).
Now, let’s interpolate 12Z temp, 12Z dew point, 18Z temp, and 18Z dew point temp, at
this new, regularly-spaced pressure variable:
temp_12z_interp = interp1(press_12z,temp_12z,press_interp);
dewpt_12z_interp = interp1(press_12z,dewpt_12z,press_interp);
For the 18Z data, there is a problem. MATLAB’s interpolator does not know how to
interpolate between two points with the same value. For example, the 18Z sounding has
two entries at 24.4 mb (rows 67 and 68). That is likely due to a bug in the sounding
reporting software that NOAA uses (e.g., how can 24.4 mb have two different values for
the data in columns 9, 10, and 11?) To fix this, we need to tell MATLAB to skip row 68,
and use only rows 1-67 and 69 to the end. It’s straightforward enough:
temp_18z_interp = interp1(press_18z([1:67 69:end],1),temp_18z([1:67
69:end],1),press_interp);
dewpt_18z_interp = interp1(press_18z([1:67 69:end],1),dewpt_18z([1:67
69:end],1),press_interp);
The syntax press_18z([1:67 69:end],1) tells MATLAB to grab rows 1-67 and 69 to
the “end” (and MATLAB recognizes what “end” means), and column 1, of the variable
press_18z.
Plot differences, subtracting the 12Z data from the 18Z data. Scale the x-axis from -20 to
20, and add appropriate titles, axis labels, and legend entry. The resulting difference plot
should look like Figure 3.
7
Figure 3: Difference between 18Z and 12Z temperatures (red curve) and dew point temperatures (green
curve) at Dodge City, KS on 04 May 2007.
Deliverables:
Be sure to turn in three printed figures (15 points each), your printed and commented
MATLAB code (10 points), and the answers to the questions in this lab (45 points worth
of questions).
8
Download