[ncl-talk] How to reduce the size of PDF outputs
Sri Nandini
snandini at marum.de
Thu Aug 2 05:49:57 MDT 2018
Hello
I am plotting panel figures in NCL which result in a very large pdf output size (2.3 MB).
Attached below is the script i use , only the plotting resources are shown.
I would be grateful if someone could advice on drastically reducing the size of these pdf outputs because, upon importing them into word, they crash the word document.
;==================================================================
;Here is a section of my code that draws a color fill plot
;====================================================================
wks = gsn_open_wks("pdf","all_evap")
gsn_define_colormap(wks,"wgne15")
;also can use precip4_diff_19lev.rgb , precip_diff_12lev.rgb precip3_16lev.rgb precip4_11lev.rgb precip2_17lev.rgb wgne15
res = True
res at cnFillOn = True ; turn on color fill
;res at gsnSpreadColors = True ; use full colormap
res at cnLinesOn = False ; turn off contour lines
res at cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
res at cnMinLevelValF = 0 ; set min contour level
res at cnMaxLevelValF = 4 ; set max contour level
res at cnLevelSpacingF = 0.5 ; set contour spacing
res at gsnDraw = False ; Do not draw plot
res at gsnFrame = False ; Do not advance frome
res at lbLabelBarOn = False ; turn off individual label bars
res at tiMainString = " "
res at gsnCenterString = " "
res at gsnLeftString = " "
res at gsnRightString = " "
res at cnRasterModeOn = True ; Raster mode shows grid cells
minlat = 25. ; min lat to mask
maxlat = 80. ; max lat to mask
minlon = -10. ; min lon to mask
maxlon = 110. ; max lon to mask
res at mpProjection = "LambertConformal" ; choose projection
;---masked plot
res at gsnAddCyclic = True ; regional plot
res at mpMinLatF = minlat ; min lat to mask
res at mpMaxLatF = maxlat ; max lat to mask
res at mpMinLonF = minlon ; min lon to mask
res at mpMaxLonF = maxlon ; max lon to mask
res at gsnMaskLambertConformal = True ; turn on lc masking
;==================================Create arrays to hold series of plots
plot = new(9,graphic)
res at gsnCenterString = "a) PI"
res at gsnStringFontHeightF = 0.017
plot(0) = gsn_csm_contour_map(wks,aveX,res)
res at gsnCenterString = "b) 9 kyr"
plot(1) = gsn_csm_contour_map(wks,aveY,res)
res at gsnCenterString = "c) LIG"
plot(2) = gsn_csm_contour_map(wks,aveY8,res)
res at gsnCenterString = "d) 15.2 kyr"
plot(3) = gsn_csm_contour_map(wks,aveY2,res)
res at gsnCenterString = "e) LGM"
plot(4) = gsn_csm_contour_map(wks,aveY4,res)
res at gsnCenterString = "f) 35 kyr"
plot(5) = gsn_csm_contour_map(wks,aveY6,res)
res at gsnCenterString = "g) HE1"
plot(6) = gsn_csm_contour_map(wks,aveY3,res)
res at gsnCenterString = "h) LGM HE"
plot(7) = gsn_csm_contour_map(wks,aveY5,res)
res at gsnCenterString = "i) HE4"
plot(8) = gsn_csm_contour_map(wks,aveY7,res)
printVarSummary(plot)
;add_lc_labels(wks,plot,minlat,maxlat,minlon,maxlon) ; attach latitude labels
;=====================================Attach the polylines
ADD_SHAPEFILE_OUTLINES = True
sname = "Caspian_Basin.shp"
pres = True
pres at gsLineColor = "black"
pres at gsLineThicknessF = 2.0 ; 3x thickness
shp1 = gsn_add_shapefile_polylines(wks,plot,sname,pres)
printVarSummary(shp1)
;==================================
; panel resources for the 4 plots
;==================================
pres1 = True ; modify the panel plot
pres1 at gsnPanelLabelBar = True ; common label bar
pres1 at lbBoxEndCapStyle = "TriangleBothEnds"; Added in NCL V6.4.0
;pres1 at gsnMaximize = True ; large format in landscape
pres1 at lbTitleString = "Evaporation [ mm/day ]" ; title string
pres1 at lbTitlePosition = "bottom" ; title position
pres1 at lbTitleFontHeightF = .012 ; make title smaller
pres1 at pmLabelBarOrthogonalPosF =-0.01 ;-- move the labelbar upward
pres1 at lbTitleDirection = "Across" ; title direction
pres1 at lbLabelFontHeightF = 0.01
;pres1 at gsnPanelBottom = 0.01
gsn_panel(wks,plot,(/3,3/),pres1)
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180802/8084ed3e/attachment.html>
More information about the ncl-talk
mailing list