/usr/share/ncarg/hluex/contourplot/cn03f.f is in libncarg-data 6.2.0-3.
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 | C
C $Id: cn03f.f,v 1.9 2010-03-15 22:49:23 haley Exp $
C
C***********************************************************************
C *
C Copyright (C) 1995 *
C University Corporation for Atmospheric Research *
C All Rights Reserved *
C *
C***********************************************************************
C
C File: cn03f.f
C
C Author: Dave Brown (Converted to Fortran by Mary Haley)
C National Center for Atmospheric Research
C PO 3000, Boulder, Colorado
C
C Date: Tue Jan 24 09:34:24 MST 1995
C
C Description: Demonstrates basic features of the ContourPlot
C object. The first frame emulates the contour plot
C drawn in cn01c using low-level NCARG calls.
C
C External functions
C
external NhlFAppClass
external NhlFNcgmWorkstationClass
external NhlFPSWorkstationClass
external NhlFPDFWorkstationClass
external NhlFCairoPSPDFWorkstationClass
external NhlFCairoImageWorkstationClass
external NhlFCairoWindowWorkstationClass
external nhlfscalarfieldclass
external nhlfcontourplotclass
external nhlfloglinplotclass
C
C Data array
C
parameter(M=73, N=10)
real t(M,N)
C
C The coordinates of the irregular Y dimension
C
real level(10)
data level/1000.,850.,700.,500.,400.,300.,250.,200.,150.,100./
C
C Explicit labels and label locations for the X Axis tickmarks
C
character*10 labels(7)
data labels/'90~S~o~N~S', '60~S~o~N~S', '30~S~o~N~S', 'EQ',
1 '30~S~o~N~N', '60~S~o~N~N', '90~S~o~N~N'/
real labellocs(7)
data labellocs /-90.0, -60.0, -30.0, 0.0, 30.0, 60.0, 90.0/
C
C The data dimensions
C
integer appid,wid,cnid,dataid,llid
integer rlist, grlist
integer len_dims(2)
real xvp,yvp,heightvp,widthvp
character*7 wks_type
C
C Data file name
C
character*12 filenm
filenm = 'cn03f.asc'
C
C Default is to display output to an X workstation
C
wks_type = "x11"
C
C Read data
C
open(unit=10,file=filenm,status='old',form='formatted',err=104)
do 10 j=1,N
read (10,1001)(t(i,j),i=1,M)
10 continue
1001 format(1x,15F13.8)
C
C Initialize the high level utility library
C
call NhlFInitialize
C
C Create an application context. Set the app dir to the current
C directory so the application looks for the resource file the
C directory it executes from.
C
call NhlFRLCreate(rlist,'SETRL')
call NhlFRLClear(rlist)
call NhlFRLSetstring(rlist,'appUsrDir','./',ierr)
call NhlFCreate(appid,'cn03',NhlFAppClass,0,rlist,ierr)
if (wks_type.eq."ncgm".or.wks_type.eq."NCGM") then
C
C Create an NCGM workstation.
C
call NhlFRLClear(rlist)
call NhlFRLSetstring(rlist,'wkMetaName','./cn03f.ncgm',ierr)
call NhlFCreate(wid,'cn03Work',NhlFNcgmWorkstationClass,
1 0,rlist,ierr)
else if (wks_type.eq."x11".or.wks_type.eq."X11") then
C
C Create an X workstation.
C
call NhlFRLClear(rlist)
call NhlFRLSetstring(rlist,'wkPause','True',ierr)
call NhlFCreate(wid,'cn03Work',
+ NhlFCairoWindowWorkstationClass,
1 0,rlist,ierr)
else if (wks_type.eq."oldps".or.wks_type.eq."OLDPS") then
C
C Create an older-style PostScript workstation.
C
call NhlFRLClear(rlist)
call NhlFRLSetstring(rlist,'wkPSFileName','./cn03f.ps',ierr)
call NhlFCreate(wid,'cn03Work',NhlFPSWorkstationClass,
1 0,rlist,ierr)
else if (wks_type.eq."oldpdf".or.wks_type.eq."OLDPDF") then
C
C Create an older-style PDF workstation.
C
call NhlFRLClear(rlist)
call NhlFRLSetstring(rlist,'wkPDFFileName','./cn03f.pdf',
1 ierr)
call NhlFCreate(wid,'cn03Work',NhlFPDFWorkstationClass,
1 0,rlist,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 object.
C
call NhlFRLClear(rlist)
call NhlFRLSetstring(rlist,'wkFileName','./cn03f',
1 ierr)
call NhlFRLSetstring(rlist,'wkFormat',wks_type,ierr)
call NhlFCreate(wid,'cn03Work',NhlFCairoPSPDFWorkstationClass,
1 0,rlist,ierr)
else if (wks_type.eq."png".or.wks_type.eq."PNG") then
C
C Create a cairo PNG object.
C
call NhlFRLClear(rlist)
call NhlFRLSetstring(rlist,'wkFileName','./cn03f',
1 ierr)
call NhlFRLSetstring(rlist,'wkFormat',wks_type,ierr)
call NhlFCreate(wid,'cn03Work',NhlFCairoImageWorkstationClass,
1 0,rlist,ierr)
endif
C
C Create a scalar field data object with a linear X dimension
C representing latitude and an irregular Y dimension representing
C geopotential height.
C Define the start and end points of the data, based on the dataset.
C
call NhlFRLClear(rlist)
len_dims(1) = M
len_dims(2) = N
call NhlFRLSetmdfloatarray(rlist,'sfDataArray',t,2,len_dims,ierr)
call NhlFRLSetfloatarray(rlist,'sfYArray',level,10,ierr)
call NhlFRLSetfloat(rlist,'sfXCStartV',-90.0,ierr)
call NhlFRLSetfloat(rlist,'sfXCEndV',90.0,ierr)
call NhlFRLSetfloat(rlist,'sfYCStartV',1000.0,ierr)
call NhlFRLSetfloat(rlist,'sfYCEndV',100.0,ierr)
call NhlFCreate(dataid,'mydata',nhlfscalarfieldclass,0,rlist,
1 ierr)
C
C Create a ContourPlot object. Since ContourPlot contains a TickMark
C object by default, the non-default TickMark resources can be set
C in the ContourPlot object.
C
call NhlFRLClear(rlist)
call NhlFRLSetstring(rlist,'tiMainString',
1 'Profile @ 105~S~o~N~W - Frame 1',ierr)
call NhlFRLSetinteger(rlist,'cnScalarFieldData',dataid,ierr)
call NhlFRLSetfloat(rlist,'vpXF',0.125,ierr)
call NhlFRLSetfloat(rlist,'vpYF',0.85,ierr)
call NhlFRLSetfloat(rlist,'vpWidthF',0.6,ierr)
call NhlFRLSetfloat(rlist,'vpHeightF',0.6,ierr)
call NhlFRLSetfloat(rlist,'cnLevelSpacingF',5.0,ierr)
call NhlFRLSetstring(rlist,'tmXBMode','EXPLICIT',ierr)
call NhlFRLSetstring(rlist,'tmXBMinorOn','FALSE',ierr)
call NhlFRLSetfloatarray(rlist,'tmXBValues',labellocs,7,ierr)
call NhlFRLSetstringarray(rlist,'tmXBLabels',labels,7,ierr)
call NhlFCreate(cnid,'ContourPlot1',nhlfcontourplotclass,
1 wid,rlist,ierr)
call NhlFDraw(cnid,ierr)
call NhlFFrame(wid,ierr)
C
C Color and add dash patterns to the lines, then display a legend
C listing the line types. The position of the Legend is controlled by
C resources set in the resource file. Thicken lines.
C Note that the Legend and LabelBar are provided to the ContourPlot
C object by its PlotManager (created by default when the ContourPlot
C object is initialized). Therefore the resources to control them have
C the prefix 'pm' rather than 'cn'.
C
call NhlFRLClear(rlist)
call NhlFRLSetstring(rlist,'tiMainString',
1 'Profile @ 105~S~o~N~W - Frame 2',ierr)
call NhlFRLSetstring(rlist,'cnMonoLineColor','FALSE',ierr)
call NhlFRLSetstring(rlist,'cnMonoLineDashPattern','FALSE',ierr)
call NhlFRLSetstring(rlist,'pmLegendDisplayMode','always',ierr)
call NhlFSetValues(cnid,rlist,ierr)
call NhlFDraw(cnid,ierr)
call NhlFFrame(wid,ierr)
C
C Turn lines off, and use solid color fill instead.
C Remove the Legend and display a LabelBar.
C Turn off line and high/low labels.
C
call NhlFRLClear(rlist)
call NhlFRLSetstring(rlist,'tiMainString',
1 'Profile @ 105~S~o~N~W - Frame 3',ierr)
call NhlFRLSetstring(rlist,'cnLinesOn','FALSE',ierr)
call NhlFRLSetstring(rlist,'cnFillOn','TRUE',ierr)
call NhlFRLSetstring(rlist,'pmLegendDisplayMode','never',ierr)
call NhlFRLSetstring(rlist,'pmLabelBarDisplayMode','always',ierr)
call NhlFRLSetstring(rlist,'cnLineLabelsOn','FALSE',ierr)
call NhlFRLSetstring(rlist,'cnHighLabelsOn','FALSE',ierr)
call NhlFRLSetstring(rlist,'cnLowLabelsOn','FALSE',ierr)
call NhlFSetValues(cnid,rlist,ierr)
call NhlFDraw(cnid,ierr)
call NhlFFrame(wid,ierr)
C
C Now show the plot with the Y-Axis linearized, by overlaying the
C plot on a LogLinPlot object. Retrieve the current view coordinates
C of the ContourPlot object and pass them on to the LogLinPlot object.
C Note the LogLinPlot needs to be told the data boundaries.
C
call NhlFRLClear(rlist)
call NhlFRLSetstring(rlist,'tiMainString',
1 'Profile @ 105~S~o~N~W - Frame 4',ierr)
call NhlFSetValues(cnid,rlist,ierr)
call NhlFRLCreate(grlist,'GETRL')
call NhlFRLClear(grlist)
call NhlFRLGetfloat(grlist,'vpXF',xvp,ierr)
call NhlFRLGetfloat(grlist,'vpYF',yvp,ierr)
call NhlFRLGetfloat(grlist,'vpWidthF',widthvp,ierr)
call NhlFRLGetfloat(grlist,'vpHeightF',heightvp,ierr)
call NhlFGetValues(cnid,grlist,ierr)
call NhlFRLClear(rlist)
call NhlFRLSetfloat(rlist,'vpXF',xvp,ierr)
call NhlFRLSetfloat(rlist,'vpYF',yvp,ierr)
call NhlFRLSetfloat(rlist,'vpWidthF',widthvp,ierr)
call NhlFRLSetfloat(rlist,'vpHeightF',heightvp,ierr)
call NhlFRLSetfloat(rlist,'trXMinF',-90.0,ierr)
call NhlFRLSetfloat(rlist,'trXMaxF',90.0,ierr)
call NhlFRLSetfloat(rlist,'trYMaxF',1000.0,ierr)
call NhlFRLSetfloat(rlist,'trYMinF',100.0,ierr)
call NhlFRLSetstring(rlist,'trYReverse','True',ierr)
call NhlFCreate(llid,'LogLin1',nhlfloglinplotclass,wid,
1 rlist,ierr)
C
C The LogLinPlot becomes the Base Plot, since it controls the
C coordinate system that we are mapping to. Overlay the ContourPlot
C object on the Base Plot, then plot the LogLinPlot object.
C Note that you cannot draw the ContourPlot object directly, once
C it becomes an Overlay Plot.
C
call NhlFAddOverlay(llid,cnid,-1,ierr)
call NhlFDraw(llid,ierr)
call NhlFFrame(wid,ierr)
call NhlFDestroy(llid,ierr)
call NhlFDestroy(dataid,ierr)
call NhlFDestroy(cnid,ierr)
call NhlFDestroy(wid,ierr)
call NhlFDestroy(appid,ierr)
call NhlFClose
stop
104 write (6,*) 'Error in opening file: ',filenm
end
|