Case Study: Cross Section of Sandy

Download

File

Modified

File sandy_cross_section.tar.gz

Mar 19, 2015 by Iain Russell

Case Description

../../_images/sandy-xs-with-map.png

In this exercise we will produce a cross section plot of relative vorticity through Hurricane Sandy. We will also create a more interesting layout which will include a geographic map showing the path of the cross section line.

Check that the supplied data files are as expected. We will prepare the plot interactively using icons. Then, at the end, we will put it all together into a macro. Remember to give your icons useful names!

It’s probably easiest to prepare the cross section and the map separately, then bring them together at the end.

Steps

Plotting the Cross Section

Use a Cross Section View icon with a logarithmic scale vertical axis. The transect line should go from [50N, 90W] to [30N, 60W], and the top pressure level we wish to display is 200hPa.

To add the title label “Pressure (hPa)”, customise a new Axis Plotting icon and drop it into the appropriate place in the Cross Section View icon’s editor.

To get the vorticity data into the right units, we need to multiply it by 100000 (one hundred thousand) - use a Simple Formula icon for this.

Devise your own colour scale with a new Contouring icon, or else use the pre-prepared one in the Solutions folder.

Make the title a little larger with a Text Plotting icon.

Use a Legend icon to move the legend to the right-hand side of the plot as shown. We may need to move this a little bit once we have the complete layout.

Plotting the Map

Use a Geographical View icon to define the map. The map area should be defined as being from [20oN, 110oW] to [70oN, 30oW] and should show the line of the cross section - use an Input Visualiser icon coupled with a Graph Plotting icon to achieve this. The location of New York City (40.71oN, 74oW) can also be added with another Input Visualiser icon coupled with a Symbol Plotting icon. The legend will look better if customised to use the Disjoint type.

A feature which will make the map overlay better with the cross section plot is to remove the labels from its left and bottom axes (via a Coastlines icon).

Putting it all together

These two plots can be combined by using a Display Window icon. Create one, edit it and create two views inside it. Drop your Geographic View icon into one and your Cross Section View into the other. Position them in a similar way as shown in the example plot. Once saved, this icon can be visualised and the final result created by dropping the various icons into the two views in the Display Window.

Creating a Macro

Create a macro from this plot by following this procedure.

  • create a new Macro icon and edit it

  • drop your Display Window icon into the Macro Editor

    • this will generate code for all the embedded icons contained in it

  • plot the result of the plot_superpage() function call to confirm that this much works

  • drop your data computation (Simple Formula) icon into the editor

  • plot the data in the correct page (see below for information on how to do this)

  • add the title and legend

  • plot the cross section line and the NYC marker into the other page, adding the legend as well

  • clean up the variable names if needed (there may be some hexadecimal representations of characters in the icon names which are not valid inside Macro variable names)

Plotting to multiple pages in Macro

If there is a display window variable called dw (for example) generated by the plot_superpage() command, and it has multiple pages (in this case we have two - one for each view), then we need to call the plot() command once for each page.

As an example, if we want to plot data with visdefs into the second page, we would write:

plot(dw[2], data, visdefs)

Improving the macro

Using a macro gives us an opportunity to improve the maintainability of the plot. In particular, we currently duplicate the coordinates of the cross section transect line - it is defined once in the Cross Section View icon and again in the Input Visualiser icon which is used to draw the line on the map. Put the coordinates of these points into variables at the top of the macro, then replace the two references to the line coordinates with these variables.

Extra Work

Try the following if you have time.

Add a vertical profile

Why stop at 2 views? Add a Vertical Profile View to the plot, showing a profile of the data at New York City.