;
; Open file containing surface pressure data for
; the entire globe.
;
a = addfile("data/94072700_aP.cdf","r")
;
; Read in pressure variable and convert it to pascals.
;
p = a->Psl/100.0
;
; Read in forecast times variable.
;
frtime = a->frtime
;
; Sort the pressure array by forecast
; time to put them in increasing order.
;
tmp = new(dimsizes(p(0,:,:)),float)
ind = 0
do i = 0, dimsizes(frtime) - 2
ind = i
do j = i + 1, dimsizes(frtime) - 2
if(frtime(j) .lt. frtime(ind))
ind = j
end if
end do
if(ind.ne.i)
tmp = p(ind,:,:)
p(ind,:,:) = p(i,:,:)
p(i,:,:) = tmp
tmp2 = frtime(ind)
frtime(ind) = frtime(i)
frtime(i) = tmp2
end if
end do
;
; Compute minimums and maximums.
;
lat = a->lat
if(lat(0) .lt. lat(dimsizes(lat)-1)) then
ymin = lat(0)
ymax = lat(dimsizes(lat)-1)
else
ymax= lat(0)
ymin = lat(dimsizes(lat)-1)
end if
lon = a->lon
if(lon(0) .lt. lon(dimsizes(lon)-1)) then
xmin = lon(0)
xmax = lon(dimsizes(lon)-1)
else
xmax= lon(0)
xmin = lon(dimsizes(lon)-1)
end if
;
; Create the scalar field object with the first time step.
;
field1 = create "field1" scalarFieldLayerClass noparent
"sfDataArray" : p(0,:,:)
"sfMissingValueV" : p@_FillValue
"sfXCStartV" : a->lon(0)
"sfXCEndV" : a->lon(dimsizes(a->lon)- 1)
"sfYCStartV" : a->lat(0)
"sfYCEndV" : a->lat(dimsizes(a->lat) - 1)
end create
;
; Create an NCGM workstation with the metafile name "mapcontour01.ncgm".
;
wks = create "wks" ncgmWorkstationLayerClass noparent
"wkMetaName" : "mapcontour01.ncgm"
end create
;
; Create the map that is used as the base of the overlay.
;
map = create "map" mapPlotLayerClass wks
"vpXF": .1
"vpYF": .9
"vpWidthF": .8
"vpHeightF": .8
"mpCenterLatF": -60.0
"mpCenterLonF": 0.0
"mpProjection": "ORTHOGRAPHIC"
end create
;
; Create the contour object to be overlaid on the map object.
; The contour object uses manual contour intervals and solid-
; fill color.
;
con = create "con" contourLayerClass wks
"cnScalarFieldData" : field1
"tfOverlayPlotBase": "True"
"cnLevelSelectionMode" : "MANUAL"
"cnMinLevelValF" : 970.0
"cnMaxLevelValF" : 1030.0
"cnLevelSpacingF" : 5.0
"cnMaxLevelCount" : 35
"trYMinF": ymin
"trYMaxF": ymax
"trXMinF": xmin
"trXMaxF": xmax
"cnMonoFillPattern" : "True"
"cnFillPatterns" : 0
"cnFillOn" : "True"
"cnMonoLineColor" : "True"
"cnLineColors" : 1
"tiMainString" : "Forcast time " + 0 + " hours"
"cnLowLabelsOn" : "False"
"cnHighLabelsOn" : "False"
"cnLineLabelsOn" : "False"
end create
;
; Use the overlay function to assign the object "con" to the overaly base.
;
overlay(map,con)
;
; Draw first time step.
;
draw(map)
frame(wks)
;
; Loop over the remaining time steps and change the title string.
;
do i = 1, dimsizes(frtime) - 1
setvalues field1
"sfDataArray" : p(i,:,:)
end setvalues
setvalues con
"tiMainString" : "Forcast time " + frtime(i) + " hours"
end setvalues
draw(map)
frame(wks)
end do
;
; Free variables used in this script.
;
delete(a)
delete(p)
delete(tmp)
delete(tmp2)
delete(i)
delete(j)
delete(ind)
delete(lat)
delete(lon)
delete(xmax)
delete(ymax)
delete(xmin)
delete(ymin)