This file is indexed.

/usr/share/ncarg/hluex/xyplot/xy16c.c 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
/*
 *      $Id: xy16c.c,v 1.6 2010-03-15 22:49:25 haley Exp $
 */
/************************************************************************
*                                                                       *
*                Copyright (C)  1996                                    *
*        University Corporation for Atmospheric Research                *
*                All Rights Reserved                                    *
*                                                                       *
************************************************************************/
/*
 *   File:       xy16c.c
 *
 *   Author:     Bob Lackman
 *           National Center for Atmospheric Research
 *           PO 3000, Boulder, Colorado
 *
 *   Date:       24 Jan 1996
 *
 *   Description:    Reads an ASCII file with 4 variables:
 *                   lon, u, v, and t.  u, v, and t are plotted
 *                   with 3 separate y axes.
 *
 *                   This example shows how the Data Spec object
 *                   can be retrieved so you can change certain
 *                   aspects of the plot, like the line color.
 *                   line color.
 *
 *                   In this example, each of the three variables
 *                   are assigned their own Y axis and scales by
 *                   creating three distinct XyPlot objects. The
 *                   first object is given a full grid and has
 *                   its Y axis scale on the left. The second 
 *                   object has no grid and the Y axis scale on
 *                   the right of the first grid. The third
 *                   object's viewport is made wider than the
 *                   first two and its X axis is scaled so that
 *                   the data end at the right grid boundary of
 *                   the first object.  Only the Y axis on the
 *                   right is drawn for the third object. The
 *                   curves and the Y axis scales are color
 *                   coordinated so you can tell which curve
 *                   goes with which scale.
 *                   
 *                   There is no resource file for this example.
 */
#include <stdio.h>
#include <math.h>
#include <ncarg/hlu/hlu.h>
#include <ncarg/hlu/ResList.h>
#include <ncarg/hlu/App.h>
#include <ncarg/hlu/NcgmWorkstation.h>
#include <ncarg/hlu/PSWorkstation.h>
#include <ncarg/hlu/PDFWorkstation.h>
#include <ncarg/hlu/CairoWorkstation.h>
#include <ncarg/hlu/XyPlot.h>
#include <ncarg/hlu/CoordArrays.h>
#include <ncarg/hlu/Title.h>
#include <ncarg/hlu/TextItem.h>
#include <ncarg/hlu/TickMark.h>

#define NCURVE 3
#define NPTS   129

/*
 * Define variables for tick mark labels
 */
char *yllabs[5] = {"-90.","-80.","-70.","-60.","-50."};
char *yrlabs1[6] = {"0.","10.","20.","30.","40.","50."};
char *yrlabs2[5] = {"-20.","-10.","0.","10.","20."};
float ylvals[5] =  {-90.,-80.,-70.,-60.,-50.};
float yrvals1[6] = {0.,10.,20.,30.,40.,50.};
float yrvals2[5] = {-20.,-10.,0.,10.,20.};

