Name __________________________ Oceanographic & Meteorological Quantitative Methods – SO335 Lab 3 – (100 pts) *All code written for this lab should be contained in an appropriately commented script file that is handed in upon completion of the lab. Objectives: At the conclusion of this lab, you should be able to: (1) Better understand uses of the del operator ï (2) Calculate gradient, divergence, and vorticity using ï applied to both scalars (for gradient) and vectors (for divergence and curl) (3) Use MATLAB to accomplish objectives (1) and (2). I. Gradient of a scalar In Lab 1, you analyzed gridded pressure data for two dates of interest: 28 Jun 2012 and 25 Dec 2013. In this lab, we will return to the pressure fields (so you should load lab1.mat and lab3.mat). 1. Use the gradient function in MATLAB to plot filled contours of pressure gradient for both dates. In addition to the standard expectations for your figure (appropriate title and axis labels), add labels to the contours by modifying the following syntax template (replace “….” as appropriate): [dpdx,dpdy] = gradient (….); presgrad_magnitude = sqrt(….); [c,h] = contourf(….); clabel(c,h); %clabel will label the contour lines For hints at how to correctly use gradient and clabel, you should look at the help files for both (type help gradient and help clabel at the command prompt). Usage examples appear at the top of the help file. Often there are multiple ways to use each function; the most common uses will appear first. For the dx and dy spacing, instead of converting to km (or to m), we will continue with degrees. The spacing is thus 2.5° by -2.5° in the x- and y-direction. (Note the y-spacing is negative: look at the variable “lat”: point 1 is 90, point 2 is 87.5, point 3 is 85, etc… so the latitudes count down by 2.5 degrees). 2. Use the quiver function in MATLAB to plot the iˆ and jĖ pressure gradient components (calculated above using the gradient function) overlaid on contour-filled magnitudes of pressure gradient and simple, green contour lines of the pressure field. The result is a figure with three data pieces: contour-filled pressure gradient magnitude, pressure curves (in mb), and quivered pressure gradient vector. 1 “Pretty up” each figure using the following: make the pressure gradient vector arrows red to help us see them. Scale the vectors by 2 (see the quiver help command for an example). Standardize the color ranges using caxis (suggest 0 to 5 as one possible range that shows enough detail to be useful). Add coastlines. Add a colorbar. Add appropriate titles and axis labels. You should complete these two tasks for both 28 Jun 2012 and 25 Dec 2013, resulting in four figures. Only print and attach to the lab deliverable the two figures created in #2 (10 pts each). You should also type a one-paragraph description (double-spaced) of the results. In this paragraph, analyze the relationship between the pressure gradient vectors, the pressure gradient magnitude, and the pressure lines themselves. Also comment on any important differences between the two dates. (10 pts). II. Divergence of a vector In addition to pressure, the NCEP–DOE Reanalysis II product http://www.esrl.noaa.gov/psd/ data/gridded/data.ncep.reanalysis2.html also contains the u and v wind components, for the surface (10 m) and also multiple pressure levels (1000 mb up to 10 mb). NOAA provides those reanalysis files in NetCDF format. For simplicity, the 10-m wind observations from those NetCDF files have already been extracted for you (using “nc_varget” command) and are hosted at: http://www.usna.edu/Users/oceano/barrett/SO335/lab3.mat. Once you load lab3.mat, you should see six variables: uwind_28jun2012, vwind_28jun2012, uwind_25dec2013, vwind_25dec2013, lon, lat. These files should be the same shape as the pressure fields from Lab 1 and part I of Lab 3. 1. Using the divergence function in MATLAB, calculate the divergence of the vector fields on both 28 Jun 2012 and 25 Dec 2013. Create two figures (with appropriate titles and axis labels) that display: magnitude of the divergence field in labeled, filled contours, and the quivered wind field. “Pretty” up each figure with the following: Use the command “axis tight” to bring the figure edges closer to the data. Scale the quivered vector field using the scale factor of 2. Add coastlines (use linewidth 2). Add a colorbar. Center the color range using the command caxis([min max]), replacing “min” and “max” with values (center them around zero: for example, [-1 1], not [-1.2 1.0]). You should have two figures to add to the lab deliverable (10 pts each). Similar to the task in Part I of this lab, type a paragraph analyzing the relationship between the surface wind vectors and the magnitude and sign of the divergence field. (10 pts). 2 III. Vorticity of a vector 1. Using the curl command in MATLAB, calculate the relative vorticity of the surface wind field for both 28 Jun 2014 and 25 Dec 2013. Similar to the task in Part II of this lab, create figures with labeled, filled relative vorticity contours, then overlay the surface wind field (add appropriate titles and axis labels). You should have two more figures to add to the lab deliverable (10 pts each). “Pretty up” each figure using similar techniques as in Part II. Type a double-spaced paragraph analyzing the relationship between the surface wind field and the magnitude and sign of the relative vorticity field. (10 pts). Turn in your annotate MATLAB code with the lab deliverable. Summary of deliverables 2 figures, 1 paragraph from Gradient section (30 points) 2 figures, 1 paragraph from Divergence section (30 points) 2 figures, 1 paragraph from Vorticity section (30 points) Annotated code (10 points) 3