[ncl-talk] getting less plots than what is required
george luke otieno
gotieno2000 at gmail.com
Mon Aug 10 00:27:45 MDT 2015
Dear All
I am trying to make 6plots BUT only two are being made. If i set
plot(0) = gsn_csm_contour_map_ce(wks,precSeaClm(ns,:,:), res) ; create plot
plot(1) = gsn_csm_contour_map_ce(wks,prec1SeaClm(ns,:,:), res) ;
create plot
I get only 3plots
BUT IF I SET
plot(ns) = gsn_csm_contour_map_ce(wks,precSeaClm(ns,:,:), res) ; create
plot
plot(ns) = gsn_csm_contour_map_ce(wks,prec1SeaClm(ns,:,:), res) ;
create plot
I only get 2plots..
kindly help
Below is my script
;***********************************************
; climo_3.ncl
;
; Concepts illustrated:
; - Calculating monthly climatologies
; - Calculating seasonal totals for 36yrs
; - Creating a color map using named colors
; - Paneling four plots on a page
; - Adding a common labelbar to paneled plots
; - Explicitly setting contour levels
; - Changing the center longitude for a cylindrical equidistant projection
; - Turning off the individual contour labelbar
; - Adding a common title to paneled plots
; - Turning off map fill
; - Creating a center subtitle
;
;***********************************************
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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
begin
;*******************************************************
; Read the file for GPCC
;*******************************************************
ymStrt = 198101
ymLast = 199012
a = addfile("GPCC.nc","r")
TIME = a->time
YYYYMM = cd_calendar(TIME, -1)
iStrt = ind(YYYYMM.eq.ymStrt)
iLast = ind(YYYYMM.eq.ymLast)
prec = a->precip(iStrt:iLast,:,:) ; (time,lat,lon)
delete(prec at units)
delete(prec at long_name)
printMinMax(prec,True)
printVarSummary(prec)
time = a->time ; (time) ==> YYMM
ntim = dimsizes(time)
precClm = clmMonTLL(prec)
printVarSummary(precClm)
;*******************************************************
; Read the file for GPCP
;*******************************************************
ymStrt = 198101
ymLast = 199012
b = addfile("GPCP.nc","r")
;TIME = b->time
time1 =b->time
delete(TIME)
yyyymm = cd_calendar(time1, -1)
iStrt = ind(yyyymm.eq.ymStrt)
iLast = ind(yyyymm.eq.ymLast)
prec1 = b->precip(iStrt:iLast,:,:) ; (time,lat,lon)
delete(prec1 at units)
delete(prec1 at long_name)
printMinMax(prec1,True)
printVarSummary(prec1)
time1 = b->time ; (time) ==> YYMM
ntim1 = dimsizes(time1)
prec1Clm = clmMonTLL(prec1)
printVarSummary(prec1Clm)
;************************************************
; Compute the monthly climatology using a function in contributed.ncl
;************************************************
precMonClm = clmMonTLL(prec) ; (12,:,:)
precSeaClm = runave_n_Wrap(precMonClm, 3, -1, 0) ; unweighted seasonal
average
printVarSummary(precSeaClm)
prec1MonClm = clmMonTLL(prec1) ; (12,:,:)
prec1SeaClm = runave_n_Wrap(prec1MonClm, 3, -1, 0) ; unweighted seasonal
average
printVarSummary(prec1SeaClm)
season_index = (/3,6,10/) ; MAM, JJA, OND
season_label = (/ "MAM", "JJA","OND"/)
;************************************************
; create colors
;*************************************************
wks = gsn_open_wks("x11", "clim_gpcp") ; open a work station
colors = (/ (/255,255,255/),(/255,255,255/), (/244,255,244/), \
(/217,255,217/), (/163,255,163/), (/106,255,106/), \
(/43,255,106/), (/0,224,0/), (/0,134,0/),(/255,255,0/),\
(/255,127,0/) /) * 1.0 ; we multiply by 1 to make colors float
colors = colors/255. ; normalize (required by NCL)
;************************************************
; create panel plots
;*************************************************
plot = new ( 6, graphic) ; create graphical array
res = True ; plot options desired
;res at cnFillDrawOrder = "Predraw"
res at cnFillOn = True ; turn on color fill
res at cnInfoLabelOn = False ; turn off contour info
label
res at cnLinesOn = False ; turn off contour lines
res at cnLineLabelsOn = False ; turn off line labels
res at cnFillPalette =colors
res at cnLevelSelectionMode = "ExplicitLevels" ; set explicit contour
levels
res at cnLevels
=(/0.1,0.2,0.4,0.8,1.6,3.2,6.4,12.8,25,30,40,45,60,75,83,100/)
res at mpFillOn = False ; turn off gray continents
res at mpCenterLonF = 180 ; Centers the plot at 180
res at lbLabelBarOn = False ; No single label bar
res at gsnDraw = False
res at gsnFrame = False
resP = True ; panel options
resP at txString = "Seasons" ; common title
resP at gsnMaximize = True ; maximize image
resP at gsnPanelLabelBar = True ; Add common label bar
;****************ZOOM INTO YOUR LOCATION*********************
res at mpLimitMode = "LatLon"
;res at mpOutlineOn =True
;res at mpOutlineSpecifiers =True
res at mpMinLonF = 21. ; select a subregion
res at mpMaxLonF = 54.
res at mpMinLatF = -12.
res at mpMaxLatF = 22.5
;res at mpLandFillColor = "background" ; color of land
;*********************Masking*********************************
res at mpFillDrawOrder = "Postdraw"
resMap= True
resMap at mpPerimOn = False
resMap at mpGridAndLimbOn = False
resMap at gsnTickMarksOn = False
resMap at mpDataSetName = "Earth..3"
resMap at mpOutlineOn = True
res at mpFillOn = False ; turn off gray fill
res at mpOutlineBoundarySets = "National" ; turn on country
boundaries
resMap at mpFillOn = True
resMap at mpOceanFillColor = "transparent"
resMap at mpLandFillColor = "transparent"
resMap at mpInlandWaterFillColor = "transparent"
res at mpDataBaseVersion = "MediumRes" ; choose higher resolution
do ns=0,dimsizes(season_index)-1
res at gsnCenterString = season_label(ns)+":"+(ymStrt/100)
+"-"+(ymLast/100)
;res at gsnCenterString = ""
plot(0) = gsn_csm_contour_map_ce(wks,precSeaClm(ns,:,:), res) ; create
plot
plot(1) = gsn_csm_contour_map_ce(wks,prec1SeaClm(ns,:,:), res) ;
create plot
end do
gsn_panel(wks,plot,(/3,3/),resP)
end
Best Regards
George Otieno
Intergrated Climate System Modelling Lab.
Department of Environmental Atmospheric Sciences
608-737, Room 4302, Chungmu-Building
Pukyong National University,
45,Yongso-ro,Nam-gu, Busan, South Korea
Tel. +82-51-629-6643
Fax+82-51-629-7991
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150810/01fd4ce9/attachment.html
More information about the ncl-talk
mailing list