[ncl-talk] some problem during vector panel plot

Mary Haley haley at ucar.edu
Tue Oct 13 13:22:12 MDT 2015


The problem is that you are panelling plots that are different sizes.  The
scaling for the plots is based on the first plot in your list, which means
if one of your other plots is larger, then the scaling won't necessarily be
correct.

You can try fixing this by setting:

  resP at gsnPanelScalePlotIndex = 2

This tells gsn_panel to base the scaling on the 3rd plot, which appears to
be the largest one.

However, since your vector reference annotation box is the same for all
three plots, there's no reason you need to include this box three times.
You can draw it just once, maybe at the bottom right edge of the bottom
plot.  We have an example of this on our panel page.  See example
panel_31.ncl:

http://www.ncl.ucar.edu/Applications/panel.shtml#ex31

I've included a simpler version of this script and its resultant image. The
"uvt.nc" NetCDF file can be downloaded from:

http://www.ncl.ucar.edu/Applications/Data/

--Mary


On Tue, Oct 13, 2015 at 1:41 AM, grace <313695096 at qq.com> wrote:

> Hi all:
>    I am trying to make a panel plot,but the  Xlabelvalue of the third
> plote not appear?
>    and how can I turn off the the reference vector box of the first and
> second plot and make the reference vector box of the third plot samller?
>    The text (TEST,OBS) that I add on the plot did not make any difference.
>    How can I slove those problem?
>    Or do you guys have some advice?
>    Any information will be appreciated.
>    This is my plot:
>
>
> This is my scirpt:
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> begin
> ;
> ; The WRF ARW input file.
> ; This needs to have a ".nc" appended, so just do it.
>   a = addfile("/public/home/huanglei/wrfdata/wrfout_d03_2015-05-01_12:00:
> 00.nc","r")
>     ij = wrf_user_ll_to_ij(a, 108.966667,34.433333,True)
>     print("lon location is: " +ij(0))
>     print("lat location is: " + ij(1))
>
> ; First get the variables we will need
> u10_2=new((/31,24/),float,"No_FillValue")
> v10_2=new((/31,24/),float,"No_FillValue")
>
>  filename1=systemfunc("ls
> /public/home/huanglei/wrfdata/wrfout_d03_2015-05*.nc")
>          fin1=addfiles(filename1,"r")
>          do i=0,30
>
>                  u10_1=fin1[i]->U10(0:23,ij(1)-1, ij(0)-1)
>                  v10_1=fin1[i]->V10(0:23,ij(1)-1, ij(0)-1)
>                  u10_2 (i,:)= u10_1
>                  v10_2 (i,:)= v10_1
>  end do
>      u10=ndtooned(u10_2)
>      v10=ndtooned(v10_2)
>      u10_d=u10(0:724)
>      v10_d=v10(0:724)
> ;;;;;;;;;;;;;;;get obs data;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>   ascii_filename = "/public/home/huanglei/obs.txt"
>   seismic = asciiread(ascii_filename,(/725,6/),"float")
>   seismic at _FillValue = -999
>      wdir = seismic(:,4)
>      wspd = seismic(:,5)
>      rad = 4.0*atan(1.0)/180.
>      u_o = wspd*sin(rad*wdir)
>      v_o = wspd*cos(rad*wdir)
> ;;;;;;;;;;;;;;;;;;;;;;;;;data for
> plot1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>  u10_new1=new((/25,220/),float)
>  u10_new1=0
>  u10_new1(8,:)=u10_d(0:219)
>  u10_new1(15,:)=u_o(0:219)
>  v10_new1=new((/25,220/),float)
>  v10_new1=0
>  v10_new1(8,:)=v10_d(0:219)
>  v10_new1(15,:)=v_o(0:219)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;data for
> plot2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>  u10_new2=new((/25,240/),float)
>  u10_new2=0
>  u10_new2(8,:)=u10_d(220:459)
>  u10_new2(15,:)=u_o(220:459)
>  v10_new2=new((/25,240/),float)
>  v10_new2=0
>  v10_new2(8,:)=v10_d(220:459)
>  v10_new2(15,:)=v_o(220:459)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;;;;;;;;;;;;;;;;;;;;;;;data for
> plot3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>  u10_new3=new((/25,264/),float)
>  u10_new3=0
>  u10_new3(8,:)=u10_d(461:724)
>  u10_new3(15,:)=u_o(461:724)
>  v10_new3=new((/25,264/),float)
>  v10_new3=0
>  v10_new3(8,:)=v10_d(461:724)
>  v10_new3(15,:)=v_o(461:724)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> wks  = gsn_open_wks("pdf","gsn_vector_panel")          ; open a Graphic
> wkStation
> plot = new(3,graphic)
>   res  = True                                      ; plot mods desired
>   res at gsnFrame  = False
>   res at gsnDraw  = False                          ; don't draw
> ;  res at tiMainString     = "Basic Vector Plot"
>   res at vcGlyphStyle     = "CurlyVector"             ; turn on curley
> vectors
>   res at gsnMaximize = True
>   res at vpHeightF   = 0.15
>   res at vpWidthF   = 0.8
>   ;res at vcRefMagnitudeF  = 5.0                       ; add a reference
> vector
>  ; res at vcRefLengthF     = 0.045                     ; what the ref length
> is
>  ; res at vcRefMagnitudeF           = 0.15
>  ; res at vcRefLengthF              = 0.001
>    res at vcRefAnnoArrowLineColor   = "black"         ; change ref vector
> color
>
>   res at pmLegendWidthF         = 0.10                  ; Change width and
>   res at pmLegendHeightF        = 0.10                  ; height of legend.
> ;  res at lgLabelFontHeightF     = 0.02                   ; change font
> height
>   res at tmYLOn             = False        ; Don't draw labels for left
>   res at tmYLLabelsOn       = False        ;  Y axes
>   res at tmYROn             = False        ; Don't draw labels for right
>   res at tmYRLabelsOn       = False        ;  Y axes
>
>
> ;;;;;;;;;;;;;;;;;;;;add text TEST / OBS;;;;;;;
>     res_text               = True
>     res_text at txFontHeightF = 0.01
>    ; res_text at txJust        = "CenterLeft"
>     m1 = "TEST"
>     m2 = "OBS"
>
>  res0=res
>   res0 at tmXBMode ="Explicit"
>   res0 at tmXBValues  =(/5,29,53,77,101,125,149,173,197/)
>   res0 at tmXBLabels = (/"5/2","5/3"," 5/4","5/5",
> "5/6","5/7","5/8","5/9","5/10"/)
>   res0 at tmXBLabelFontHeightF = 0.01
>   res0 at vcRefAnnoOrthogonalPosF = -0.33             ; move ref vector up
>   res0 at vcRefMagnitudeF         = 0.5             ; define vector ref mag
>   res0 at vcRefLengthF            = 0.025            ; define length of vec
> ref
>   res0 at vcRefAnnoParallelPosF     = 0.999
>   res0 at vpHeightF   = 0.15
>   res0 at vpWidthF   = 0.8
>   plot(0) = gsn_vector(wks,u10_new1,v10_new1,res0)
>  gsn_text(wks,plot(0),m1,190,10,res_text)
>  gsn_text(wks,plot(0),m2,190,35,res_text)
>   res1=res
>   res1 at tmXBMode ="Explicit"
>  ; res1 at tmXBValues  =(/221,245,269,293,317,341,365,389,413,437/)
>   res1 at tmXBValues  =(/1,25,49,73,97,121,145,169,193,217/)
>   res1 at tmXBLabels =
> (/"5/11","5/12","5/13","5/14","5/15","5/16","5/17","5/18","5/19","5/20"/)
>    res1 at tmXBLabelFontHeightF = 0.01
>     res1 at vcRefAnnoOrthogonalPosF = -0.33             ; move ref vector up
>   res1 at vcRefMagnitudeF         = 0.5             ; define vector ref mag
>   res1 at vcRefLengthF            = 0.025            ; define length of vec
> ref
>   res1 at vcRefAnnoParallelPosF     = 0.999
>    res1 at vpHeightF   = 0.15
>   res1 at vpWidthF   = 0.8
>   plot(1) = gsn_vector(wks,u10_new2,v10_new2,res1)
>
>  gsn_text(wks,plot(1),m1,200,10,res_text)
>  gsn_text(wks,plot(1),m2,200,35,res_text)
>   res2=res
>   res2 at tmXBMode ="Explicit"
>  ; res2 at tmXBValues  =(/461,485,509,533,557,581,605,629,653,677,701/)
>   res2 at tmXBValues  =(/1,25,49,73,97,121,145,169,193,217,241/)
>   res2 at tmXBLabels = (/"5/21"," 5/22","
> 5/23","5/24","5/25","5/27","5/28","5/29","5/30","5/31"/)
>   res2 at tmXBLabelFontHeightF = 0.01
>   res2 at vcRefAnnoOrthogonalPosF = -0.33             ; move ref vector up
>   res2 at vcRefMagnitudeF         = 0.5             ; define vector ref mag
>   res2 at vcRefLengthF            = 0.025            ; define length of vec
> ref
>   res2 at vcRefAnnoParallelPosF     = 0.999
>   res2 at vpHeightF   = 0.15
>   res2 at vpWidthF   = 0.8
>   plot(2) = gsn_vector(wks,u10_new3,v10_new3,res2)
>
>  gsn_text(wks,plot(2),m1,220,10,res_text)
>  gsn_text(wks,plot(2),m2,220,35,res_text)
>   ;;;;;;;;;;;;;;;;add obs test mark;;;;;;;;;;;;;;
>
>
>   resP            = True                         ; modify the panel plot
>  gsn_panel(wks,plot,(/3,1/),resP)               ; now draw as one plot
> ;frame(wks)
> end
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151013/3a9c58e2/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: C07165CD at 2BEB7910.8CB51C56
Type: application/octet-stream
Size: 283643 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151013/3a9c58e2/attachment-0002.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: panel_vector.png
Type: image/png
Size: 104483 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151013/3a9c58e2/attachment-0001.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: panel_vector.ncl
Type: application/octet-stream
Size: 2801 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151013/3a9c58e2/attachment-0003.obj 


More information about the ncl-talk mailing list