Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. *************************************************
  2. ; panel_3.ncl
  3. ;
  4. ; Concepts illustrated:
  5. ; - Paneling three plots vertically on a page
  6. ; - Adding a common title to paneled plots
  7. ; - Adding a common labelbar to paneled plots
  8. ; - Subsetting a color map
  9. ;************************************************
  10. ;
  11. ; These files are loaded by default in NCL V6.2.0 and newer
  12. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
  13. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
  14. ;************************************************
  15. begin
  16. ;************************************************
  17. ; read in netCDF file
  18. ;************************************************
  19. a = addfile("pr_day_CESM2-WACCM_historical_r1i1p1f1_gn_20000101- 20091231.nc","r")
  20. ;pr = a->pr(1,:,:)
  21. pr = a->pr(:,:,:)
  22. printVarSummary(pr)
  23. ;Avearge over time
  24. function dim_avg_Wrap(pr)
  25. function dim_stddev_Wrap(pr)
  26. ; Calculate Standard deviation
  27. pr = pr*86400.
  28. ;************************************************
  29. ; create plots
  30. ;************************************************
  31. wks = gsn_open_wks("X11","panel") ; send graphics to PNG file
  32.  
  33. ;gsn_define_colormap(wks,"BlAqGrYeOrRe")
  34. gsn_define_colormap(wks,"WhiteBlueGreenYellowRed")
  35. plot = new(1,graphic) ; create a plot array
  36.  
  37. res = True
  38. res@gsnDraw = False ; don't draw
  39. res@gsnFrame = False ; don't advance frame
  40. res@cnInfoLabelOn = False ; turn off cn info label
  41. res@cnFillOn = True ; turn on color
  42. res@cnLinesOn = False
  43. res@gsnSpreadColors = True
  44. ;res@gsnSpreadColorStart = 1
  45. ;res@gsnSpreadColorEnd = -1
  46. res@lbLabelBarOn = False ; turn off individual cb's
  47.  
  48. ; to have a common label bar, both plots should be set to the same interval
  49. ; b/c the label bar is drawn by default from the interval of the first plot.
  50. ;res@cnLevelSelectionMode = "ManualLevels"
  51. res@cnLevelSelectionMode = "ExplicitLevels"
  52. ; res@cnLevelSelectionMode = "AutomaticLevels"
  53. ; res@cnMinLevelValF = 0.
  54. ; res@cnMaxLevelValF = 100.
  55. ; res@cnLevelSpacingF = 5.
  56. res@cnLevels = (/0,0.5,1,2,4,7,11,16,22,29/)
  57. plot(0) = gsn_csm_contour_map(wks,pr(10,:,:),res)
  58. ;plot(1) = gsn_csm_contour_map(wks,v,res)
  59. ;************************************************
  60. ; create panel
  61. ;************************************************
  62. resP = True ; modify the panel plot
  63. resP@gsnPanelMainString = "A plot with a common label bar"
  64.  
  65. resP@gsnPanelLabelBar = True ; add common colorbar
  66. resP@lbLabelFontHeightF = 0.007 ; make labels smaller
  67.  
  68. gsn_panel(wks,plot,(/1,1/),resP) ; now draw as one plot
  69. end
  70.  
  71.  
  72. fatal:syntax error: line 24 in file script1.ncl before or near
  73. dim_avg_Wrap
  74. function dim_avg_Wrap
  75. --------------------^
  76.  
  77. fatal:Function identifier is defined
  78. fatal:syntax error: line 25 in file script1.ncl before or near
  79. dim_stddev_Wrap
  80. function dim_stddev_Wrap
  81. -----------------------^
  82.  
  83. fatal:Function identifier is defined
  84. fatal:Syntax Error in block, block not executed
  85. fatal:error at line 69 in file script1.ncl
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement