/usr/share/ncarg/hluex/xyplot/xy16f.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 | C
C $Id: xy16f.f,v 1.8 2010-03-15 22:49:25 haley Exp $
C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C C
C Copyright (C) 1996 C
C University Corporation for Atmospheric Research C
C All Rights Reserved C
C C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
C File: xy16f.f
C
C Author: Bob Lackman
C National Center for Atmospheric Research
C PO 3000, Boulder, Colorado
C
C Date: 24 Jan 1996
C
C Description: Reads an ASCII file with 4 variables:
C lon, u, v, and t. u, v, and t are plotted
C with 3 separate y axes.
C
C This example shows how the Data Spec object
C can be retrieved so you can change certain
C aspects of the plot, like the line color.
C line color.
C
C In this example, each of the three variables
C are assigned their own Y axis and scales by
C creating three distinct XyPlot objects. The
C first object is given a full grid and has
C its Y axis scale on the left. The second
C object has no grid and the Y axis scale on
C the right of the first grid. The third
C object's viewport is made wider than the
C first two and its X axis is scaled so that
C the data end at the right grid boundary of
C the first object. Only the Y axis on the
C right is drawn for the third object. The
C curves and the Y axis scales are color
C coordinated so you can tell which curve
C goes with which scale.
C
C There is no resource file for this example.
C
external NhlFAppClass
external NhlFNcgmWorkstationClass
external NhlFPSWorkstationClass
external NhlFPDFWorkstationClass
external NhlFCairoPSPDFWorkstationClass
external NhlFCairoImageWorkstationClass
external NhlFCairoWindowWorkstationClass
external NhlFCoordArraysClass
external NhlFXyPlotClass
external NhlFtitleclass
external NhlFTextItemClass
external NhlFTickMarkClass
parameter(NCURVE=3,NPTS=129)
C
C Define variables for data
C
real lon(NPTS),u(NPTS),v(NPTS),t(NPTS)
C
C Define variables for tick mark labels
C
real ylvals(5),yrvals1(6),yrvals2(5)
character yllabs(5)*4,yrlabs1(6)*3,yrlabs2(5)*4
data ylvals/-90.,-80.,-70.,-60.,-50./
data yllabs/'-90.','-80.','-70.','-60.','-50.'/
data yrvals1/0.,10.,20.,30.,40.,50./
data yrlabs1/'0.','10.','20.','30.','40.','50.'/
data yrvals2/-20.,-10.,0.,10.,20./
data yrlabs2/'-20.','-10.','0.','10.','20.'/
C
C Define HLU variables for creating objects.
C
integer appid,field1,field2,field3,xy1,xy2,xy3,xworkid
integer grlist, srlist, spec1, spec2, spec3
C
C Define variable for data file
C
character*6 filename
data filename/'xy.asc'/
C
C Indicate whether we want output to go to NCGM, X11 window or
C PS file.
C
CHARACTER*7 wks_type
C
C Define the workstation type
C
wks_type = "x11"
C
C Create Application object.
C
call NhlFInitialize
call NhlFRLCreate(srlist,'setrl')
call NhlFRLCreate(grlist,'getrl')
call NhlFRLClear(srlist)
call NhlFRLSetString(srlist,'appDefaultParent','True',ierr)
call NhlFRLSetString(srlist,'appUsrDir','./',ierr)
call NhlFCreate(appid,'xy16',NhlFAppClass,0,srlist,ierr)
C
C Read ASCII file "xy.asc".
C
open(unit=10,file=filename,status='old',form='formatted',err=104)
C
C Read data.
C
read(10,*)(lon(i),u(i),v(i),t(i),i=1,NPTS)
C
C Create an NCGM workstation.
C
if (wks_type.eq."ncgm".or.wks_type.eq."NCGM") then
call NhlFRLClear(srlist)
call NhlFRLSetString(srlist,'wkMetaName','./xy16f.ncgm',ierr)
call NhlFCreate(xworkid,'xy16Work',
+ 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,'xy16Work',
+ NhlFCairoWindowWorkstationClass,
+ 0,srlist,ierr)
else if (wks_type.eq."oldps".or.wks_type.eq."OLDPS") then
C
C Create an older-style PostScript workstation.
C
call NhlFRLClear(srlist)
call NhlFRLSetString(srlist,'wkPSFileName','./xy16f.ps',ierr)
call NhlFCreate(xworkid,'xy16Work',
+ 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','./xy16f.pdf',ierr)
call NhlFCreate(xworkid,'xy16Work',
+ 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 cairo PS/PDF workstation.
C
call NhlFRLClear(srlist)
call NhlFRLSetString(srlist,'wkFileName','./xy16f',ierr)
call NhlFRLSetString(srlist,'wkFormat',wks_type,ierr)
call NhlFCreate(xworkid,'xy16Work',
+ NhlFCairoPSPDFWorkstationClass,0,srlist,ierr)
else if (wks_type.eq."png".or.wks_type.eq."PNG") then
C
C Create a cairo PNG workstation.
C
call NhlFRLClear(srlist)
call NhlFRLSetString(srlist,'wkFileName','./xy16f',ierr)
call NhlFRLSetString(srlist,'wkFormat',wks_type,ierr)
call NhlFCreate(xworkid,'xy16Work',
+ NhlFCairoImageWorkstationClass,0,srlist,ierr)
endif
C
C xy.asc has 4 vars of length 129 longitudes, lon, u, v, t
C
C The data is taken at 43N latitude. Longitude is an index
C 1-129 standing for 0 deg - 360 deg in steps of 360/128?
C u and v are in m/s, and t is in deg K.
C
C Convert from degrees K to degrees F and configure its extents
C missing values.
C
do i=1,NPTS
t(i) = (t(i) - 273.15) * 9 / 5 + 32.0
lon(i) = (lon(i) - 1.) * 360./128.
end do
C
C Create the first Coord Arrays data object.
C
call NhlFRLClear(srlist)
call NhlFRLSetFloatArray(srlist,'caYArray',t,NPTS,ierr)
call NhlFRLSetFloatArray(srlist,'caXArray',lon,NPTS,ierr)
call NhlFCreate(field1,'field1',NhlFCoordArraysClass,
+ 0,srlist,ierr)
C
C Create the second Coord Arrays data object.
C
call NhlFRLClear(srlist)
call NhlFRLSetFloatArray(srlist,'caYArray',u,NPTS,ierr)
call NhlFRLSetFloatArray(srlist,'caXArray',lon,NPTS,ierr)
call NhlFCreate(field2,'field2',NhlFCoordArraysClass,
+ 0,srlist,ierr)
C
C Create the third Coord Arrays data object.
C
call NhlFRLClear(srlist)
call NhlFRLSetFloatArray(srlist,'caYArray',v,NPTS,ierr)
call NhlFRLSetFloatArray(srlist,'caXArray',lon,NPTS,ierr)
call NhlFCreate(field3,'field3',NhlFCoordArraysClass,
+ 0,srlist,ierr)
C
C Create XyPlot object for curve 1 and assign data to it.
C
call NhlFRLClear(srlist)
call NhlFRLSetFloat(srlist,'vpXF',.20,ierr)
call NhlFRLSetFloat(srlist,'vpYF',.80,ierr)
call NhlFRLSetFloat(srlist,'vpWidthF',.5,ierr)
call NhlFRLSetFloat(srlist,'vpHeightF',.6,ierr)
call NhlFRLSetInteger(srlist,'xyCoordData',field1,ierr)
call NhlFRLSetString(srlist,'trYReverse','False',ierr)
call NhlFRLSetFloat(srlist,'trYMaxF',-50.,ierr)
call NhlFRLSetFloat(srlist,'trYMinF',-90.,ierr)
call NhlFRLSetFloat(srlist,'trXMaxF',360.,ierr)
call NhlFRLSetFloat(srlist,'trXMinF',0.,ierr)
call NhlFRLSetString(srlist,'tmYROn','False',ierr)
call NhlFRLSetString(srlist,'tmYUseLeft','False',ierr)
call NhlFRLSetString(srlist,'tmYLLabelsOn','True',ierr)
call NhlFRLSetFloat(srlist,'tmYLMajorLengthF',.01,ierr)
call NhlFRLSetFloat(srlist,'tmYLMajorOutwardLengthF',.01,ierr)
call NhlFRLSetString(srlist,'tmYLMode','Explicit',ierr)
call NhlFRLSetFloatArray(srlist,'tmYLValues',ylvals,5,ierr)
call NhlFRLSetStringArray(srlist,'tmYLLabels',yllabs,5,ierr)
call NhlFRLSetString(srlist,'tmYLLabelsOn','True',ierr)
call NhlFRLSetString(srlist,'tmYLLabelFontColor','red',ierr)
call NhlFRLSetString(srlist,'tiXAxisString','Longitude (Degs)',
+ ierr)
call NhlFRLSetString(srlist,'tiYAxisString',
+ 'Temperature in Deg C',ierr)
call NhlFRLSetFloat(srlist,'tiXAxisFontHeightF',0.02,ierr)
call NhlFRLSetFloat(srlist,'tiYAxisFontHeightF',0.02,ierr)
call NhlFRLSetString(srlist,'tiXAxisFont','helvetica-bold',ierr)
call NhlFRLSetString(srlist,'tiYAxisFont','helvetica-bold',ierr)
call NhlFRLSetString(srlist,'tiYAxisFontColor','red',ierr)
call NhlFRLSetString(srlist,'tmYRMinorOn','False',ierr)
call NhlFRLSetString(srlist,'tmYLMinorOn','False',ierr)
call NhlFCreate(xy1,'xy1',NhlFXyPlotClass,xworkid,
+ srlist,ierr)
C
C Create XyPlot object for curve 2 and assign data to it.
C
call NhlFRLClear(srlist)
call NhlFRLSetFloat(srlist,'vpXF',.20,ierr)
call NhlFRLSetFloat(srlist,'vpYF',.80,ierr)
call NhlFRLSetFloat(srlist,'vpWidthF',.5,ierr)
call NhlFRLSetFloat(srlist,'vpHeightF',.6,ierr)
call NhlFRLSetInteger(srlist,'xyCoordData',field2,ierr)
call NhlFRLSetString(srlist,'trYReverse','False',ierr)
call NhlFRLSetFloat(srlist,'trYMaxF',50.,ierr)
call NhlFRLSetFloat(srlist,'trYMinF',0.,ierr)
call NhlFRLSetFloat(srlist,'trXMaxF',360.,ierr)
call NhlFRLSetFloat(srlist,'trXMinF',0.,ierr)
call NhlFRLSetString(srlist,'tmYROn','True',ierr)
call NhlFRLSetString(srlist,'tmYLOn','False',ierr)
call NhlFRLSetString(srlist,'tmYUseLeft','False',ierr)
call NhlFRLSetString(srlist,'tmYRLabelsOn','True',ierr)
call NhlFRLSetString(srlist,'tmYLLabelsOn','False',ierr)
call NhlFRLSetFloat(srlist,'tmYRMajorLengthF',.01,ierr)
call NhlFRLSetFloat(srlist,'tmYRMajorOutwardLengthF',.01,ierr)
call NhlFRLSetString(srlist,'tmYRMode','Explicit',ierr)
call NhlFRLSetFloatArray(srlist,'tmYRValues',yrvals1,6,ierr)
call NhlFRLSetStringArray(srlist,'tmYRLabels',yrlabs1,6,ierr)
call NhlFRLSetString(srlist,'tmYRLabelFontColor','cyan',ierr)
call NhlFRLSetString(srlist,'tiYAxisString',
+ 'U component of wind (m/s)',ierr)
call NhlFRLSetString(srlist,'tiYAxisSide','Right',ierr)
call NhlFRLSetFloat(srlist,'tiXAxisFontHeightF',0.02,ierr)
call NhlFRLSetFloat(srlist,'tiYAxisFontHeightF',0.02,ierr)
call NhlFRLSetString(srlist,'tiMainFont','helvetica-bold',ierr)
call NhlFRLSetString(srlist,'tiXAxisFont','helvetica-bold',ierr)
call NhlFRLSetString(srlist,'tiYAxisFont','helvetica-bold',ierr)
call NhlFRLSetString(srlist,'tiYAxisFontColor','cyan',ierr)
call NhlFRLSetString(srlist,'tmYRMinorOn','False',ierr)
call NhlFRLSetString(srlist,'tmYLMinorOn','False',ierr)
call NhlFCreate(xy2,'xy2',NhlFXyPlotClass,xworkid,
+ srlist,ierr)
C
C Create XyPlot object for curve 3 and assign data to it.
C
C Increase the veiwport so the right scale will be about .15 NDC
C right of the other grids. Plot only the right vertical axis.
C .5NDC = 360 deg lon, thus .65NDC = 360+108 deg lon.
C
call NhlFRLClear(srlist)
call NhlFRLSetFloat(srlist,'vpXF',.20,ierr)
call NhlFRLSetFloat(srlist,'vpYF',.80,ierr)
call NhlFRLSetFloat(srlist,'vpWidthF',.65,ierr)
call NhlFRLSetFloat(srlist,'vpHeightF',.6,ierr)
call NhlFRLSetInteger(srlist,'xyCoordData',field3,ierr)
call NhlFRLSetString(srlist,'trYReverse','False',ierr)
call NhlFRLSetFloat(srlist,'trYMaxF',20.,ierr)
call NhlFRLSetFloat(srlist,'trYMinF',-20.,ierr)
call NhlFRLSetFloat(srlist,'trXMaxF',468.,ierr)
call NhlFRLSetFloat(srlist,'trXMinF',0.,ierr)
call NhlFRLSetString(srlist,'tmYROn','True',ierr)
call NhlFRLSetString(srlist,'tmYLOn','False',ierr)
call NhlFRLSetString(srlist,'tmYUseLeft','False',ierr)
call NhlFRLSetString(srlist,'tmYRLabelsOn','True',ierr)
call NhlFRLSetFloat(srlist,'tmYRMajorLengthF',.01,ierr)
call NhlFRLSetFloat(srlist,'tmYRMajorOutwardLengthF',.01,ierr)
call NhlFRLSetString(srlist,'tmXBOn','False',ierr)
call NhlFRLSetString(srlist,'tmXTOn','False',ierr)
call NhlFRLSetString(srlist,'tmYLOn','False',ierr)
call NhlFRLSetString(srlist,'tmYROn','True',ierr)
call NhlFRLSetString(srlist,'tmYRMode','Explicit',ierr)
call NhlFRLSetFloatArray(srlist,'tmYRValues',yrvals2,5,ierr)
call NhlFRLSetStringArray(srlist,'tmYRLabels',yrlabs2,5,ierr)
call NhlFRLSetString(srlist,'tmYRLabelFontColor','green',ierr)
call NhlFRLSetString(srlist,'tiYAxisString',
+ 'V component of wind (m/s)',ierr)
call NhlFRLSetString(srlist,'tiYAxisSide','Right',ierr)
call NhlFRLSetFloat(srlist,'tiXAxisFontHeightF',0.02,ierr)
call NhlFRLSetFloat(srlist,'tiYAxisFontHeightF',0.02,ierr)
call NhlFRLSetString(srlist,'tiMainString',
+ 'Three Variables with Individual Scales',ierr)
call NhlFRLSetFloat(srlist,'tiMainFontHeightF',0.030,ierr)
call NhlFRLSetString(srlist,'tiMainFont','helvetica-bold',ierr)
call NhlFRLSetString(srlist,'tiYAxisFont','helvetica-bold',ierr)
call NhlFRLSetString(srlist,'tiYAxisFontColor','green',ierr)
call NhlFRLSetString(srlist,'tmYRMinorOn','False',ierr)
call NhlFRLSetString(srlist,'tmYLMinorOn','False',ierr)
call NhlFRLSetString(srlist,'tmXBMinorOn','False',ierr)
call NhlFRLSetString(srlist,'tmXTBorderOn','False',ierr)
call NhlFRLSetString(srlist,'tmXBBorderOn','False',ierr)
call NhlFRLSetString(srlist,'tmYLBorderOn','False',ierr)
call NhlFCreate(xy3,'xy3',NhlFXyPlotClass,xworkid,
+ srlist,ierr)
C
C Get the Data Spec Id of the first plot so we can then change
C the line color.
C
call NhlFRLClear(grlist)
call NhlFRLGetInteger(grlist,'xyCoordDataSpec',spec1,ierr)
call NhlFGetValues(xy1,grlist,ierr)
call NhlFRLClear(srlist)
call NhlFRLSetString(srlist,'xyMonoLineColor','true',ierr)
call NhlFRLSetString(srlist,'xyLineColor','red',ierr)
call NhlFSetValues(spec1,srlist,ierr)
C
C Get the Data Spec id of the second plot so we can then change
C the line color.
C
call NhlFRLClear(grlist)
call NhlFRLGetInteger(grlist,'xyCoordDataSpec',spec2,ierr)
call NhlFGetValues(xy2,grlist,ierr)
call NhlFRLClear(srlist)
call NhlFRLSetString(srlist,'xyMonoLineColor','true',ierr)
call NhlFRLSetString(srlist,'xyLineColor','cyan',ierr)
call NhlFSetValues(spec2,srlist,ierr)
C
C Get the Data Spec id of the third plot so we can then change
C the line color.
C
call NhlFRLClear(grlist)
call NhlFRLGetInteger(grlist,'xyCoordDataSpec',spec3,ierr)
call NhlFGetValues(xy3,grlist,ierr)
call NhlFRLClear(srlist)
call NhlFRLSetString(srlist,'xyMonoLineColor','true',ierr)
call NhlFRLSetString(srlist,'xyLineColor','green',ierr)
call NhlFSetValues(spec3,srlist,ierr)
C
C Draw all three plots.
C
call NhlFDraw(xy1,ierr)
call NhlFDraw(xy2,ierr)
call NhlFDraw(xy3,ierr)
call NhlFFrame(xworkid,ierr)
call NhlFClose
stop
104 write (6,*) 'error in opening file: ',filename
end
|