int main()
{
    FILE *fp;
    int i;
/*
 * Define variables for data
 */
    float lon[NPTS],u[NPTS],v[NPTS],t[NPTS];
/*
 * Define HLU variables for creating objects.
 */
    int appid,field1,field2,field3,xy1,xy2,xy3,xworkid ;
    int grlist, srlist, spec1, spec2, spec3;
/*
 * Define variable for data file
 */
    char filename[10];
/*
 * Indicate whether we want output to go to NCGM, X11 window or
 * PS file.
 */
    char const *wks_type = "x11";

    strcpy(filename,"xy.asc");
/*
 * Create Application object.
 */
    NhlInitialize();
    srlist = NhlRLCreate(NhlSETRL);
    grlist = NhlRLCreate(NhlGETRL);
    NhlRLClear(srlist);
    NhlRLSetString(srlist,NhlNappDefaultParent,"True");
    NhlRLSetString(srlist,NhlNappUsrDir,"./");
    NhlCreate(&appid,"xy16",NhlappClass,NhlDEFAULT_APP,srlist);
/*
 * Read ASCII file "xy.asc".
 */
    fp = fopen(filename,"r");
/*
 * Read data.
 */
    for( i = 0; i < NPTS; i++ ) {
      fscanf(fp,"%g",&lon[i]);
      fscanf(fp,"%g",&u[i]);
      fscanf(fp,"%g",&v[i]);
      fscanf(fp,"%g",&t[i]);
    }
/*
 * Create an NCGM workstation.
 */
    if (!strcmp(wks_type,"ncgm") || !strcmp(wks_type,"NCGM")) {
      NhlRLClear(srlist);
      NhlRLSetString(srlist,NhlNwkMetaName,"./xy16c.ncgm");
      NhlCreate(&xworkid,"xy16Work",NhlncgmWorkstationClass,NhlDEFAULT_APP,srlist);
    }
    else if (!strcmp(wks_type,"x11") || !strcmp(wks_type,"X11")) {
/*
 * Create an X11 workstation.
 */
      NhlRLClear(srlist);
      NhlRLSetString(srlist,NhlNwkPause,"True");
      NhlCreate(&xworkid,"xy16Work",NhlcairoWindowWorkstationClass,NhlDEFAULT_APP,srlist);
    }
    else if (!strcmp(wks_type,"oldps") || !strcmp(wks_type,"OLDPS")) {
/*
 * Create an older-style PostScript workstation.
 */
      NhlRLClear(srlist);
      NhlRLSetString(srlist,NhlNwkPSFileName,"./xy16c.ps");
      NhlCreate(&xworkid,"xy16Work",NhlpsWorkstationClass,NhlDEFAULT_APP,srlist);
    }
    else if (!strcmp(wks_type,"oldpdf") || !strcmp(wks_type,"OLDPDF")) {
/*
 * Create an older-style PDF workstation.
 */
      NhlRLClear(srlist);
      NhlRLSetString(srlist,NhlNwkPDFFileName,"./xy16c.pdf");
      NhlCreate(&xworkid,"xy16Work",NhlpdfWorkstationClass,NhlDEFAULT_APP,srlist);
    }
    else if (!strcmp(wks_type,"pdf") || !strcmp(wks_type,"PDF") ||
             !strcmp(wks_type,"ps") || !strcmp(wks_type,"PS")) {
/*
 * Create a cairo PS/PDF workstation.
 */
      NhlRLClear(srlist);
      NhlRLSetString(srlist,NhlNwkFileName,"./xy16c");
      NhlRLSetString(srlist,NhlNwkFormat, (char*)wks_type);
      NhlCreate(&xworkid,"xy16Work",NhlcairoDocumentWorkstationClass,NhlDEFAULT_APP,srlist);
    }
    else if (!strcmp(wks_type,"png") || !strcmp(wks_type,"PNG")) {
/*
 * Create a cairo PNG workstation.
 */
      NhlRLClear(srlist);
      NhlRLSetString(srlist,NhlNwkFileName,"./xy16c");
      NhlRLSetString(srlist,NhlNwkFormat, (char*)wks_type);
      NhlCreate(&xworkid,"xy16Work",NhlcairoImageWorkstationClass,NhlDEFAULT_APP,srlist);
    }
/*
 *  xy.asc has 4 vars of length 129 longitudes, lon, u, v, t
 *
 *     The data is taken at 43N latitude.  Longitude is an index
 *     1-129 standing for 0 deg - 360 deg in steps of 360/128?
 *     u and v are in m/s, and t is in deg K.
 *
 *     Convert from degrees K to degrees F and configure its extents
 *     missing values.
 */
    for( i = 0; i < NPTS; i++ ) {
      t[i] = (t[i] - 273.15) * 9 / 5 + 32.0;
      lon[i] = (lon[i] - 1.) * 360./128.;
    }
/*
 * Create the first Coord Arrays data object.
 */
      NhlRLClear(srlist);
      NhlRLSetFloatArray(srlist,NhlNcaYArray,t,NPTS);
      NhlRLSetFloatArray(srlist,NhlNcaXArray,lon,NPTS);
      NhlCreate(&field1,"field1",NhlcoordArraysClass,NhlDEFAULT_APP,srlist);
/*
 * Create the second Coord Arrays data object.
 */
      NhlRLClear(srlist);
      NhlRLSetFloatArray(srlist,NhlNcaYArray,u,NPTS);
      NhlRLSetFloatArray(srlist,NhlNcaXArray,lon,NPTS);
      NhlCreate(&field2,"field2",NhlcoordArraysClass,NhlDEFAULT_APP,srlist);
/*
 * Create the third Coord Arrays data object.
 */
      NhlRLClear(srlist);
      NhlRLSetFloatArray(srlist,NhlNcaYArray,v,NPTS);
      NhlRLSetFloatArray(srlist,NhlNcaXArray,lon,NPTS);
      NhlCreate(&field3,"field3",NhlcoordArraysClass,NhlDEFAULT_APP,srlist);
/*
 * Create XyPlot object for curve 1 and assign data to it.
 */
      NhlRLClear(srlist);
      NhlRLSetFloat(srlist,NhlNvpXF,.20);
      NhlRLSetFloat(srlist,NhlNvpYF,.80);
      NhlRLSetFloat(srlist,NhlNvpWidthF,.5);
      NhlRLSetFloat(srlist,NhlNvpHeightF,.6);
      NhlRLSetInteger(srlist,NhlNxyCoordData,field1);
      NhlRLSetString(srlist,NhlNtrYReverse,"False");
      NhlRLSetFloat(srlist,NhlNtrYMaxF,-50.);
      NhlRLSetFloat(srlist,NhlNtrYMinF,-90.);
      NhlRLSetFloat(srlist,NhlNtrXMaxF,360.);
      NhlRLSetFloat(srlist,NhlNtrXMinF,0.);
      NhlRLSetString(srlist,NhlNtmYROn,"False");
      NhlRLSetString(srlist,NhlNtmYUseLeft,"False");
      NhlRLSetString(srlist,NhlNtmYLLabelsOn,"True");
      NhlRLSetFloat(srlist,NhlNtmYLMajorLengthF,.01);
      NhlRLSetFloat(srlist,NhlNtmYLMajorOutwardLengthF,.01);
      NhlRLSetString(srlist,NhlNtmYLMode,"Explicit");
      NhlRLSetFloatArray(srlist,NhlNtmYLValues,ylvals,5);
      NhlRLSetStringArray(srlist,NhlNtmYLLabels,yllabs,5);
      NhlRLSetString(srlist,NhlNtmYLLabelsOn,"True");
      NhlRLSetString(srlist,NhlNtmYLLabelFontColor,"red");
      NhlRLSetString(srlist,NhlNtiXAxisString,"Longitude (Degs)");
      NhlRLSetString(srlist,NhlNtiYAxisString,"Temperature in Deg C");
      NhlRLSetFloat(srlist,NhlNtiXAxisFontHeightF,0.02);
      NhlRLSetFloat(srlist,NhlNtiYAxisFontHeightF,0.02);
      NhlRLSetString(srlist,NhlNtiXAxisFont,"helvetica-bold");
      NhlRLSetString(srlist,NhlNtiYAxisFont,"helvetica-bold");
      NhlRLSetString(srlist,NhlNtiYAxisFontColor,"red");
      NhlRLSetString(srlist,NhlNtmYRMinorOn,"False");
      NhlRLSetString(srlist,NhlNtmYLMinorOn,"False");
      NhlCreate(&xy1,"xy1",NhlxyPlotClass,xworkid,srlist);
/*
 * Create XyPlot object for curve 2 and assign data to it.
 */
      NhlRLClear(srlist);
      NhlRLSetFloat(srlist,NhlNvpXF,.20);
      NhlRLSetFloat(srlist,NhlNvpYF,.80);
      NhlRLSetFloat(srlist,NhlNvpWidthF,.5);
      NhlRLSetFloat(srlist,NhlNvpHeightF,.6);
      NhlRLSetInteger(srlist,NhlNxyCoordData,field2);
      NhlRLSetString(srlist,NhlNtrYReverse,"False");
      NhlRLSetFloat(srlist,NhlNtrYMaxF,50.);
      NhlRLSetFloat(srlist,NhlNtrYMinF,0.);
      NhlRLSetFloat(srlist,NhlNtrXMaxF,360.);
      NhlRLSetFloat(srlist,NhlNtrXMinF,0.);
      NhlRLSetString(srlist,NhlNtmYROn,"True");
      NhlRLSetString(srlist,NhlNtmYLOn,"False");
      NhlRLSetString(srlist,NhlNtmYUseLeft,"False");
      NhlRLSetString(srlist,NhlNtmYRLabelsOn,"True");
      NhlRLSetString(srlist,NhlNtmYLLabelsOn,"False");
      NhlRLSetFloat(srlist,NhlNtmYRMajorLengthF,.01);
      NhlRLSetFloat(srlist,NhlNtmYRMajorOutwardLengthF,.01);
      NhlRLSetString(srlist,NhlNtmYRMode,"Explicit");
      NhlRLSetFloatArray(srlist,NhlNtmYRValues,yrvals1,6);
      NhlRLSetStringArray(srlist,NhlNtmYRLabels,yrlabs1,6);
      NhlRLSetString(srlist,NhlNtmYRLabelFontColor,"cyan");
      NhlRLSetString(srlist,NhlNtiYAxisString,"U component of wind (m/s)");
      NhlRLSetString(srlist,NhlNtiYAxisSide,"Right");
      NhlRLSetFloat(srlist,NhlNtiXAxisFontHeightF,0.02);
      NhlRLSetFloat(srlist,NhlNtiYAxisFontHeightF,0.02);
      NhlRLSetString(srlist,NhlNtiMainFont,"helvetica-bold");
      NhlRLSetString(srlist,NhlNtiXAxisFont,"helvetica-bold");
      NhlRLSetString(srlist,NhlNtiYAxisFont,"helvetica-bold");
      NhlRLSetString(srlist,NhlNtiYAxisFontColor,"cyan");
      NhlRLSetString(srlist,NhlNtmYRMinorOn,"False");
      NhlRLSetString(srlist,NhlNtmYLMinorOn,"False");
      NhlCreate(&xy2,"xy2",NhlxyPlotClass,xworkid,srlist);
/*
 * Create XyPlot object for curve 3 and assign data to it.
 *
 * Increase the veiwport so the right scale will be about .15 NDC
 * right of the other grids.  Plot only the right vertical axis.
 * .5NDC = 360 deg lon, thus .65NDC = 360+108 deg lon.
 */
      NhlRLClear(srlist);
      NhlRLSetFloat(srlist,NhlNvpXF,.20);
      NhlRLSetFloat(srlist,NhlNvpYF,.80);
      NhlRLSetFloat(srlist,NhlNvpWidthF,.65);
      NhlRLSetFloat(srlist,NhlNvpHeightF,.6);
      NhlRLSetInteger(srlist,NhlNxyCoordData,field3);
      NhlRLSetString(srlist,NhlNtrYReverse,"False");
      NhlRLSetFloat(srlist,NhlNtrYMaxF,20.);
      NhlRLSetFloat(srlist,NhlNtrYMinF,-20.);
      NhlRLSetFloat(srlist,NhlNtrXMaxF,468.);
      NhlRLSetFloat(srlist,NhlNtrXMinF,0.);
      NhlRLSetString(srlist,NhlNtmYROn,"True");
      NhlRLSetString(srlist,NhlNtmYLOn,"False");
      NhlRLSetString(srlist,NhlNtmYUseLeft,"False");
      NhlRLSetString(srlist,NhlNtmYRLabelsOn,"True");
      NhlRLSetFloat(srlist,NhlNtmYRMajorLengthF,.01);
      NhlRLSetFloat(srlist,NhlNtmYRMajorOutwardLengthF,.01);
      NhlRLSetString(srlist,NhlNtmXBOn,"False");
      NhlRLSetString(srlist,NhlNtmXTOn,"False");
      NhlRLSetString(srlist,NhlNtmYLOn,"False");
      NhlRLSetString(srlist,NhlNtmYROn,"True");
      NhlRLSetString(srlist,NhlNtmYRMode,"Explicit");
      NhlRLSetFloatArray(srlist,NhlNtmYRValues,yrvals2,5);
      NhlRLSetStringArray(srlist,NhlNtmYRLabels,yrlabs2,5);
      NhlRLSetString(srlist,NhlNtmYRLabelFontColor,"green");
      NhlRLSetString(srlist,NhlNtiYAxisString,"V component of wind (m/s)");
      NhlRLSetString(srlist,NhlNtiYAxisSide,"Right");
      NhlRLSetFloat(srlist,NhlNtiXAxisFontHeightF,0.02);
      NhlRLSetFloat(srlist,NhlNtiYAxisFontHeightF,0.02);
      NhlRLSetString(srlist,NhlNtiMainString,"Three Variables with Individual Scales");
      NhlRLSetFloat(srlist,NhlNtiMainFontHeightF,0.030);
      NhlRLSetString(srlist,NhlNtiMainFont,"helvetica-bold");
      NhlRLSetString(srlist,NhlNtiYAxisFont,"helvetica-bold");
      NhlRLSetString(srlist,NhlNtiYAxisFontColor,"green");
      NhlRLSetString(srlist,NhlNtmYRMinorOn,"False");
      NhlRLSetString(srlist,NhlNtmYLMinorOn,"False");
      NhlRLSetString(srlist,NhlNtmXBMinorOn,"False");
      NhlRLSetString(srlist,NhlNtmXTBorderOn,"False");
      NhlRLSetString(srlist,NhlNtmXBBorderOn,"False");
      NhlRLSetString(srlist,NhlNtmYLBorderOn,"False");
      NhlCreate(&xy3,"xy3",NhlxyPlotClass,xworkid,srlist);
/*
 * Get the Data Spec Id of the first plot so we can then change
 * the line color.
 */
      NhlRLClear(grlist);
      NhlRLGetInteger(grlist,NhlNxyCoordDataSpec,&spec1);
      NhlGetValues(xy1,grlist);
      
      NhlRLClear(srlist);
      NhlRLSetString(srlist,NhlNxyMonoLineColor,"true");
      NhlRLSetString(srlist,NhlNxyLineColor,"red");
      NhlSetValues(spec1,srlist);
/*
 * Get the Data Spec id of the second plot so we can then change
 * the line color.
 */
      NhlRLClear(grlist);
      NhlRLGetInteger(grlist,NhlNxyCoordDataSpec,&spec2);
      NhlGetValues(xy2,grlist);

      NhlRLClear(srlist);
      NhlRLSetString(srlist,NhlNxyMonoLineColor,"true");
      NhlRLSetString(srlist,NhlNxyLineColor,"cyan");
      NhlSetValues(spec2,srlist);
/*
 * Get the Data Spec id of the third plot so we can then change
 * the line color.
 */
      NhlRLClear(grlist);
      NhlRLGetInteger(grlist,NhlNxyCoordDataSpec,&spec3);
      NhlGetValues(xy3,grlist);

      NhlRLClear(srlist);
      NhlRLSetString(srlist,NhlNxyMonoLineColor,"true");
      NhlRLSetString(srlist,NhlNxyLineColor,"green");
      NhlSetValues(spec3,srlist);
/*
 * Draw all three plots.
 */
      NhlDraw(xy1);
      NhlDraw(xy2);
      NhlDraw(xy3);
      NhlFrame(xworkid);
      NhlDestroy(appid);
      NhlClose();
      exit(0);
}