Univeristy of Alabama in Huntsville

UAH LTG IDL Library

IDL Routines from Phillip Bitzer and UAH Lightning Group

summary     class     fields     routine details     file attributes

radar/

pmb_plot_radar_data.pro

Radar

includes main-level program

This file takes gridded radar data and plots the data. The parameter is a structure that might be read with pmb_get_armor_data or ats_import_armor_nc. If you have a variable radar_data (see Examples), the tags of the structure should be something like:

.data .dz, .dza, .rhv, etc .x .y .z
There a lot of keywords to control the plot. By default, a composite plot is created. You can also slice in any direction. For instance, to create a horizontal slice (radar at a particular level), use the zslice keyword. If you provide a height that is not in the file, I will get the next smallest and get those values. No warning is printed in this case. You can also slice for an arbritarily oriented vertical slice, but this is experimental.

Using !P.MULTI is not encouraged with this routine, but if you do use it, you'll want to turn off the color bar. It's better to set the positions of the plots instead through the position keyword.

This is a working file, as some kinks still need to be worked out (see the "Bugs"). For the most part, it's pretty functional.

(There's also a lot of old/working code laying around - dirty laundry. Proceed into the abyss at your own risk.)

Examples

First, import some gridded data:

radar_data = ats_import_armor_nc(file, var='dza')
BTW, if you already have some data at the command line, you still use this routine. Say you have reflectivity (dz) and differential reflectivity (dr) and the corresponding x, y, z arrays. Then, pack it up into a structure:
radar_data = { data:{dz:dz, dr:dr}, x:x, y:y, z:z }
Plot a basic composite scan:
pmb_plot_radar_data, radar_data[0]
Want to plot differential reflectivity instead? Sure:
pmb_plot_radar_data, radar_data[0], VARIABLE='dr'
Try this, assuming you have some LMA data (in Cartesian space) you'd like to overplot:
pmb_plot_radar_data, radar_data[0], /comp, overplot = [[lma_xyz.x], [lma_xyz.y]]
Get fancy, using Coyote Graphics:
xsl = [-45., -10.] & ysl = [16., 40.] ;make a slice cgWindow, /FREE pmb_plot_radar_data, radar_data[0], xslice=xsl, yslice=ysl, overplot = ([[lma_xyz.x], [lma_xyz.y], [lma_xyz.z]]), /ADD cgCONTROL, output = date + '_radar_slice.png', /PS_DECOMPOSED, PS_DELETE=0, /PS_ENCAP
Keep going:
pmb_plot_radar_data, radar_data[0], xrange=xsl, yrange=ysl, overplot = ([[lma_xyz.x], [lma_xyz.y], [lma_xyz.z]]), /ADD cgplot, xsl, ysl, /over, /ADD cgCONTROL, output = date + '_dBZ_zoom.png', PS_DELETE=0, /PS_ENCAP
If you have hydrometeor data (aka particle ID), you can plot that too:
cgWindow, /FREE pmb_plot_radar_data, pd_data[0], xslice=xsl, yslice=ysl, overplot = ([[lma_xyz.x], [lma_xyz.y], [lma_xyz.z]]), /ADD cgCONTROL, output = date + '_pd_slice.png', /PS_DECOMPOSED, PS_DELETE=0, /PS_ENCAP

Author information

Author

Phillip M. Bitzer, University of Alabama in Huntsville, pm.bitzer "AT" uah.edu

History

Modification History:

First written: Oct 1, 2012 Added noerase, position keywords 20121105 PMB Fixed error to get correct colorbar when variable is not specified 20121209 PMB Major fix to "slicing" capabilites 20121210 PMB When plotting PD data, a "discrete" contour plot is now made 20121212 PMB When creating a zslice, only plot data "near" that slice 20131031 PMB For reflectivity, make the color bar ticks formatting as F6.2 20140327 (commit) PMB

Other file information

Bugs:

(Well, actually just some notes for the author.)

;;;;;;;;;;;;;;;;;;;;;;;;;Slice Testing Notes:

;todo: change input so that if N_ELEMENTS(xslice) EQ 1 => do xslice (as before) ;todo: change input so that if N_ELEMENTS(yslice) EQ 1 => do yslice (as before) ;todo: change input so that if N_ELEMENTS(xslice) EQ 2 && N_ELEMENTS(yslice) EQ 2 => do "slice" (replace rotation) ;todo: change input so that if other combinations of xslice/yslice => freak out
Note: rotation end points are used to define the output range - this can yield a "backwards" plot when comparing to x/y slice Example:
xrange = [-10, 50] yrange = [-60, -20] xval = [40, 40] yval = [-20, -60] pmb_plot_radar_data, r[0], var='dza', xrange=xrange, yrange=yrange, rotation=[xval[0], yval[0], xval[1], yval[1]], sliceCenter=sliceCenter pmb_plot_radar_data, r[0], var='dza', xrange=xrange, yrange=yrange, xslice=xval[0], sliceCenter=sliceCenter
vs.:
yval = [-60, -20] pmb_plot_radar_data, r[0], var='dza', xrange=xrange, yrange=yrange, rotation=[xval[0], yval[0], xval[1], yval[1]], sliceCenter=sliceCenter pmb_plot_radar_data, r[0], var='dza', xrange=xrange, yrange=yrange, xslice=xval[0], sliceCenter=sliceCenter
Tried:
xgrid=1, ygrid =1, zgrid=1 (ANISOTROPY=[1,1,1])
Tried:
xgrid=0.5, ygrid =1=0.5, zgrid=0.5 (ANISOTROPY=[1,1,1])
Tried:
xgrid=0.5, ygrid =1=0.5, zgrid=0.25 (ANISOTROPY=[1,1,1]) (Why does/should this work?)

Uses:

pmb_radar_palette, Coyote Graphics, pmb_calc_gradient, partvelvec (Astro) (The last two are for gradient functionality only.)

Routines

top pmb_plot_radar_data

pmb_plot_radar_data, radar_struct [, Variable=string], Type=Type [, Xrange=2 element array] [, Yrange=2 element array] [, Zrange=2 element array] [, Overplot=nx2 or nx3 array] [, Position=4 element array] [, /Noerase] [, Colors=numeric array] [, Levels=type] [, /Add] [, /Composite], Scan_height=Scan_height [, Zslice=numeric] [, Xslice=value or 2 element array] [, Yslice=value or 2 element array], rotation=rotation [, /DoGradient] [, /Dereference] [, TITLE=string] [, /NoColorBar] [, SliceCenter=2 element array] [, Vertices=array]

Given a structure of gridded radar data, make a plot.

Parameters

radar_struct in required type=structure

A radar structure that might be read in by pmb_get_armor_data. (See full documentation.)

Keywords

Variable in optional type=string default=dz

Specifies the variable to plot.

Type

deprecated

Xrange in optional type=2 element array default=[MIN(x), MAX(x)]

Set the range of the x data. Ignored for an arbitrary slice plot. Note this does *not* set the plot x range (necessarily).

Yrange in optional type=2 element array default=[MIN(y), MAX(y)]

Set the range of the y data. Ignored for an arbitrary slice plot. Note this does *not* set the plot y range (necessarily).

Zrange in optional type=2 element array default=[MIN(z), MAX(z)]

Set the range of the z data. Ignored for an arbitrary slice plot. Note this does *not* set the plot z range (necessarily).

Overplot in optional type=nx2 or nx3 array

Data you wish to overplot. If you are doing a PPI plot, this can be nx2 array. Otherwise, you must pass a nx3 array (of x, y, z)

Position in optional type=4 element array default=[0.19, 0.13, 0.8, .9]

Set the position of the contour plot. Ignored if ARRAY_EQUAL(!P.MULTI, 1) = 1.

Noerase in optional type=boolean default=0B

Set this keyword to prevent erasing of the plotting space

Colors in optional type=numeric array

Provide the colors of the contours. You must also set levels. If not provided, the appropriate color table for the plotted variable is loaded from pmb_radar_palette

Levels in optional type=type

Provide the levels of the contours. You must also set colors. If not provided, the appropriate color table for the plotted variable is loaded from pmb_radar_palette

Add in optional type=boolean default= 0

Add the plot to a cgWindow

Composite in optional type=boolean default=0

Create a composite plot. Ignored if zSlice is set.

Scan_height

deprecated

Zslice in optional type=numeric

Specify a horizontal slice of the data to plot. In units of *distance*.

Xslice in optional type=value or 2 element array

If this has one element, a slice of the data along the *distance* provided in this keyword is plotted. If there are two elements, *and* ySlice as two elements, data along xslice=[xi, xf] (and yslice=[yi, yf]) is plotted.

Yslice in optional type=value or 2 element array

If this has one element, a slice of the data along the *distance* provided in this keyword is plotted. If there are two elements, *and* xSlice as two elements, data along xslice=[xi, xf] (and yslice=[yi, yf]) is plotted.

rotation

deprecated

DoGradient in optional type=boolean default=0

Overplot the gradient of the data. Experimental and may change.

Dereference in optional type=boolean default=0

If the radar_struct contains pointers, the pertient data is dereferenced. Will default to true if radar_struct contains pointers (specifically if PTR_VALID(radar_struct.data) is true)

TITLE in optional type=string default=varies with type of plot

Override the default plot title

NoColorBar in optional type=boolean default=0

Suppress the colorbar. Useful when making a "grid" of plots with !P.MULTI

SliceCenter out optional type=2 element array

If doing an arbitrary slice, this keyword will contain the center of slice

Vertices out optional type=array

If doing an arbitrary slice, this keyword will contain the vertices used for the slice. See EXTRACT_SLICE

Other attributes

Uses:

pmb_radar_palette

File attributes

Modification date: Wed Dec 23 17:43:21 2015
Lines: 314
Docformat: rst rst