cjs_shade_defaults.ncl 2.55 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; cjs_shade_defaults.ncl
; Carl Schreck (cjschrec@ncsu.edu)
; April 2014
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2010, North Carolina State University
; All rights reserved.
; This work licensed under BSD 3-Clause License. Full terms in LICENSE.txt
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


undef ( "cjs_shade_defaults" )
function cjs_shade_defaults( \
  i_data            : numeric , \ 
  i_res         [1] : logical \
)
begin ; cjs_shade_defaults
  ; These are some parameters that could be useful to have up top

  ; Customize base plot
Carl Schreck's avatar
Carl Schreck committed
21
22
23
24
25
26
  res = cjs_fontHeightF( i_res )
  res@gsnDraw  := False
  res@gsnFrame := False
; res@gsnLeftString  := ""
  res@gsnRightString := ""
  res@gsnCenterString := ""
27
28

  ; ...standardize the font sizes
Carl Schreck's avatar
Carl Schreck committed
29
30
  res@lbTitleFontHeightF        := res@fontHeightF
  res@lbLabelFontHeightF        := res@fontHeightF
31
32

  ; ...shading resources
Carl Schreck's avatar
Carl Schreck committed
33
34
35
  res@cnFillOn        := True
  res@cnFillMode      := "AreaFill"
  res@cnFillPalette   := "colorbrewer_coldhot"
36
; res@cnFillPalette   := reverse_colormap("MPL_RdBu")
Carl Schreck's avatar
Carl Schreck committed
37
38
39
40
41
42
43
44
  res@cnRasterSmoothingOn := False
  res@cnMonoFillColor := False
  res@cnInfoLabelOn   := False
  res@cnLineLabelsOn  := False
  res@cnLinesOn       := False
  res@cnLineColor     := "gray"
  res@cnMissingValFillPattern := "SolidFill"
  res@cnMissingValFillColor   := "gray"
45
  res@cnFillDrawOrder := "PreDraw"
46
47
48

  ; ...set the contour levels
  if( isatt( i_res, "cnLevels" ) ) then
Carl Schreck's avatar
Carl Schreck committed
49
    res@cnLevelSelectionMode := "ExplicitLevels"
50
  else
51
    res@cnMaxLevelCount := 10
52
53
54
  end if

  ; ...labelbar resources
Carl Schreck's avatar
Carl Schreck committed
55
  res@lbLabelBarOn      := True
56
57
  if( isatt( i_res, "lbOrientation" ) \
      .and.( i_res@lbOrientation.eq."Vertical" ) ) then
Carl Schreck's avatar
Carl Schreck committed
58
59
60
    res@lbOrientation     := "Vertical"
    res@lbTitlePosition   := "Top"
    res@lbTitleDirection  := "Across"
61
  else
Carl Schreck's avatar
Carl Schreck committed
62
    res@lbOrientation     := "Horizontal"
63
64
;   res@lbLabelAngleF     := 90
    res@lbTitlePosition   := "Bottom"
Carl Schreck's avatar
Carl Schreck committed
65
66
67
    res@lbTitleDirection  := "Across"
;   res@pmLabelBarOrthogonalPosF := 0.60
    res@pmLabelBarHeightF        := 0.04
68
69
  end if
  if( isatt( i_data, "units" ) ) then
Carl Schreck's avatar
Carl Schreck committed
70
    res@lbTitleString     := i_data@units
71
72
  end if

Carl Schreck's avatar
Carl Schreck committed
73
  res@vpWidthF := 0.5
74
75

  ; ...make gridlines look nice
Carl Schreck's avatar
Carl Schreck committed
76
77
78
79
  res@tmXMajorGridLineDashPattern := 2.
  res@tmYMajorGridLineDashPattern := 2.
  res@tmXMajorGridThicknessF      := 1.
  res@tmYMajorGridThicknessF      := 1.
80
81
82
83
84
85
86
87

  if( i_res ) then
    copy_VarAtts( i_res, res )
  end if

  return(res)
end; cjs_shade_defaults