[ncl-talk] [Help] multi panel plots

Guido Cioni guidocioni at gmail.com
Wed Mar 8 02:46:28 MST 2017


Hey,
In order to debug I would suggest you to move everything that does not have
to change in every interaction (like the plot resources and the call to the
workstation)  out of the do loop. That can cause problems given that you're
overwriting the same variable over and over.
Second, use the := operator when reading files and defining variables so
that you're sure that you're overwriting the old ones.
I'm pretty sure it's the call to the workstation in every loop that is
screwing up everything ☺️


Il 8 mar 2017 5:42 AM, 조익현 <ehcho at kma.go.kr> ha scritto:

> Dear NCL users,
>
>
> I have a question about multi panel plots.
>
> I'm trying to get  multi panel plots(3x3) using loop of 9 GRIB files,
>
> but it displays only last one output(plot(8)) on 3x3 panel.
>
>
> The basic structure is the following
> ;;;
> do i1 = 0, 8
>   grib file read and define resource
>   plot(i1) =  gsn_csm_contour_map
> end do
>
>  resP = True
>   gsn_panel(wks,plot,(/3,3/),resP)
> ;;;;
>
>
> Any help will be appreciated.
>
> Cho
>
>
>
> ========================================== here is the script
>
> 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/csm/contributed.ncl"
>
> begin
>
>
>
>   ANLTIM = "2017030700"
>
>   plot=new(9,graphic)
>
>   do i1 = 0,8
>   i=i1*12
>   timestep = sprinti("%0.3i", i)
>
>   dir = "/op/nwp/post/EXTJ/ECMW/OPER/DAIN/201703/0700/"
>    pr = "e025_v025_nhem_h"+timestep+"."+ANLTIM+"00.gb1"
>     a = addfile(dir+pr+".grb1", "r")
>
>   lat = a->g0_lat_0({30:50})
>   lon = a->g0_lon_1({110:140})
>
>   slp = a->MSL_GDS0_SFC({30:50},{110:140})*0.01
>
>   slp!0   = "lat"
>   slp!1   = "lon"
>   slp&lon =  lon
>   slp&lat =  lat
>
>   wks = gsn_open_wks("x11","output")
>   gsn_define_colormap(wks, "WhiteYellowOrangeRed")
>
> ;;========================================================
> ;; PLOT
> ;;========================================================
>   res = True
>   res at gsnDraw             = False
>   res at gsnFrame            = False
>
>   res at mpLimitMode                    = "Corners"
>   res at mpLeftCornerLatF               = 32.0
>   res at mpRightCornerLatF              = 43.0
>   res at mpLeftCornerLonF               = 119.5
>   res at mpRightCornerLonF              = 134.0
>
>   res at mpProjection ="LambertConformal"
>   res at mpLambertParallel1F            = 30.0
>   res at mpLambertParallel2F            = 60.0
>   res at mpLambertMeridianF             = 126.0
>
>   res at tfDoNDCOverlay      = False
>   res at gsnAddCyclic        = False
>
>   res at cnInfoLabelOn = False
>   res at cnLineLabelInterval = 2
> ; res at cnMonoLineThickness = False
>   res at cnFillOn = False
>
>   wrf_smooth_2d(slp,9)
>   plot(i1) = gsn_csm_contour_map(wks,slp,res)
>
> end do
>
> ;;;;;;;;;;;;;;;;;;;;;
> ;;;; Panel Plot ;;;;;
> ;;;;;;;;;;;;;;;;;;;;;
>   resP = True
>   gsn_panel(wks,plot,(/3,3/),resP)
> 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/20170308/fc3bc425/attachment.html 


More information about the ncl-talk mailing list