This file is indexed.

/usr/share/ncarg/hluex/xyplot/xy14f.f 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
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
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
C
C     $Id: xy14f.f,v 1.6 2010-03-15 22:49:25 haley Exp $
C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C                                                                      C
C           Copyright (C)  1995                                        C
C   University Corporation for Atmospheric Research                    C
C           All Rights Reserved                                        C
C                                                                      C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
C      File:            xy14f.f
C
C      Author:          Fred Clare (converted to Fortran by Mary Haley)
C                       National Center for Atmospheric Research
C                       PO 3000, Boulder, Colorado
C
C      Date:            Tue Oct 17 10:00:12 MDT 1995
C
C Description:  This example demonstrates the data manipulation
C               capabilities of the HLUS in conjunction with XyPlot.
C
C               This example is really meant to show the data
C               manipulation capabilities of NCL, since it does some
C               array arithmetic that you can't do in C or Fortran 77.
C
      external NhlFAppClass
      external NhlFCairoWindowWorkstationClass
      external NhlFPSWorkstationClass
      external NhlFPDFWorkstationClass
      external NhlFCairoPSPDFWorkstationClass
      external NhlFCairoImageWorkstationClass
      external NhlFNcgmWorkstationClass
      external NhlFXyPlotClass
      external NhlFCoordArraysClass
C
C Define temperature/rainfall data for a 25-hour period in
C an NCL variable.  In a real-world NCL script these values
C would probably be read in, either directly or as part of
C a data file like a netCDF or HDF file.
C
C The temperature data is hourly data in degrees Celsius and
C the rainfall data is hourly data in millimeters.
C
      real tr_data(25,2)
      data tr_data/ 9.00, 8.30, 7.40, 6.20, 5.60, 3.40, 2.70, 1.20,
     +              3.70, 5.80, 5.90, 4.50, 7.40,11.60,10.40, 9.20,
     +              7.80,10.20,12.10,11.40, 9.00, 8.90, 8.50, 7.40,
     +              6.60, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
     +              0.00, 0.00, 0.00, 0.25, 0.63, 0.10, 0.00, 0.53,
     +              3.75, 3.10, 0.52, 0.00, 0.00, 0.00, 0.00, 0.00,
     +              0.00,0.00/

      real yvalues(5)
      data yvalues/2.,1.,0.,-1.,-2./
      character*9 ylabels(5)
      data ylabels/'2~F33~s','~F33~s','~F22~MEAN','-~F33~s','-2~F33~s'/

      parameter(NHOURS=25)
      integer srlist
      real x_array(NHOURS), y_array(NHOURS)
      real x_array2(5), y_array2(5)
      real t_mean, std_dev, mm2inch
      data mm2inch/0.03937/
      integer appid, xworkid, plotid, dataid
      CHARACTER*7  wks_type
C
C Define the workstation type
C
      wks_type = "x11"
C
C
C Initialize the HLU library.
C
      call NhlFInitialize
      call NhlFRLCreate(srlist,'setrl')
C
C Create Application object.
C
      call NhlFRLClear(srlist)
      call NhlFRLSetString(srlist,'appDefaultParent','True',ierr)
      call NhlFRLSetString(srlist,'appUsrDir','./',ierr)
      call NhlFCreate(appid,'xy14',NhlFAppClass,0,srlist,ierr)

      if (wks_type.eq."ncgm".or.wks_type.eq."NCGM") then
C
C Create an NCGM workstation.
C
         call NhlFRLClear(srlist)
         call NhlFRLSetString(srlist,'wkMetaName','./xy14f.ncgm',ierr)
         call NhlFCreate(xworkid,'xy14Work',
     +        NhlFNcgmWorkstationClass,0,srlist,ierr)
      else if (wks_type.eq."x11".or.wks_type.eq."X11") then
C
C Create an X11 workstation.
C
         call NhlFRLClear(srlist)
         call NhlFRLSetString(srlist,'wkPause','True',ierr)
         call NhlFCreate(xworkid,'xy14Work',
     +        NhlFCairoWindowWorkstationClass,
     +        0,srlist,ierr)
      else if (wks_type.eq."oldps".or.wks_type.eq."OLDPS") then
C
C Create an older-style PS workstation.
C
         call NhlFRLClear(srlist)
         call NhlFRLSetString(srlist,'wkPSFileName','./xy14f.ps',ierr)
         call NhlFCreate(xworkid,'xy14Work',
     +        NhlFPSWorkstationClass,0,srlist,ierr)
      else if (wks_type.eq."oldpdf".or.wks_type.eq."OLDPDF") then
C
C Create an older-style PDF workstation.
C
         call NhlFRLClear(srlist)
         call NhlFRLSetString(srlist,'wkPDFFileName','./xy14f.pdf',ierr)
         call NhlFCreate(xworkid,'xy14Work',
     +        NhlFPDFWorkstationClass,0,srlist,ierr)
      else if (wks_type.eq."pdf".or.wks_type.eq."PDF".or.
     +         wks_type.eq."ps".or.wks_type.eq."PS") then
C
C Create a PS/PDF cairo workstation.
C
         call NhlFRLClear(srlist)
         call NhlFRLSetString(srlist,'wkFileName','./xy14f',ierr)
         call NhlFRLSetString(srlist,'wkFormat',wks_type,ierr)
         call NhlFCreate(xworkid,'xy14Work',
     +        NhlFCairoPSPDFWorkstationClass,0,srlist,ierr)
      else if (wks_type.eq."png".or.wks_type.eq."PNG") then
C
C Create a PNG cairo workstation.
C
         call NhlFRLClear(srlist)
         call NhlFRLSetString(srlist,'wkFileName','./xy14f',ierr)
         call NhlFRLSetString(srlist,'wkFormat',wks_type,ierr)
         call NhlFCreate(xworkid,'xy14Work',
     +        NhlFCairoImageWorkstationClass,0,srlist,ierr)
      endif
C
C Create X-axis values and convert data to Fahrenheit.
C
      do 10 i = 1,NHOURS
         x_array(i) = real(i-1)
         y_array(i) = (9./5.)*tr_data(i,1)+32.
 10   continue
C
C Picture 1:
C
C Convert the temperatures to degrees Fahrenheit and plot as an XyPlot
C object in the X11 window.  Note the usage of NCL algebraic operators
C and array selection capabilities.
C
      call NhlFRLClear(srlist)
      call NhlFRLSetFloatArray(srlist,'caXArray',x_array,NHOURS,ierr)
      call NhlFRLSetFloatArray(srlist,'caYArray',y_array,NHOURS,ierr)
      call NhlFCreate(dataid,'xyData',NhlFCoordArraysClass,appid,
     +     srlist,ierr)

      call NhlFRLClear(srlist)
      call NhlFRLSetInteger(srlist,'xyCoordData',dataid,ierr)
C
C X-axis resources
C
      call NhlFRLSetString(srlist,'tmXBMode','MANUAL',ierr)
      call NhlFRLSetFloat(srlist,'tmXBTickStartF',0.,ierr)
      call NhlFRLSetFloat(srlist,'tmXBTickEndF',24.,ierr)
      call NhlFRLSetFloat(srlist,'tmXBTickSpacingF',4.,ierr)
      call NhlFRLSetInteger(srlist,'tmXBLabelFont',22,ierr)
      call NhlFRLSetFloat(srlist,'tmXBLabelFontHeightF',0.024,ierr)
C
C Y-axis resources.  The title precision is changed to '2' so that
C integer values will be used (the temperatures are in a range
C requiring only two digits).
C
      call NhlFRLSetString(srlist,'tmYLMode','MANUAL',ierr)
      call NhlFRLSetFloat(srlist,'tmYLTickStartF',30.,ierr)
      call NhlFRLSetFloat(srlist,'tmYLTickEndF',60.,ierr)
      call NhlFRLSetFloat(srlist,'tmYLTickSpacingF',5.,ierr)
      call NhlFRLSetString(srlist,'tmYLAutoPrecision','False',ierr)
      call NhlFRLSetInteger(srlist,'tmYLPrecision',2,ierr)
      call NhlFRLSetInteger(srlist,'tmYLLabelFont',22,ierr)
      call NhlFRLSetFloat(srlist,'tmYLLabelFontHeightF',0.024,ierr)
      call NhlFRLSetInteger(srlist,'tmYLMinorPerMajor',4,ierr)
