Re: Trying to get Single EPS Panel Plot

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri, 12 Jun 2009 08:01:18 -0600 (MDT)

Helen,

When you create the individual plots, set:

    res_at_gsnDraw = False
    res_at_gsnFrame = False

This will prevent the individual plots from being drawn, and the
frame from being advanced.

--Mary

On Fri, 12 Jun 2009, Helen Parish wrote:

> I am trying to produce a single panel plot in EPS format. I have
> previously been producing the same panel plot in pdf format.
>
> I have put up with the fact that I get a separate plot of every one
> of the plots that I put in the panel before I get the panel plot, In
> other words, if I have a panel made up of 12 plots, I will get 12
> separate plots and then the panel plot at the end, with 13 plots in
> total.
>
> This is okay in pdf, as multiple page plots are allowed. However,
> this does not work in EPS, and I end up with a load of error
> messages, and only get the first single plot.
>
> All I want is the panel plot, and I now need to do this in EPS
> format. I am not sure what to do in my script to prevent all the
> other plots being produced and to only produce the panel plot. Does
> anyone know how to do this ?. My script is included below.
>
> Thanks,
> Helen.
>
> ;***********************
> ; pantest3.ncl
> ;***********************
> 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
>
> ; Keep all files open when have a lot of files :
> setfileoption("nc","SuppressClose",False)
>
> diri = "./"
> fili = systemfunc("cd "+diri+" ; ls zeusrand09125*.cam2.h0*nc")
> print(fili)
> nfili = dimsizes(fili)
>
> lev_p = (/ 91500., 90000., 87500., 80000., 67500., 50000., 30000.,
> 20000., 10000., 5000., 3000., 1500., 750., 390., 200., 100., 50.,25.,
> 14., 7., 3.5, 1.9, 0.95, 0.4, 0.1, 0.03 /)
>
> ; ***********************************************
> ; Read in multiple files, interpolate, and write to temporary output
> files
> ; **********************************************
> do nf = 0, nfili-1
>
> fi = addfile (diri+fili(nf), "r")
>
> diro = "./"
> filo = "uthelen"+nf+".nc"
> print(filo)
> system ("/bin/rm -f "+diro+filo) ; remove any pre-exist file
> fo = addfile (diro+filo, "c")
>
> hyam = fi->hyam ; read hybrid info
> hybm = fi->hybm
> hyai = fi->hyai ; read hybrid info
> hybi = fi->hybi
> PS = fi->PS
> P0mb = 0.01*fi->P0
> U = fi->U
> lat = fi->lat
>
> lev_p!0 = "lev_p" ; variable and dimension name
> the same
> lev_p&lev_p = lev_p ; create coordinate variable
> lev_p_at_long_name = "pressure" ; attach some attributes
> lev_p_at_units = "hPa"
> lev_p_at_positive = "down"
>
> ; Up = vinth2p (U, hyam, hybm, lev_p ,PS, 1, P0mb, 2,
> False) ; False = dont extrapolate pressures
> Up = vinth2p (U, hyam, hybm, lev_p ,PS, 1, P0mb, 2,
> True) ; True = extrapolate pressures
> copy_VarAtts(U, Up)
> fo->U = Up ; write to netCDF file
>
> end do
> ; **************************
> ; calculate zonal average of zonal wind versus time for multiple
> interpolated files
> ; *************************
>
> ;wks = gsn_open_wks ("pdf", "Figure1.proposal" ) ; open
> workstation
> wks = gsn_open_wks ("eps", "Figure1.proposal" ) ; open
> workstation
>
> plot = new(12,graphic)
>
> gsn_define_colormap(wks,"rainbow") ; choose colormap
>
> do nf2 = 0, nfili-1
>
> diri = "./"
> ; fili2 = systemfunc("cd "+diri+" ; ls uthelen*nc")
> fili2 = addfile (diri+"uthelen"+nf2+".nc","r")
>
> print(fili2)
>
> ; U2= addfiles_GetVar(f2,fili2,"U")
>
> U2 = fili2->U
> printVarSummary( U2 ) ; (time, lev_p, lat,lon)
>
> dimt2 = dimsizes( U2 )
> ntim2 = dimt2(0)
> klvl2 = dimt2(1)
> nlat2 = dimt2(2)
> mlon2 = dimt2(3)
>
> ; take zonal average
>
> uavg = dim_avg_Wrap(U2) ;
> (time,lev_p,lat)
> printVarSummary( uavg )
>
> ;***********************
> ; Create Plot
> ;***********************
>
> nyear = 164+nf2
> nt2 = 0
>
> res = True
>
> res_at_gsnLeftString = ""
> res_at_gsnCenterString = "Year "+ nyear
> res_at_gsnRightString = ""
>
> res_at_cnFillOn = True
> res_at_lbLabelAutoStride = True
> res_at_gsnMaximize = True ; if [ps, eps, pdf] make large
> res_at_gsnSpreadColors = True ; span color map
> res_at_cnLineLabelsOn = False ; Turn off contour line labels
> res_at_cnInfoLabelOn = False ; Turn off informational label
> if (nf2 .le. 8) then
> res_at_tmXBLabelsOn = False ; do not draw bottom
> labels
> res_at_tmXBOn = False ; no bottom tickmarks
> res_at_lbLabelBarOn = False ; turn off individual colour bars
> res_at_tiYAxisString = "Pressure (mbar)"
> end if
>
> res_at_trYReverse = True
>
> res_at_cnLevelSelectionMode = "ManualLevels" ; manually set the
> contour levels with the following 3 resources
> res_at_cnMinLevelValF = -30. ; set the minimum
> contour level
> res_at_cnMaxLevelValF = 65. ; set the maximum
> contour level
> res_at_cnLevelSpacingF = 5. ; set the interval
> between contours
>
> if (nf2 .ge. 9) then
> res_at_tmXBOn = True ; draw bottom tickmarks
> res_at_tmXBLabelsOn = True ; draw bottom labels
> res_at_tiXAxisString = "Latitude (degrees)"
> res_at_tiYAxisString = "Pressure (mbar)"
> end if
> plot(nf2) = gsn_csm_pres_hgt(wks, uavg(lev_p | 0:20, lat | :,
> time | nt2), res ) ; (lev,lat)
>
> end do
>
> resP = True ; modify the panel
> plot
> resP_at_gsnPanelTop = 0.95 ; add some space at
> top
> resP_at_gsnPanelBottom = 0.05 ; add some space at
> bottom
> resP_at_txString = "Zonally Averaged Zonal wind"
> resP_at_gsnPanelLabelBar = True ; add common colorbar
> resP_at_lbLabelFontHeightF = 0.007 ; make labels smaller
>
> gsn_panel(wks,plot,(/4,3/),resP)
>
> end
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jun 12 2009 - 08:01:18 MDT

This archive was generated by hypermail 2.2.0 : Mon Jun 15 2009 - 08:53:05 MDT