Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *************************************************
- ; panel_3.ncl
- ;
- ; Concepts illustrated:
- ; - Paneling three plots vertically on a page
- ; - Adding a common title to paneled plots
- ; - Adding a common labelbar to paneled plots
- ; - Subsetting a color map
- ;************************************************
- ;
- ; These files are loaded by default in NCL V6.2.0 and newer
- load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
- load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
- ;************************************************
- begin
- ;************************************************
- ; read in netCDF file
- ;************************************************
- a = addfile("pr_day_CESM2-WACCM_historical_r1i1p1f1_gn_20000101- 20091231.nc","r")
- ;pr = a->pr(1,:,:)
- pr = a->pr(:,:,:)
- printVarSummary(pr)
- ;Avearge over time
- function dim_avg_Wrap(pr)
- function dim_stddev_Wrap(pr)
- ; Calculate Standard deviation
- pr = pr*86400.
- ;************************************************
- ; create plots
- ;************************************************
- wks = gsn_open_wks("X11","panel") ; send graphics to PNG file
- ;gsn_define_colormap(wks,"BlAqGrYeOrRe")
- gsn_define_colormap(wks,"WhiteBlueGreenYellowRed")
- plot = new(1,graphic) ; create a plot array
- res = True
- res@gsnDraw = False ; don't draw
- res@gsnFrame = False ; don't advance frame
- res@cnInfoLabelOn = False ; turn off cn info label
- res@cnFillOn = True ; turn on color
- res@cnLinesOn = False
- res@gsnSpreadColors = True
- ;res@gsnSpreadColorStart = 1
- ;res@gsnSpreadColorEnd = -1
- res@lbLabelBarOn = False ; turn off individual cb's
- ; to have a common label bar, both plots should be set to the same interval
- ; b/c the label bar is drawn by default from the interval of the first plot.
- ;res@cnLevelSelectionMode = "ManualLevels"
- res@cnLevelSelectionMode = "ExplicitLevels"
- ; res@cnLevelSelectionMode = "AutomaticLevels"
- ; res@cnMinLevelValF = 0.
- ; res@cnMaxLevelValF = 100.
- ; res@cnLevelSpacingF = 5.
- res@cnLevels = (/0,0.5,1,2,4,7,11,16,22,29/)
- plot(0) = gsn_csm_contour_map(wks,pr(10,:,:),res)
- ;plot(1) = gsn_csm_contour_map(wks,v,res)
- ;************************************************
- ; create panel
- ;************************************************
- resP = True ; modify the panel plot
- resP@gsnPanelMainString = "A plot with a common label bar"
- resP@gsnPanelLabelBar = True ; add common colorbar
- resP@lbLabelFontHeightF = 0.007 ; make labels smaller
- gsn_panel(wks,plot,(/1,1/),resP) ; now draw as one plot
- end
- fatal:syntax error: line 24 in file script1.ncl before or near
- dim_avg_Wrap
- function dim_avg_Wrap
- --------------------^
- fatal:Function identifier is defined
- fatal:syntax error: line 25 in file script1.ncl before or near
- dim_stddev_Wrap
- function dim_stddev_Wrap
- -----------------------^
- fatal:Function identifier is defined
- fatal:Syntax Error in block, block not executed
- fatal:error at line 69 in file script1.ncl
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement