This file is indexed.

/usr/share/ncarg/nclex/basic/basic08n.ncl is in libncarg-data 6.3.0-6build1.

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
; $Id: basic08n.ncl,v 1.5 2010-03-15 22:49:23 haley Exp $
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                                                                       ;
;                Copyright (C)  1995                                    ;
;        University Corporation for Atmospheric Research                ;
;                All Rights Reserved                                    ;
;                                                                       ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;   File:         basic08n.ncl
;
;   Author:       David Brown
;                 National Center for Atmospheric Research
;                 PO 3000, Boulder, Colorado
;
;
;   Date:         Wed May 24 12:54:47 MDT 1995
;
;   Description:  This NCL script demonstrates how to draw
;		  a plot object including any annotations
;		  outside its viewport within a predefined 
;		  bounded area of NDC space. The procedure 
;		  draw_bounded_plot is intended to be useful in any
;		  context where it is desired to keep an entire plot
;		  within predetermined boundaries.
;

procedure draw_bounded_plot(id:graphic, keep_aspect: logical,
			left:float, right:float, bottom:float, top:float)

;
; This procedure takes the plot object with identifier "id" and 
; draws it within the NDC boundaries represented by left, right,
; top, and bottom. If keep_aspect is True the aspect ratio of the plot
; is preserved: the plot fills the extent of the limiting dimension and
; is centered within the extent of the other dimension. If keep_aspect is
; False, the aspect ratio is distorted in order to fill as much of the
; space as possible, given certain limitations in the ability of some
; HLU objects to distort themselves to any arbitrary aspect ratio.
;

local x_save,y_save,width_save,height_save,
      bb,bb_height,bb_width,frame_height,frame_width,
      factor,x_off,y_off,x,y,width,height
begin

  getvalues id
    "vpXF": x_save
    "vpYF": y_save
    "vpWidthF": width_save
    "vpHeightF": height_save
  end getvalues

  bb = NhlGetBB(id)
  bb_height = bb(0) - bb(1)
  bb_width = bb(3) - bb(2)
  frame_height = top - bottom
  frame_width = right - left
  x = x_save
  y = y_save
  height = height_save
  width = width_save

  if (.not. keep_aspect) then
	factor = frame_width / bb_width
	width = width * factor
	x_off = (x - bb(2)) * factor
	x = left + x_off
	factor = frame_height / bb_height
	height = height * factor
	y_off = (y - bb(0)) * factor
	y = top + y_off
	setvalues id
		"vpXF": x
    		"vpYF": y
		"vpWidthF": width
		"vpHeightF": height
	end setvalues
	getvalues id
		"vpXF": x
		"vpYF": y
		"vpWidthF": width
		"vpHeightF": height
	end getvalues
	bb = NhlGetBB(id)
	bb_height = bb(0) - bb(1)
	bb_width = bb(3) - bb(2)
  end if
	
  if (bb_height / bb_width .lt. frame_height / frame_width) then
;	width is limiting dimension

	factor = frame_width / bb_width
	width = width * factor
	height = height * factor
	x_off = (x - bb(2)) * factor
	y_off = (y - bb(0)) * factor
	x = left + x_off
	bb_height = bb_height * factor
	y = top + y_off - 0.5 * (frame_height - bb_height)
  else
;	height is limiting dimension

	factor = frame_height / bb_height
	height = height * factor
	width = width * factor
	x_off = (x - bb(2)) * factor
	y_off = (y - bb(0)) * factor
	bb_width = bb_width * factor
	x = left + x_off + 0.5 * (frame_width - bb_width)
	y = top + y_off
  end if

  setvalues id
    "vpXF": x
    "vpYF": y
    "vpWidthF": width
    "vpHeightF": height
  end setvalues

  draw(id)

  setvalues id
    "vpXF": x_save
    "vpYF": y_save
    "vpWidthF": width_save
    "vpHeightF": height_save
  end setvalues

end

begin
;
; Main program.  
;

  wks_type = "x11"

  if (str_lower(wks_type).eq."ncgm") then
;
; Create an ncgmWorkstation object with default colormap.
;
    wid = create "basic08" ncgmWorkstationClass defaultapp
        "wkMetaName" : "basic08n.ncgm"
    end create
  end if
  if (str_lower(wks_type).eq."x11") then
;
; Create an X11 output workstation and use the above color map.
;
    wid = create "basic08" windowWorkstationClass defaultapp
      "wkPause" : "True"
    end create
  end if
  if (str_lower(wks_type).eq."oldps") then
;
; Create an older-style PostScript workstation.
;
    wid = create "basic08" psWorkstationClass defaultapp
      "wkPSFileName"   : "basic08n.ps"
    end create
  end if
  if (str_lower(wks_type).eq."oldpdf") then
;
; Create an older-style PDF workstation.
;
    wid = create "basic08" pdfWorkstationClass defaultapp
      "wkPDFFileName"   : "basic08n.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.
