/usr/share/ncarg/nclex/basic/basic05n.ncl is in libncarg-data 6.1.2-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | ; $Id: basic05n.ncl,v 1.15 2010-03-15 22:49:23 haley Exp $
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; Copyright (C) 1995 ;
; University Corporation for Atmospheric Research ;
; All Rights Reserved ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; File: basic05n.ncl
;
; Author: Tim Scheitlin
; National Center for Atmospheric Research
; PO 3000, Boulder, Colorado
;
;
; Date: Thu Apr 27 13:03:39 MDT 1995
;
; Description: This example demonstrates how to read, display,
; and manipulate colormaps.
; The NG 4.x HLU software supports several different predefined
; colormaps of various sizes. This example demonstrates how to
; display each of those colormaps using the labelbar utility.
; This example also shows how to change entries in a colormap
; and create a completely new colormap.
begin
;
; Set the display. Default is to display output to an X workstation
;
wks_type = "x11"
if (str_lower(wks_type).eq."ncgm") then
;
; Create an ncgmWorkstation object with default colormap.
;
wks = create "wks" ncgmWorkstationClass defaultapp
"wkMetaName" : "basic05n.ncgm"
end create
end if
if (str_lower(wks_type).eq."x11") then
;
; Create an X11 workstation with default colormap.
;
wks = create "wks" windowWorkstationClass defaultapp
"wkPause" : "True"
; "wkXColorMode" : "private" ; Set color mode to private to avoid
; contention for colors from other apps.
end create
end if
if (str_lower(wks_type).eq."oldps") then
;
; Create an older-style PostScript workstation.
;
wks = create "wks" psWorkstationClass defaultapp
"wkPSFileName" : "basic05n.ps"
end create
end if
if (str_lower(wks_type).eq."oldpdf") then
;
; Create an older-style PDF workstation.
;
wks = create "wks" pdfWorkstationClass defaultapp
"wkPDFFileName" : "basic05n.pdf"
end create
end if
if (str_lower(wks_type).eq."pdf".or.str_lower(wks_type).eq."ps") then
;
; Create a cairo PS/PDF Workstation object.
;
wks = create "wks" documentWorkstationClass defaultapp
"wkFileName" : "basic05n"
"wkFormat" : wks_type
end create
end if
if (str_lower(wks_type).eq."png") then
;
; Create a cairo PNG Workstation object.
;
wks = create "wks" imageWorkstationClass defaultapp
"wkFileName" : "basic05n"
"wkFormat" : wks_type
end create
end if
; Initialize numeric labels for the labelbar annotation.
colorindices = ispan(1,255,1)
; Create a labelbar object.
lbar = create "LabelBar" labelBarClass wks
"lbLabelStrings" : colorindices ; Assign the labels
"lbLabelStride" : 5 ; Label every 5th entry
"lbMonoFillPattern" : True ; Single pattern used for fill
"lbFillPattern" : "SolidFill" ; Set fill pattern to solid
"lbBoxLinesOn" : False ; Turn off lines between colors
"lbBoxCount" : 255 ; Display 255 entries
"lbPerimOn" : False ; Turn off labelbar perimeter
"lbTitleString" : "(New) Default Colormap" ; Plot title
"lbTitleFont" : "Helvetica-bold" ; Title font
"lbLabelFont" : "Helvetica" ; Label font
"vpXF" : 0. ; Set the viewport to max size
"vpYF" : 1.
"vpWidthF" : 1.
"vpHeightF" : 1.
end create
delete(colorindices)
; Initialize numeric labels for the labelbar annotation.
colorindices = ispan(1,232,1)
; Create a text label
text = create "textitem" textItemClass lbar
"txFont" : "Helvetica-bold" ; Set font
"txPosXF" : .5 ; Set position and height
"txPosYF" : .03
"txFontHeightF" : .035
"txFuncCode" : "*" ; This is set, so the colon character, which is
; the default function code character, can be
; used in the "txString" resource.
"txString" : "Note: Entry 0 is the background color"
end create
; Draw the labelbar displaying the default colormap and textual annotation
draw(lbar)
draw(text)
frame(wks)
; Change the colormap to the old default color map
setvalues wks
"wkColorMap" : "default"
end setvalues
setvalues lbar
"lbBoxCount" : 31 ; Display 31 entries
"lbTitleString" : "(Old) Default Colormap" ; Plot title
end setvalues
; Draw the labelbar displaying the old default colormap and textual annotation
draw(lbar)
draw(text)
frame(wks)
; Change the colormap to one of the predefined colormaps
setvalues wks
"wkColorMap" : "cyclic"
end setvalues
; Change the labelbar title, annotation, and number of entries.
setvalues lbar
"lbTitleString" : "Cyclic Colormap" ; Labelbar title
"lbLabelStride" : 1 ; Label every entry
"lbBoxCount" : 7 ; Number of entries to display
end setvalues
; Draw the labelbar and textual annotation
draw(lbar)
draw(text)
frame(wks)
; Change the colormap to one of the predefined colormaps
setvalues wks
"wkColorMap" : "gscyclic" ; gray scale cyclic
end setvalues
; Change the labelbar title, annotation, and number of entries.
setvalues lbar
"lbTitleString" : "Gscyclic Colormap" ; Labelbar title
"lbLabelStride" : 1 ; Label every entry
"lbBoxCount" : 7 ; Number of entries to display
end setvalues
; Draw the labelbar and textual annotation
draw(lbar)
draw(text)
frame(wks)
; Change the colormap to one of the predefined colormaps
setvalues wks
"wkColorMap" : "gsltod" ;gray scale light to dark
end setvalues
; Change the labelbar title, annotation, and number of entries.
setvalues lbar
"lbTitleString" : "Gsltod Colormap" ; Labelbar title
"lbLabelStride" : 2 ; Label every other entry
"lbBoxCount" : 32 ; Number of entries to display
end setvalues
; Draw the labelbar and textual annotation
draw(lbar)
draw(text)
frame(wks)
; Change the colormap to one of the predefined colormaps
setvalues wks
"wkColorMap" : "gsdtol" ;
end setvalues
; Change the labelbar title, annotation, and number of entries.
setvalues lbar
"lbTitleString" : "Gsdtol Colormap" ; Labelbar title
"lbLabelStride" : 2 ; Label every other entry
"lbBoxCount" : 32 ; Number of entries to display
end setvalues
; Draw the labelbar and textual annotation
draw(lbar)
draw(text)
frame(wks)
; Change the colormap to one of the predefined colormaps
setvalues wks
"wkColorMap" : "uniform" ;
end setvalues
; Change the labelbar title, annotation, and number of entries.
setvalues lbar
"lbTitleString" : "Uniform Colormap" ; Labelbar title
"lbLabelStride" : 10 ; Label every 10th entry
"lbBoxCount" : 112 ; Number of entries to display
end setvalues
; Draw the labelbar and textual annotation
draw(lbar)
draw(text)
frame(wks)
; Change the colormap to one of the predefined colormaps
setvalues wks
"wkColorMap" : "temp1" ; temperature (cold to warm)
end setvalues
; Change the labelbar title, annotation, and number of entries.
setvalues lbar
"lbTitleString" : "Temp1 Colormap" ; Labelbar title
"lbLabelStride" : 5 ; Label every 5th entry
"lbBoxCount" : 62 ; Number of entries to display
end setvalues
; Draw the labelbar and textual annotation
draw(lbar)
draw(text)
frame(wks)
; Change the colormap to one of the predefined colormaps
setvalues wks
"wkColorMap" : "psgcap" ; PostScript graphcap
end setvalues
; Change the labelbar title, annotation, and number of entries.
setvalues lbar
"lbTitleString" : "Psgcap Colormap" ; Labelbar title
"lbLabelStride" : 15 ; Label every 15th entry
"lbBoxCount" : 230 ; Number of entries to display
end setvalues
; Draw the labelbar and textual annotation
draw(lbar)
draw(text)
frame(wks)
; Change the colormap to one of the predefined colormaps
setvalues wks
"wkColorMap" : "example" ; Example colormap
end setvalues
; Change the labelbar title, annotation, and number of entries.
setvalues lbar
"lbTitleString" : "Example Colormap" ; Labelbar title
"lbLabelStride" : 10 ; Label every 10th entry
"lbBoxCount" : 114 ; Number of entries to display
end setvalues
; Draw the labelbar and textual annotation
draw(lbar)
draw(text)
frame(wks)
; This next example changes three entries in the colormap. Changing the
; first entry (colormap index 0) in the colormap, sets the background
; color for a plot. The second entry (color index 1) sets the foreground
; color for a plot.
; The colormap is stored in a 3xN variable where N is the length of
; the colormap. Each entry in the color map consists of a vector
; of 3 normalized red-green-blue color values.
; Assign a new colormap
setvalues wks
"wkColorMap" : "gscyclic" ; Assign grayscale colormap
end setvalues
; Copy the colormap rgb values into the variable cmap
getvalues wks
"wkColorMap" : cmap
end getvalues
; Change the first entry in the colormap array to blue, the
; second to green, and the fourth to red.
cmap((/0,1,3/),:) = (/ (/0.0,0.0,1.0/), \ ; Background color
(/0.0,1.0,0.0/), \ ; Foreground color
(/1.0,0.0,0.0/) /) ; Colormap entry 3
; Reassign the colormap
setvalues wks
"wkColorMap" : cmap
end setvalues
; Set the annotation for the label bar
setvalues lbar
"lbTitleString" : "Changing colormap entries"
"lbLabelStride" : 1 ; Label every entry
"lbBoxCount" : 7 ; Number of entries to display
end setvalues
setvalues text
"txString" : "Entry 0 (background) set to Blue"
end setvalues
; Draw the labelbar and textual annotation.
draw(lbar)
draw(text)
frame(wks)
; This next example demonstrates how to create and assign a new colormap.
; Create an array that will contain the new colormap. For this example,
; we are creating a colormap with 100 (arbitrary size) rgb entries.
newcmap = new((/100,3/), float)
; Assign new RGB values to each entry of the colormap.
; Set the first entry (background color) to black
ff = fspan(.0,1.0,dimsizes(newcmap(:,0)))
newcmap(:,0) = 1.-ff
newcmap(:,1) = ff
newcmap(:,2) = ff
newcmap(0,:) = 0.0
; Assign the new color map to the workstation object.
setvalues wks
"wkColorMap" : newcmap
end setvalues
; Assign a new title.
setvalues lbar
"lbTitleString" : "New colormap" ; Labelbar title
"lbLabelStride" : 10 ; Label every 10th entry
"lbBoxCount" : 99 ; Number of entries to display
end setvalues
; Draw the labelbar and textual annotation
draw(lbar)
frame(wks)
; Clean up
delete(lbar)
delete(text)
delete(wks)
delete(colorindices)
delete(newcmap)
; End the ncl script.
end
|