Example pages containing: tips | resources | functions/procedures
Zonal Average
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.
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.
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
gsnYAxisIrregular2Linear = True, transforms the irregular eta axis to a regular axis.
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.
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.
Adding a new curve to an existing XY plot involves three steps:
- The special create block is used to create a new data object containing the new curve to add.
- The NhlAddData function is used to add the dummy curve to the zonal means plot.
- The "setvalues" block is used to further customize the curve.
After the curve has been added, call the plot to draw everything.
Note: you can also add the additional line using gsn_add_polyline. This particular example was done this way to show another variation. Also, when you use NhlAddData, you can continue to use xy resources to customize the curve. Thirdly, any new curves added will be recognized by the automatical legend generator, if you set pmLegendDisplayMode to "Always".