C
C Specify the Y-axis range precisely.
C
      call NhlFRLSetFloat(srlist,'trYMinF',30.,ierr)
      call NhlFRLSetFloat(srlist,'trYMaxF',60.,ierr)
C
C Supply titles
C
      call NhlFRLSetInteger(srlist,'tiMainFont',26,ierr)
      call NhlFRLSetFloat(srlist,'tiMainFontHeightF',.03,ierr)
      call NhlFRLSetString(srlist,'tiMainString','Hourly Temperatures',
     +     ierr)
      call NhlFRLSetInteger(srlist,'tiXAxisFont',22,ierr)
      call NhlFRLSetString(srlist,'tiXAxisString',
     +     'Hours Since Midnight',ierr)
      call NhlFRLSetInteger(srlist,'tiYAxisFont',22,ierr)
      call NhlFRLSetString(srlist,'tiYAxisString',
     +     'Temperature (degrees F)',ierr)
      call NhlFCreate(plotid,'XyPlot',NhlFXyPlotClass,xworkid,
     +     srlist,ierr)
      call NhlFDraw(plotid,ierr)
      call NhlFFrame(xworkid,ierr)
C
C Picture 2:
C
C Convert the rainfall data to inches and plot in the X11 window. 
C (In NCL, note how easy it is to select the rainfall data from the
C original two-dimensional data array.
C
      do 20 i = 1,NHOURS
         y_array(i) = mm2inch*tr_data(i,2)
 20   continue
      call NhlFRLClear(srlist)
      call NhlFRLSetFloatArray(srlist,'caXArray',x_array,NHOURS,ierr)
      call NhlFRLSetFloatArray(srlist,'caYArray',y_array,NHOURS,ierr)
      call NhlFCreate(dataid,'xyData',NhlFCoordArraysClass,appid,
     +     srlist,ierr)

      call NhlFRLClear(srlist)
      call NhlFRLSetInteger(srlist,'xyCoordData',dataid,ierr)
C
C X-axis resources
C
      call NhlFRLSetString(srlist,'tmXBMode','MANUAL',ierr)
      call NhlFRLSetFloat(srlist,'tmXBTickStartF',0.,ierr)
      call NhlFRLSetFloat(srlist,'tmXBTickEndF',24.,ierr)
      call NhlFRLSetFloat(srlist,'tmXBTickSpacingF',4.,ierr)
      call NhlFRLSetInteger(srlist,'tmXBLabelFont',22,ierr)
      call NhlFRLSetFloat(srlist,'tmXBLabelFontHeightF',0.024,ierr)
C
C Y-axis resources.
C
      call NhlFRLSetString(srlist,'tmYLMode','MANUAL',ierr)
      call NhlFRLSetFloat(srlist,'tmYLTickStartF',0.,ierr)
      call NhlFRLSetFloat(srlist,'tmYLTickEndF',0.15,ierr)
      call NhlFRLSetFloat(srlist,'tmYLTickSpacingF',0.03,ierr)
      call NhlFRLSetString(srlist,'tmYLAutoPrecision','False',ierr)
      call NhlFRLSetInteger(srlist,'tmYLPrecision',2,ierr)
      call NhlFRLSetInteger(srlist,'tmYLLabelFont',22,ierr)
      call NhlFRLSetFloat(srlist,'tmYLLabelFontHeightF',0.024,ierr)
      call NhlFRLSetInteger(srlist,'tmYLMinorPerMajor',4,ierr)
C
C Specify the Y-axis range precisely.
C
      call NhlFRLSetFloat(srlist,'trYMinF',0.,ierr)
      call NhlFRLSetFloat(srlist,'trYMaxF',0.15,ierr)
C
C Supply titles
C
      call NhlFRLSetInteger(srlist,'tiMainFont',26,ierr)
      call NhlFRLSetFloat(srlist,'tiMainFontHeightF',.03,ierr)
      call NhlFRLSetString(srlist,'tiMainString','Hourly Rainfall',ierr)
      call NhlFRLSetInteger(srlist,'tiXAxisFont',22,ierr)
      call NhlFRLSetString(srlist,'tiXAxisString',
     +     'Hours Since Midnight',ierr)
      call NhlFRLSetInteger(srlist,'tiYAxisFont',22,ierr)
      call NhlFRLSetString(srlist,'tiYAxisString','Rainfall in Inches',
     +     ierr)
      call NhlFCreate(plotid,'XyPlot',NhlFXyPlotClass,xworkid,
     +     srlist,ierr)
      call NhlFDraw(plotid,ierr)
      call NhlFFrame(xworkid,ierr)
C
C Picture 3:
C
C For each hourly temperature reading, plot the number of standard
C deviations from the mean the reading represents.  (In NCL, note the
C use of the NCL exponentiation operator (^) and the sqrt function.)
C
      t_mean = 0.
      do 30 i = 1,NHOURS
         t_mean = t_mean+(9./5.)*tr_data(i,1)+32.
 30   continue
      t_mean = t_mean/NHOURS
      std_dev = 0.
      do 40 i=1,NHOURS
         std_dev = std_dev+(((9./5.)*tr_data(i,1)+32.) - t_mean)**2.
 40   continue
      std_dev = sqrt(std_dev/(NHOURS-1))
      do 50 i = 1,NHOURS
         y_array(i) = ((9./5.)*tr_data(i,1)+32. - t_mean)/std_dev
 50   continue
      call NhlFRLClear(srlist)
      call NhlFRLSetFloatArray(srlist,'caXArray',x_array,NHOURS,ierr)
      call NhlFRLSetFloatArray(srlist,'caYArray',y_array,NHOURS,ierr)
      call NhlFCreate(dataid,'xyData',NhlFcoordArraysClass,appid,srlist,
     +     ierr)
      
      call NhlFRLClear(srlist)
C
C X-axis resources
C
      call NhlFRLSetString(srlist,'tmXBMode','MANUAL',ierr)
      call NhlFRLSetFloat(srlist,'tmXBTickStartF',0.,ierr)
      call NhlFRLSetFloat(srlist,'tmXBTickEndF',24.,ierr)
      call NhlFRLSetFloat(srlist,'tmXBTickSpacingF',4.,ierr)
      call NhlFRLSetInteger(srlist,'tmXBLabelFont',22,ierr)
      call NhlFRLSetFloat(srlist,'tmXBLabelFontHeightF',0.024,ierr)
C
C Y-axis resources.
C
      call NhlFRLSetString(srlist,'tmYLMode','EXPLICIT',ierr)
      call NhlFRLSetFloatArray(srlist,'tmYLValues',yvalues,5,ierr)
      call NhlFRLSetStringArray(srlist,'tmYLLabels',ylabels,5,ierr)
      call NhlFRLSetFloat(srlist,'tmYLTickSpacingF',1.,ierr)
      call NhlFRLSetInteger(srlist,'tmYLLabelFont',22,ierr)
      call NhlFRLSetFloat(srlist,'tmYLLabelFontHeightF',0.024,ierr)
      call NhlFRLSetString(srlist,'tmYMajorGrid','True',ierr)
      call NhlFRLSetString(srlist,'tmYLMinorOn','False',ierr)
      call NhlFRLSetString(srlist,'tmYRMinorOn','False',ierr)
C
C Specify the Y-axis range precisely.
C
      call NhlFRLSetFloat(srlist,'trYMinF',-2.5,ierr)
      call NhlFRLSetFloat(srlist,'trYMaxF',2.5,ierr)
C
C Supply titles
C
      call NhlFRLSetInteger(srlist,'tiMainFont',26,ierr)
      call NhlFRLSetFloat(srlist,'tiMainFontHeightF',.03,ierr)
      call NhlFRLSetString(srlist,'tiMainString',
     +     'Temperature Deviations From Mean',ierr)
      call NhlFRLSetInteger(srlist,'tiXAxisFont',22,ierr)
      call NhlFRLSetString(srlist,'tiXAxisString',
     +     'Hours Since Midnight',ierr)
      call NhlFRLSetString(srlist,'tiYAxisString','Deviations',ierr)
      call NhlFRLSetInteger(srlist,'tiYAxisFont',22,ierr)
      call NhlFCreate(plotid,'XyPlot',NhlFxyPlotClass,xworkid,srlist,
     +     ierr)
C
C Specify the use of filled circle markers.
C
      call NhlFAddData(plotid,'xyCoordData',dataid,dataspec)

      call NhlFRLClear(srlist)
      call NhlFRLSetString(srlist,'xyMarkLineMode','MARKERS',ierr)
      call NhlFRLSetString(srlist,'xyMonoMarkLineMode','True',ierr)
      call NhlFRLSetInteger(srlist,'xyMarker',16,ierr)
      call NhlFRLSetString(srlist,'xyMonoMarkerSize','True',ierr)
      call NhlFRLSetFloat(srlist,'xyMarkerSizeF',.02,ierr)
      call NhlFSetValues(dataspec,srlist,ierr)
      call NhlFDraw(plotid,ierr)
      call NhlFFrame(xworkid,ierr)
C
C Picture 4:
C (In Ncl, this section illustrate the use of being able to easily pick
C out subsections of data arrays.
C
      j = 1
      do 60 i = 3,NHOURS,6
         x_array2(j) = x_array(i)
         y_array2(j) = (9./5.)*tr_data(i,1)+32.
         j = j+1
 60   continue
      call NhlFRLClear(srlist)
      call NhlFRLSetFloatArray(srlist,'caXArray',x_array2,j-1,ierr)
      call NhlFRLSetFloatArray(srlist,'caYArray',y_array2,j-1,ierr)
      call NhlFCreate(dataid,'xyData',NhlFcoordArraysClass,appid,srlist,
     +     ierr)
      call NhlFRLClear(srlist)
      call NhlFRLSetInteger(srlist,'xyCoordData',dataid,ierr)
C
C X-axis resources 
C
      call NhlFRLSetString(srlist,'tmXBMode','MANUAL',ierr)
      call NhlFRLSetFloat(srlist,'tmXBTickStartF',2.,ierr)
      call NhlFRLSetFloat(srlist,'tmXBTickEndF',22.,ierr)
      call NhlFRLSetFloat(srlist,'tmXBTickSpacingF',6.,ierr)
      call NhlFRLSetInteger(srlist,'tmXBLabelFont',22,ierr)
      call NhlFRLSetFloat(srlist,'tmXBLabelFontHeightF',0.024,ierr)
      call NhlFRLSetInteger(srlist,'tmXBMinorPerMajor',0,ierr)
C
C Y-axis resources.
C
      call NhlFRLSetString(srlist,'tmYLMode','MANUAL',ierr)
      call NhlFRLSetFloat(srlist,'tmYLTickStartF',30.,ierr)
      call NhlFRLSetFloat(srlist,'tmYLTickEndF',60.,ierr)
      call NhlFRLSetFloat(srlist,'tmYLTickSpacingF',5.,ierr)
      call NhlFRLSetString(srlist,'tmYLAutoPrecision','False',ierr)
      call NhlFRLSetInteger(srlist,'tmYLPrecision',2,ierr)
      call NhlFRLSetInteger(srlist,'tmYLLabelFont',22,ierr)
      call NhlFRLSetFloat(srlist,'tmYLLabelFontHeightF',0.024,ierr)
      call NhlFRLSetInteger(srlist,'tmYLMinorPerMajor',4,ierr)
C
C Specify the Y-axis range precisely.
C
      call NhlFRLSetFloat(srlist,'trYMinF',30.,ierr)
      call NhlFRLSetFloat(srlist,'trYMaxF',60.,ierr)
C
C Supply titles
C
      call NhlFRLSetInteger(srlist,'tiMainFont',26,ierr)
      call NhlFRLSetString(srlist,'tiMainString',
     +     'Temperatures at Six Hour Intervals',ierr)
      call NhlFRLSetFloat(srlist,'tiMainFontHeightF',.03,ierr)
      call NhlFRLSetInteger(srlist,'tiXAxisFont',22,ierr)
      call NhlFRLSetString(srlist,'tiXAxisString',
     +     'Hours Since Midnight',ierr)
      call NhlFRLSetInteger(srlist,'tiYAxisFont',22,ierr)
      call NhlFRLSetString(srlist,'tiYAxisString',
     +     'Temperature (degrees F)',ierr)
      call NhlFCreate(plotid,'XyPlot',NhlFxyPlotClass,xworkid,srlist,
     +     ierr)

      call NhlFDraw(plotid,ierr)
      call NhlFFrame(xworkid,ierr)
C
C NhlDestroy destroys the given id and all of its children.
C
      call NhlFDestroy(appid,ierr)
      call NhlFRLDestroy(srlist)
C
C Restores state.
C
      call NhlFClose

      end