[ncl-talk] attached zonal plot

Buzan, Jonathan R jbuzan at purdue.edu
Thu Nov 3 09:41:39 MDT 2016


Thanks Mary!  I’ll fiddle around with this!

-Jonathan




On Nov 2, 2016, at 11:55 PM, Mary Haley <haley at ucar.edu<mailto:haley at ucar.edu>> wrote:

Hi Jonathan,

The gsn_csm_attach_zonal_means_plot is really meant for just one zonal means, and doesn't have any hooks for extra lines.

There's unadvertised function called gsn_csm_zonal_means which is called by the gsn_csm_attach_zonal_means plot. It basically creates the XY zonal means plot under the hood and returns it. The gsn_csm_attach_zonal_means function calls this function and then attaches the zonal plot to the right of an existing map plot.

Using gsn_csm_zonal_means, I created the two zonal means plots myself, used "overlay" to overlay them into one plot, and then attached the overlaid XY plots myself using gsn_add_annotation.

See the attached zonal.ncl example and resultant PNG image.  I didn't have time to find a dataset that would produce a more interesting zonal plot, so I just used a standard one that you can download from:

http://www.ncl.ucar.edu/Applications/Data/cdf/ts_Amon_CESM1-CAM5_historical_r1i1p1_185001-200512.nc

You will likely want to modify the "attach_zonal_plots_to_map_plot" function in this script to customize how you want the zonal means plots to appear, for example, what color to use for the XY lines, how wide to make the plot, what X/Y axes min/max values you want, etc.

--Mary


On Wed, Nov 2, 2016 at 2:44 PM, Buzan, Jonathan R <jbuzan at purdue.edu<mailto:jbuzan at purdue.edu>> wrote:
Hi NCL,

I am attempting to plot zonal means of my two sets of data.  However, every time it tries to plot the zonal means, even with the same trXMaxF and trXMinF, the zonal plots do not match on the same grid (see attached).  Is there a way to fix this?

-Jonathan


ex. plot lines.

  zres at trXMinF              = 0.      ; Could also use gsnZonalMeanXMinF
  zres at trXMaxF              = 3.      ; Could also use gsnZonalMeanXMaxF
  zres at trYMinF              = -57
  zres at trYMaxF              =  57
  zres1 at trXMinF              = 0.      ; Could also use gsnZonalMeanXMinF
  zres1 at trXMaxF              = 3.      ; Could also use gsnZonalMeanXMaxF
  zres1 at trYMinF              = -57
  zres1 at trYMaxF              =  57

    plots = gsn_csm_contour_map(wks,tmp_var(:,:),res)
    plots1 = gsn_csm_contour(wks,tmp_var1(:,:),res2)
    plots1  = gsn_contour_shade(plots1,minshade,maxshade,opt)
overlay(plots,plots1)
  zonal_id1 = gsn_csm_attach_zonal_means(wks,plots,tmp_var1(:,:),zres)
  zonal_id2 = gsn_csm_attach_zonal_means(wks,plots,tmp_var(:,:),zres1)
<plot.png>

_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk


<two_zonal_plots.png><zonal.ncl>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161103/f6c4ef6d/attachment.html 


More information about the ncl-talk mailing list