All-
I am trying to follow the example script WRF_track_1.ncl to add
polymarkers to a base map using WRF model data.
I am looping over time and the number of polymarkers but when I set
gsnDraw and gsnFrame to False it overlays on each plot.
I am also having a problem where the whole globe is being plotted rather
than my domain.
I am doing way more than this in the script but here is the relevant code:
;*************************************************
; WRF: creat basic x-y plots. Simple variations
;************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
external EX01 "./object_new.so"
begin
;************************************************
; open file and read in data
;************************************************
f = addfile ("myj_noah.nc", "r")
;************************************************
; Read all the times. Convert to numeric units for plottin.
;************************************************
Times = f->Times ; Times is of type character
Time = WRF_Times2Udunits_c(Times, 0) ; convert to "hours since"
lat = f->XLAT(0,:,:)
lon = f->XLONG(0,:,:)
x = 0
Tim = new((/24/),double)
do nt=4,96,4
Tim(x) = Time(nt)
x = x + 1
end do
printVarSummary(Tim)
;************************************************
; Import time series of perturbation geopotential (PH)
; at a (arbitrarily) specified grid point
;************************************************
rnf = f->RAINNC
ratef = new((/24,224,299/),float)
rng = g->RAINNC
rateg = new((/24,224,299/),float)
rnh = h->RAINNC
rateh = new((/24,224,299/),float)
rci = i->APCP ; (Time, bottom_top, south_north, west_east)
ratei = new((/24,224,299/),float)
ratef_at_description = "Precip. Rate"
ratef_at_units = "mm/hr"
ratef!0 = "Time"
ratef!1 = "south_north"
ratef!2 = "west_east"
x = 0
do nt=4,96,4
if ( nt .gt. 0)then
ratef(x,:,:) = ( rnf(Time|nt,south_north|:,west_east|:) - rnf(Time|nt-4,south_north|:,west_east|:))
; rateg(x,:,:) = (rcg(Time|nt,south_north|:,west_east|:) - rcg(Time|nt-4,south_north|:,west_east|:) + rng(Time|nt,south_north|:,west_east|:) - rng(Time|nt-4,south_north|:,west_east|:))
; rateh(x,:,:) = (rch(Time|nt,south_north|:,west_east|:) - rch(Time|nt-4,south_north|:,west_east|:) + rnh(Time|nt,south_north|:,west_east|:) - rnh(Time|nt-4,south_north|:,west_east|:))
x = x+1
end if
end do
; ratei = rci
dx = 4.0
thresh = 1.0
xx = 500
yy = 299
x = 299
y = 224
newa = new((/224,299/),float)
var = new((/224,299/),float)
data = new((/24,24,224,299/),float)
ceni = new((/500/),float)
cenj = new((/500/),float)
cenf = new((/2,24,500/),float)
index = new((/2,24/),integer)
z = 0
do nt=0,23
var(:,:) = ratef(nt,:,:)
EX01::object(var,thresh,x,y,yy,xx,lat,lon,newa,ceni,cenj,z)
data(0,nt,:,:) = newa(:,:)
cenf(0,nt,:) = ceni(:)
cenf(1,nt,:) = cenj(:)
index(0,nt) = z
end do
;************************************************
; create plots: Three slight variations.
;************************************************
wks = gsn_open_wks("ps" ,"over") ; ps,pdf,x11,ncgm,eps
res = True ; plot mods desired
res_at_gsnMaximize = True ; uncomment to maximize size
; res_at_tiMainString = lat+"N "+fabs(lon)+"W"
res_at_xyMarkLineMode = "MarkLines"
res_at_xyMarkers = (/1,6,11,16/)
res_at_pmLegendDisplayMode = "Always"
res_at_pmLegendSide = "Top" ; Change location of
res_at_pmLegendParallelPosF = .85 ; move units right
res_at_pmLegendOrthogonalPosF = -0.8 ; more neg = down
res_at_pmLegendWidthF = 0.12 ; Change width and
res_at_pmLegendHeightF = 0.25 ; height of legend.
res_at_lgLabelFontHeightF = .02 ; change font height
res_at_lgPerimOn = False ; no box around
; labels for the legend
res_at_xyExplicitLegendLabels = (/"MYJ","YSU","MRF","OBS"/)
plot = gsn_csm_xy(wks,Tim,over,res)
plot = gsn_csm_xy(wks,Tim,area,res)
end if
;plot a shaded plot of object numbers
;************************************************
; create plots
;************************************************
; wks = gsn_open_wks("ps" ,"object") ; ps,pdf,x11,ncgm,eps
wksa = gsn_open_wks("ps" ,"objects") ; ps,pdf,x11,ncgm,eps
; gsn_define_colormap(wks,"BlAqGrYeOrReVi200") ; select color map
gsn_define_colormap(wksa,"BlAqGrYeOrReVi200") ; select color map
;************************************************
; Use WRF_contributed procedure to set map resources
;************************************************
resa = True
resa_at_tiMainString = "objects"
resa_at_gsnMaximize = True
resa_at_gsnFrame = False
resa_at_gsnDraw = False
gsresa = True
gsresa_at_gsMarkerIndex = 16
cols = (/5,160,40/)
gsresa_at_gsMarkerColor = cols(0)
plot = gsn_csm_map(wksa,resa)
WRF_map_c(f,resa,0)
;************************************************
; Allocate array to store plots: specify time step
;************************************************
; plts = new ((/9/), "graphic") ; 1d array to hold plots
dot = new ((/9,500/), "graphic")
;************************************************
; loop over each forecast
;************************************************
n = 0
do nt=9,17
; plts(n) = gsn_csm_contour_map(wks,data(0,nt,:,:),res)
do in=0,index(0,nt)-1
dot(n,in) = gsn_add_polymarker(wksa,plot,cenf(1,nt,in),cenf(0,nt,in),gsresa)
end do
draw(wksa)
frame(wksa)
n = n + 1
end do
end
-- James Correia, Jr. PhD. Email: jimmyc @ iastate.edu Email: jimmyc42 @ gmail.com Web: http://bruce.agron.iastate.edu/jimmyc/ ********************************************* "Wisdom. Strength. Courage. Generosity. Each of us are born with one of these. We must find the other three inside of us." from "Into the West" _______________________________________________ ncl-talk mailing list ncl-talk_at_ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Wed Jan 02 2008 - 03:09:54 MST
This archive was generated by hypermail 2.2.0 : Thu Jan 03 2008 - 10:50:41 MST