/usr/share/ncarg/nclex/contourplot/cn10n.ncl is in libncarg-data 6.1.2-7.
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 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; Copyright (C) 1995 ;
; University Corporation for Atmospheric Research ;
; All Rights Reserved ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; File: cn10n.ncl
;
; Author: Fred Clare
; National Center for Atmospheric Research
; PO 3000, Boulder, Colorado
;
; Date: Fri Jun 9 15:14:04 MDT 1995
;
; Description: Reads a netCDF file and produces five plots:
;
; 1.) A quick-and-dirty contour plot.
; 2.) An improved contour plot.
; 3.) A contour plot of a sub-area of plot 2.)
; 4.) An XyPlot that is a slice through the
; the contoured area in 2.)
; 5.) An overlay of the contour plot in 2.) on
; an MapPlot object.
;
begin
;
; Open up a data file containing a mound.
;
file1 = addfile(ncargpath("data") + "/cdf/cn10n.cdf","r")
;
; Set up color map.
;
;
; Colors for contour fill areas varying from blue to red.
;
cmap = (/ (/1.00, 1.00, 1.00/), \
(/0.00,0.00, 0.00/), \
(/0.00, 0.15, 1.00/), \
(/0.00, 0.05, 1.00/), \
(/0.04, 0.00, 1.00/), \
(/0.14, 0.00, 1.00/), \
(/0.24, 0.00, 1.00/), \
(/0.34, 0.00, 1.00/), \
(/0.43, 0.00, 1.00/), \
(/0.53, 0.00, 1.00/), \
(/0.63, 0.00, 1.00/), \
(/0.73, 0.00, 1.00/), \
(/0.83, 0.00, 1.00/), \
(/0.92, 0.00, 1.00/), \
(/1.00, 0.00, 0.98/), \
(/1.00, 0.00, 0.88/), \
(/1.00, 0.00, 0.78/), \
(/1.00, 0.00, 0.68/), \
(/1.00, 0.00, 0.59/), \
(/1.00, 0.00, 0.49/), \
(/1.00, 0.00, 0.39/), \
(/1.00, 0.00, 0.29/), \
(/1.00, 0.00, 0.20/), \
(/1.00, 0.00, 0.10/), \
(/1.00, 0.00, 0.00/), \
; \
; Colors used for labels. \
; \
(/0.00, 0.00, 0.00/), \
(/0.40, 0.00, 0.40/) /)
;
; Default is to display output to an X workstation
;
wks_type = "x11"
if (str_lower(wks_type).eq."ncgm") then
;
; Create an ncgmWorkstation object.
;
workstation_id = create "moundn" ncgmWorkstationClass defaultapp
"wkMetaName" : "cn10n.ncgm"
"wkColorMap" : cmap
"wkBackgroundColor" : (/ 1., 1., 1. /)
end create
end if
if (str_lower(wks_type).eq."x11") then
;
; Create an X11 workstation.
;
workstation_id = create "moundx" windowWorkstationClass defaultapp
"wkPause" : True
"wkColorMap" : cmap
"wkBackgroundColor" : (/ 1., 1., 1. /)
end create
end if
if (str_lower(wks_type).eq."oldps") then
;
; Create an PSWorkstation object.
;
workstation_id = create "moundp" psWorkstationClass defaultapp
"wkPSFileName" : "cn10n.ps"
"wkColorMap" : cmap
"wkBackgroundColor" : (/ 1., 1., 1. /)
end create
end if
if (str_lower(wks_type).eq."oldpdf") then
;
; Create an PDFWorkstation object.
;
workstation_id = create "moundp" pdfWorkstationClass defaultapp
"wkPDFFileName" : "cn10n.pdf"
"wkColorMap" : cmap
"wkBackgroundColor" : (/ 1., 1., 1. /)
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.
;
workstation_id = create "moundp" documentWorkstationClass defaultapp
"wkFileName" : "cn10n"
"wkFormat" : wks_type
"wkColorMap" : cmap
"wkBackgroundColor" : (/ 1., 1., 1. /)
end create
end if
if (str_lower(wks_type).eq."png") then
;
; Create a cairo PNG Workstation object.
;
workstation_id = create "moundp" imageWorkstationClass defaultapp
"wkFileName" : "cn10n"
"wkFormat" : wks_type
"wkColorMap" : cmap
"wkBackgroundColor" : (/ 1., 1., 1. /)
end create
end if
;
; Create a data field.
;
field1 = create "field1" scalarFieldClass defaultapp
"sfDataArray" : file1->mound
"sfMissingValueV": file1->mound@_FillValue
"sfXCStartV" : file1->ydim(0)
"sfXCEndV": file1->ydim(filevardimsizes(file1,"ydim") - 1)
"sfYCStartV" : file1->xdim(0)
"sfYCEndV": file1->xdim(filevardimsizes(file1,"xdim") - 1)
end create
;
; Create a ContourPlot object using the above data field.
;
con1 = create "con1" contourPlotClass workstation_id
"vpXF": .15
"vpYF": .9
"vpWidthF" : .79
"vpHeightF" : .79
"cnScalarFieldData" : field1
end create
;
; Picture 1: A quick-and-dirty contour plot.
;
draw(con1)
frame(workstation_id)
;
; Picture 2: An improved contour plot.
;
setvalues con1
"cnFillOn": True
"cnMonoFillColor": False
"cnLevelSpacingF" : 2.0
"cnSmoothingOn": True
"cnMaxPointDistanceF" : 0.0
"cnLineColor": 0
"cnLineLabelFontColor": 25
"cnLineLabelFont": 22
"cnLineLabelFontHeightF": .02
"cnLineLabelInterval": 3
"cnLineLabelPlacementMode": "COMPUTED"
"cnHighLabelFont": 22
"cnHighLabelFontHeightF": .025
"cnHighLabelFontColor": 25
"cnInfoLabelOn": False
"tmXBMinorPerMajor": 2
"tmYLMajorLineColor": 26
"tmYLMinorLineColor": 26
"tmYLMinorThicknessF": 2.
"tmXBMajorLineColor": 26
"tmXBMinorLineColor": 26
"tmXBMinorThicknessF": 2.
"tmXBLabelFont": 21
"tmXBLabelFontHeightF": .03
"tmXBLabelFontColor": 26
"tmYLLabelFont": 21
"tmYLLabelFontHeightF": .03
"tmYLLabelFontColor": 26
"tmBorderLineColor": 26
"tiMainOn": True
"tiMainFont": 26
"tiMainFontHeightF": .04
"tiMainString": "The Hot Zone"
"tiMainOffsetYF": -0.025
"tiMainFontColor": 26
end setvalues
draw(con1)
frame(workstation_id)
;
; Picture 3: Zero in on the top of the mound.
;
setvalues field1
"sfDataArray": file1->mound({-20:20},{-20:20})
"sfXCStartV" : -20.
"sfXCEndV": 20.
"sfYCStartV" : -20.
"sfYCEndV": 20.
end setvalues
setvalues con1
"tiMainString": "A closer look"
"tmXBMinorPerMajor": 4
"tmYLMinorPerMajor": 4
"cnLevelSpacingF" : 0.15
"cnFillColors": (/9,10,11,12,13,14,15,16,17,18,19,21,23/)
end setvalues
draw(con1)
frame(workstation_id)
;
; Picture 4: Plot an XyPlot of X values for a specific Y value.
;
y_dataid = create "xyData" coordArraysClass defaultapp
"caXArray": file1->ydim(:)
"caYArray": file1->mound({10},:)
end create
xy_id = create "XyPlotData" xyPlotClass workstation_id
"vpXF": .2
"vpYF": .85
"vpWidthF" : .7
"vpHeightF" : .7
"xyComputeYMax": False
"xyComputeYMin": False
"tiMainOn": True
"tiMainFont": 26
"tiMainFontHeightF": .0275
"tiMainString": "For X = 10."
"tiMainOffsetYF": -0.00
"tiMainFontColor": 26
"tiXAxisString": "Y"
"tiXAxisFont": 26
"tiXAxisFontColor": 26
"tiXAxisFontHeightF": .025
"tiYAxisString": "F(Y)"
"tiYAxisFont": 26
"tiYAxisFontColor": 26
"tiYAxisFontHeightF": .025
"tmXTBorderOn": False
"tmYRBorderOn": False
"tmXTOn": False
"tmYROn": False
"tmYLMajorLineColor": 26
"tmYLMinorLineColor": 26
"tmYLMinorThicknessF": 2.
"tmXBMajorLineColor": 26
"tmXBMinorLineColor": 26
"tmXBMinorThicknessF": 2.
"tmXBMinorPerMajor": 2
"tmYLMinorPerMajor": 2
"tmBorderLineColor": 26
"tmXBLabelFont": 21
"tmXBLabelFontHeightF": .025
"tmXBLabelFontColor": 26
"tmYLLabelFont": 21
"tmYLLabelFontHeightF": .025
"tmYLLabelFontColor": 26
end create
dataspec = NhlAddData(xy_id,"xyCoordData",y_dataid)
setvalues dataspec
"xyMonoLineColor": True
"xyLineColor": 24
"xyLineThicknessF": 2.
end setvalues
getvalues xy_id
"tmYLTickStartF": ymin
"tmYLTickEndF": ymax
end getvalues
setvalues xy_id
"trYMinF": ymin
"trYMaxF": ymax
end setvalues
draw(xy_id)
frame(workstation_id)
;
; Picture 5: Overlay the mound on top of Colorado.
;
mapid = create "Map0" mapPlotClass workstation_id
"pmTitleDisplayMode" : "always"
"tiMainOn": True
"tiMainFont": 26
"tiMainFontHeightF": .037
"tiMainOffsetYF": -0.00
"tiMainFontColor": 26
"tiMainString" : "Mound over Colorado"
"vpXF": .1
"vpYF": .9
"vpWidthF" : .79
"vpHeightF" : .79
"mpFillOn" : False
"mpOutlineBoundarySets" : "allBoundaries"
"mpProjection" : "LambertConformal"
"mpLambertParallel1F": 30.
"mpLambertParallel2F": 45.
"mpLambertMeridianF": -100.
"mpLimitMode": "LatLon"
"mpMinLatF": 33.
"mpMaxLatF": 44.
"mpMinLonF": -115.
"mpMaxLonF": -93.
"mpUSStateLineColor": 25
"mpUSStateLineThicknessF": 2.
"mpGridAndLimbOn": False
"mpPerimOn": True
"mpPerimLineColor": 26
"mpPerimLineThicknessF": 2.
end create
field2 = create "field2" scalarFieldClass defaultapp
"sfDataArray" : (file1->mound)
"sfXCStartV" : -109.05
"sfXCEndV": -102.05
"sfYCStartV" : 37.
"sfYCEndV": 41.
end create
con2 = create "con2" contourPlotClass workstation_id
"cnScalarFieldData" : field2
"cnFillOn": True
"cnMonoFillColor": False
"cnLevelSpacingF" : 8.0
"cnSmoothingOn": True
"cnMaxPointDistanceF" : 0.0
"cnLineColor": 0
"cnLineLabelsOn": False
"cnHighLabelsOn": False
"cnLowLabelsOn": False
"cnInfoLabelOn": False
"cnFillColors": (/3,7,11,15,19,23/)
; "cnFillColors": (/2,5,8,11,14,17,20,23/)
end create
overlay(mapid,con2)
draw(mapid)
frame(workstation_id)
end
|