Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Plotting the Cross Section

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

To add the title label "Pressure (hPa)", customise an 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 XXXX 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 (XXXX40.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.

...

Create a macro from this plot , either from the Generate Macro button in the Display Window, or by creating 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

dropping the various icons into the Macro Editor. In either case, pay attention to the plot() command. 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:

Code Block
languagepy
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 a variable variables at the top of the macro, then replace the two references to the line coordinates with this variable. Note that this may not work without another small modification - if the Cross Section View code is inside a function, then it will not be able to see any variables defined outside of the function. We can either set the variable to be global by putting the keyword global in front of it, or else pass it as an argument to the function. The second is usually the preferred option.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.