<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<div>Dear NCL Users</div>
<div><br>
</div>
<div>I am not able to plot a panel plot of 36 CMIP5 models (lat vs time plots).</div>
<div>They plot individually however I think I am missing something when it comes to plotting it as a panel plot.</div>
<div><br>
</div>
<div>Any suggestions as to what could be wrong with the code would be very much appreciated.</div>
<div><br>
</div>
<div>Kindest Regards</div>
<div>Melissa</div>
<div><br>
</div>
<div>CODE BELOW</div>
<div><br>
</div>
<div><br>
</div>
<div>;*********************************************</div>
<div>; lat_time_bw.ncl</div>
<div>;*********************************************</div>
<div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div>
<div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div>
<div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</div>
<div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"</div>
<div><br>
</div>
<div><br>
</div>
<div>begin</div>
<div><br>
</div>
<div>model = (/"ACCESS1-0","ACCESS1-3","bcc-csm1-1","bcc-csm1-1-m","BNU-ESM","CanESM2","CCSM4","CESM1-BGC","CESM1-CAM5","CMCC-CMS","CNRM-CM5","CSIRO-Mk3-6-0","EC-EARTH","FGOALS-g2","FGOALS-s2","FIO-ESM","GFDL-CM3","GFDL-ESM2G","GFDL-ESM2M","GISS-E2-R_p1","GISS-E2-H-CC","GISS-E2-R-CC","HadGEM2-AO","HadGEM2-CC","HadGEM2-ES","inmcm4","IPSL-CM5A-LR","IPSL-CM5A-MR","MIROC5","MIROC-ESM","MIROC-ESM-CHEM","MPI-ESM-LR","MPI-ESM-MR","MRI-CGCM3","NorESM1-M","NorESM1-ME"/)</div>
<div><br>
</div>
<div><span style="font-size: 10pt;">do gg = 0,dimsizes(model)-1</span></div>
<div><br>
</div>
<div> fili  = "/mnt/geog/ml382/ml382_sals000408_home_dir/melsicz/dPhov/pr_Amon_"+model(gg)+"_dP_hov.nc"                   </div>
<div> fili2  = "/mnt/geog/ml382/ml382_sals000408_home_dir/melsicz/dPhov/pr_Amon_"+model(gg)+"_climhov_1971-2000.nc" </div>
<div><br>
</div>
<div> f     = addfile (fili , "r")                         ; add file</div>
<div> lat   = f->lat                                       ; get lat</div>
<div> lon   = f->lon                                       ; get lon </div>
<div> time  = f->time                                      ; get time                          </div>
<div> ;precip    = f->pr                                ; get precip</div>
<div> ;precip2   = precip(:,0,:,:)</div>
<div><br>
</div>
<div> f1     = addfile (fili2 , "r")                         ; add file</div>
<div> lat1   = f->lat                                       ; get lat</div>
<div> lon1   = f->lon                                       ; get lon </div>
<div> time1  = f->time                                      ; get time          </div>
<div><br>
</div>
<div>if ((gg.eq.13) .or. (gg.eq.17) .or. (gg.eq.18)) then</div>
<div>  precip = f1->pr(:,:,:)</div>
<div> else</div>
<div>  precip = f1->pr(:,0,:,:)</div>
<div>    end if</div>
<div><br>
</div>
<div><br>
</div>
<div>if ((gg.eq.3) .or. (gg.eq.13) .or. (gg.eq.17) .or. (gg.eq.18) .or. (gg.eq.20) .or. (gg.eq.21)) then</div>
<div>  precip2 = f->pr(:,:,:)</div>
<div> else</div>
<div>  precip2 = f->pr(:,0,:,:)</div>
<div>    end if</div>
<div><br>
</div>
<div><br>
</div>
<div> printVarSummary(precip2)</div>
<div><br>
</div>
<div> latS      = -30.</div>
<div> latN      =  30.</div>
<div><span style="font-size: 10pt;"> shov      = precip2(:,{-30:30},{30:40})</span></div>
<div>shov1      = precip(:,{-30:30},{30:40})</div>
<div> dims      = dimsizes(shov)                   ; shov=3D array=(12,40,37)</div>
<div><span style="font-size: 10pt;"> sdemo     = dim_avg_Wrap(shov)   ;sdemo(time,lat)</span></div>
<div>sdemo4     = dim_avg_Wrap(shov1)   ;sdemo(time,lat)</div>
<div> </div>
<div><br>
</div>
<div>  </div>
<div> sdemo1 = sdemo(lat|:,time|:)                              </div>
<div> sdemo1 = smth9 (sdemo1,0.5, 0.25, False)               ; 2D smoother</div>
<div> sdemo2 = sdemo4(lat|:,time|:)                              </div>
<div> sdemo2 = smth9 (sdemo2,0.5, 0.25, False)  </div>
<div> sdemo1@units     = "mm/day"</div>
<div> sdemo1@long_name = "dP Hov "+model(gg)+" (lon 30E-40E)"</div>
<div> gtPat = 17                                           ; stiple</div>
<div> ltPat = 3  </div>
<div>sdemo2@units     = ""</div>
<div> sdemo2@long_name = ""</div>
<div>                                           ; hatch</div>
<div>;*************************</div>
<div>; plotting parameters</div>
<div>;*************************</div>
<div> wks   = gsn_open_wks ("X11", "dPhov_ALL_models_lon30-40" ) ; open workstation </div>
<div><span style="font-size: 10pt;"> gsn_define_colormap(wks,"BlueDarkRed18")  ; choose color map</span></div>
<div> gsn_reverse_colormap(wks)</div>
<div><br>
</div>
<div>  plot = new (36,"graphic")</div>
<div>  plot1= new (36,"graphic")</div>
<div><br>
</div>
<div><br>
</div>
<div> res                  = True               ; plot mods desired</div>
<div> res@cnFillOn         = True               ; color on</div>
<div> res@gsnDraw          = True              ; don't draw yet</div>
<div> res@gsnAddCyclic      = False</div>
<div> res@lbLabelStride    = 2                   ; every other label</div>
<div> res@lbOrientation    = "Horizontal"          ; vertical label bar</div>
<div> res@pmLabelBarOrthogonalPosF = -0.04       ; move label bar closer to axis</div>
<div> res@cnLinesOn        = False               ; turn off contour lines</div>
<div> res@gsnSpreadColors  = True                ; use full range of color map</div>
<div> res@gsnFrame         = True             ; don't advance frame yet</div>
<div><br>
</div>
<div><span style="font-size: 10pt;"> res@vpXF             = 0.12               ; default is 0.2 change aspect</span></div>
<div> res@vpYF             = 0.8                ; default is 0.8 ration</div>
<div> res@vpHeightF        = 0.4                ; default is 0.6</div>
<div> res@vpWidthF         = 0.8                ; default is 0.6</div>
<div><br>
</div>
<div> res@cnLevelSelectionMode = "ManualLevels"  ; manual levels</div>
<div> res@cnMinLevelValF       =  -1.5              ; min level</div>
<div> res@cnMaxLevelValF       =  1.5            ; max level</div>
<div> res@cnLevelSpacingF      =  0.25           ; contour spacing</div>
<div><br>
</div>
<div><br>
</div>
<div> res@tmXBMode      = "Explicit"     ; Define own tick mark labels.</div>
<div> res@tmXBValues    = (/  0.,  1.,  2.,  3., 4., 5., 6., 7., 8., 9., 10., 11. /)</div>
<div> res@tmXBLabels    = (/"D","J","F","M" ,"A","M", "J", "J", "A", "S", "O", "N" /)</div>
<div><br>
</div>
<div><br>
</div>
<div> wpres                  = True               ; plot mods desired</div>
<div> wpres@cnFillOn         = False               ; color on</div>
<div> wpres@gsnDraw          = True              ; don't draw yet</div>
<div> wpres@gsnFrame         = True     </div>
<div> wpres@gsnAddCyclic      = False</div>
<div> wpres@lbLabelStride    = 2                   ; every other label</div>
<div> wpres@cnLinesOn        = True </div>
<div> wpres@cnLineLabelsOn   = True </div>
<div> wpres@cnLineThicknessF = 1.5</div>
<div> wpres@cnInfoLabelOn     = False</div>
<div><br>
</div>
<div><br>
</div>
<div>wpres@cnLevelSelectionMode = "ManualLevels"  ; manual levels</div>
<div> wpres@cnMinLevelValF       =  0              ; min level</div>
<div> wpres@cnMaxLevelValF       =  10            ; max level</div>
<div> wpres@cnLevelSpacingF      =  1           ; contour spacing</div>
<div><br>
</div>
<div>        </div>
<div> plot(gg) = gsn_csm_lat_time(wks, sdemo1({-30:30},:),res ) </div>
<div> plot1(gg) = gsn_csm_lat_time(wks, sdemo2({-30:30},:),wpres )</div>
<div><br>
</div>
<div> overlay(plot(gg),plot1(gg)) </div>
<div><br>
</div>
<div><br>
</div>
<div>delete(sdemo1)</div>
<div>delete(sdemo2)</div>
<div><br>
</div>
<div><br>
</div>
<div>end do</div>
<div>panres                = True              ; mod panel plot</div>
<div>panres@gsnPanelLabelBar    = True                ; add common colorbar</div>
<div>panres@lbLabelFontHeightF =.012                 ; make labels larger</div>
<div>panres@gsnMaximize = True ; Maximize plot in frame. </div>
<div><br>
</div>
<div>gsn_panel(wks,plot(:15),(/4,4/),panres)    ; panel 16 models at a time.</div>
<div>gsn_panel(wks,plot(16:),(/4,4/),panres)</div>
<div>gsn_panel(wks,plot(32:),(/4,4/),panres)</div>
<div><br>
</div>
<div>end</div>
<div><br>
</div>
</div>
</body>
</html>