NCL Home> Application examples> Data Analysis || Data files for some examples

Example pages containing: tips | resources | functions/procedures

Zonal Average

This page shows how to create various types of zonal average plots.
zonal_cn_1.ncl: The simplest. Reads in data and then creates a default zonal means plot.

dim_avg averages the right most dimension of a variable. So, for TS(time,lat,lon), the lon dimension is averaged which results in a zonal average.

This example used dim_avg_Wrap which preserves meta data.

zonal_2.ncl: A two-dimensional example.
zonal_3.ncl: Add zonal average to a cylindrical equidistant plot. gsnZonalMean turns on the zonal average.

The zonal average plot is modified by using gsnZonalMeanXMinF, gsnZonalMeanXMaxF, and gsnZonalMeanYRefLine to set the minimum X-axis value, the maximum X-axis value, and the X-axis value where the reference line will be drawn.

zonal_4.ncl: Transforms the axis.

tiXAxisString = "latitude", adds an axis string
tiYAxisString = "eta", adds another axis string
sfXArray= lat, uses the latitude array to label the x-axis
sfYArray=eta, uses eta to label the y-axis

zonal_5.ncl: Transforms plot so that the eta axis is evenly spaced.

gsnYAxisIrregular2Linear = True, transforms the irregular eta axis to a regular axis.

zonal_6.ncl: Changes Y-axis to log scale.

gsnYAxisIrregular2Log = True, Changes the y-axis to log scale when the original axis is irregular e.g. eta. If the y-axis is regular e.g. levels, then trYLog = True, should be used to set the y-axis to log scale.

cnInfoLabelOn = False, Turns off the contour information label.

zonal_7.ncl: This example is similar to example #3, except instead of setting a resource to create a zonal means plot, gsn_csm_attach_zonal_means is used to create and attach the plot separately. Using this gives you more control over the look of the zonal means plot.

The tickmark resources tmXBMode, tmXBValues, and tmXBLabels are set to explicitly label the X axis of a zonal means plot, and other resources are set to change the size and color of the X axis labels.