[ncl-talk] [Help] multi panel plots

"조익현" ehcho at kma.go.kr
Tue Mar 7 21:42:25 MST 2017


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


More information about the ncl-talk mailing list