;
    wid = create "basic08" documentWorkstationClass defaultapp
      "wkFileName" : "basic08n"
      "wkFormat"   : wks_type
    end create
  end if
  if (str_lower(wks_type).eq."png") then
;
; Create a cairo PNG Workstation object.
;
    wid = create "basic08" imageWorkstationClass defaultapp
      "wkFileName" : "basic08n"
      "wkFormat"   : wks_type
    end create
  end if

;
;
; create a LogLinPlot with a viewport that fill the viewspace. This will
; be used for drawing immediate mode polylines indicating the intended
; boundary of each plot object.
;

  ll_id = create "loglin" logLinPlotClass wid
	"vpXF" : 0.0
 	"vpYF" : 1.0
	"vpHeightF" : 1.0
	"vpWidthF" : 1.0
  end create

;
; Set GraphicStyle resources to modify the immediate mode line attributes.
;
  getvalues wid
    "wkDefGraphicStyleId": gid
  end getvalues

  setvalues gid
	"gsLineColor" : 2
	"gsLineDashPattern" : 1
  end setvalues

;
; Create an empty ContourPlot with a Title, a LabelBar, and a Legend.
; Note that the viewport is square and covers the whole NDC space, 
; meaning that if the plot were drawn as created, all annotations exterior
; to the viewport would be outside the viewspace and therefore clipped.
; 

  cn_id = create "contour" contourPlotClass wid
	"pmLabelBarDisplayMode" : "always"
	"pmLegendDisplayMode" : "always"
	"tiMainString" : "bounded contour plot"
	"vpXF" : 0.0
 	"vpYF" : 1.0
	"vpHeightF" : 1.0
	"vpWidthF" : 1.0
  end create

;
; The first frame illustrates drawing the plot with a 5% margin around
; the viewable area. Draw an immediate mode line indicating the boundary 
; that defines the margin
;

  x = (/ 0.05, 0.95, 0.95, 0.05, 0.05 /)
  y = (/ 0.05, 0.05, 0.95, 0.95, 0.05 /)
  NhlNDCPolyline(ll_id,gid,x,y)

;
; Draw the plot with the desired boundary parameters.
;
  draw_bounded_plot(cn_id, True, 0.05, 0.95, 0.05, 0.95)
  frame(wid)

;
; The second frame illustrates use of the draw_bounded_plot procedure
; to place several plots with varying aspect ratios in a single frame.
;
  x = (/ 0.025, 0.475, 0.475, 0.025, 0.025 /)
  y = (/ 0.525, 0.525, 0.975, 0.975, 0.525 /)
  NhlNDCPolyline(ll_id,gid,x,y)

;
; Set the ContourPlot viewport so that the width is twice the height.
; (The absolute numbers are not important here, only the ratio matters.)
;

  setvalues cn_id
	"vpWidthF" : 0.6
	"vpHeightF" : 0.3
	"tiMainString" : "width is limiting dimension"
  end setvalues

;
; Draw the plot with the desired boundary parameters.
;
  draw_bounded_plot(cn_id, True, 0.025, 0.475, 0.525, 0.975)

;
; Draw an immediate mode line indicating the desired boundary of the
; second plot.
;

  x = (/ 0.525, 0.975, 0.975, 0.525, 0.525 /)
  y = (/ 0.525, 0.525, 0.975, 0.975, 0.525 /)
  NhlNDCPolyline(ll_id,gid,x,y)

;
;
; Set the ContourPlot viewport so that the height is twice the width.
;

  setvalues cn_id
	"vpWidthF" : 0.3
	"vpHeightF" : 0.6
	"tiMainString" : "height is limiting dimension"
  end setvalues

;
; Draw the plot with the desired boundary parameters.
;

  draw_bounded_plot(cn_id, True, 0.525, 0.975, 0.525, 0.975)

;
; Draw an immediate mode line indicating the desired boundary of the
; third plot.
;
  x = (/ 0.125, 0.875, 0.875, 0.125, 0.125 /)
  y = (/ 0.1, 0.1, 0.4, 0.4, 0.1 /)
  NhlNDCPolyline(ll_id,gid,x,y)

;
; For this plot the aspect ratio is distorted in order to fill as much as 
; possible of the desired area. Note that the space is not completely filled.
; This is because a number of factors affecting the final aspect ratio,
; such as the text size used for titles, are determined based on only
; one of the viewport's dimensions. 
;
  setvalues cn_id
	"tiMainString" : "distort aspect ratio to fill area"
	"vpHeightF" : 1.0
	"vpWidthF" : 1.0
  end setvalues

;
; Draw the plot with the desired boundary parameters.
;

  draw_bounded_plot(cn_id, False, 0.125, 0.875, 0.1, 0.4)
  frame(wid)

;
; clean up 
;
  delete(x)
  delete(y)
  delete(wid)

end