Fwd: workstation problem

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu Sep 08 2011 - 09:08:41 MDT

-------- Original Message --------
Subject: workstation problem
Date: Wed, 7 Sep 2011 17:32:23 -0700
From: Marjanovic, Nikola <marjanovic1@llnl.gov>

I am not sure if I found a bug in NCL version 6.0.0 or if this is
supposed to happen:

My problem is that I am trying to create 2 sets of figures in NCL that
are declared by 2 separate workstations at the same time. My code
involves a time loop, a file loop, and an interpolation loop. I declare
the workstation wkscnhrzcomp at the beginning of the time loop to panel
figures from different files per time. Then the file loop starts right
after and in it I declared a workstation (awkscnhrza) to panel different
elevations for a single file at one time. Right after that, the do loop
for the interpolation to elevations starts. I save the different
elevation interpolations in a graphic variable (over_id) for the
awkscnhrza workstation. There is then an if statement that executes only
for the lowest elevation and saves the graphic per file in the graphic
variable (comparisons) for the wkscnhrzcomp workstation.

The problem I figured out after a lot of debugging is that the data
stored in comparisons for workstation wkscnhrzcomp gets deleted once I
modify the awkscnhrza workstation by either deleting or overwriting it
in the loops. This results in a panel plot with messages that there is
no vector or contour data for wkscnhrzcomp. Is this normal or a bug? And
if it is normal why is it happening? I have pasted some of the relevant
code below and commented out the awkscnhrza parts to make wkscnhrzcomp
work (I labeled the places I was modifying awkscnhrza with PROBLEM ):

do j = timest, timend, (timeslint*timeint) ;;;;;;time interval set at top

wkscnhrzcomp =
gsn_open_wks(img,"ha"+case+"_"+elname(rank)+"_xy_contour_comparison_"+timess(j))

;;;;;making comparison

gsn_define_colormap(wkscnhrzcomp,"gui_default") ;;;;;;creating default
color scheme

comparisons = new(num_files,graphic) ;;;;;;for comparing cases

do i = 0, (num_files-1) ;;;;;;;;;looping through number of files

Ter = wrf_user_getvar(a[i],"ter",0) ;;;;;;extracts terrain heights for
this domain

mpresz = mpres ;;;;;;creating for comparison stuff

if (i .eq. 0) then ;;;;;;to match boundaries finest resln

lat2d = a[i]->XLAT ;;;;;;;;getting latitude and longitude for points of grid

lon2d = a[i]->XLONG

xst = lon2d(0,0,0) ;;;;;;point is to zoom in to finest domain

xnd = lon2d(0,(ydims(i)-1),(xdims(i)-1))

yst = lat2d(0,0,0)

ynd = lat2d(0,(ydims(i)-1),(xdims(i)-1))

delete(lat2d)

delete(lon2d)

xstz = 0i

xndz = xdims(i)-1

ystz = 0i

yndz = ydims(i)-1

else

locxx = wrf_user_ll_to_ij(a[i],(/xst,xnd/),(/yst,ynd/),True)
;;;;;;converting lat and lon points to x y point

xstz = locxx(0,0) - 1

xndz = locxx(0,1) - 1

ystz = locxx(1,0) - 1

yndz = locxx(1,1) - 1

mpresz@ZoomIn = True ;;;;;;set up map info for zoomed area

mpresz@Xstart = xstz ;;;;;;converting to x start

mpresz@Ystart = ystz ;;;;;;converting to y start

mpresz@Xend = xndz

mpresz@Yend = yndz

delete(locxx)

end if

if (zmhrz .eq. True) then ;;;;;;instructions to zoom

locxx = wrf_user_ll_to_ij(a[i],lons,lats,True) ;;;;;;converting lat and
lon points to x y point

x_start = locxx(0,0) - 1

x_end = locxx(0,1) - 1

y_start = locxx(1,0) - 1

y_end = locxx(1,1) - 1

mpres@ZoomIn = True ;;;;;;set up map info for zoomed area

mpres@Xstart = x_start ;;;;;;converting to x start

mpres@Ystart = y_start ;;;;;;converting to y start

mpres@Xend = x_end

mpres@Yend = y_end

delete(locxx)

end if

;awkscnhrza =
gsn_open_wks(img,"h"+case+"_"+elname(rank)+"_xy_contour_"+names(i+1)+"_"+timess(j))

;;;;named figure ;;;;figure gets deleted like wkscnhrzcomp which is
weird **************PROBLEM

;gsn_define_colormap(awkscnhrza,"gui_default") ;;;;;;creating default
color scheme

;if (dimsizes(lvlsint) .ne. 1) then

; over_id = new(4,graphic) ;;;;;;array of 4 graphics for paneling

;else

; over_id = new(1,graphic) ;;;;;;only 1 graphic

;end if

;counter = 0i ;;;;;;counter to count overlays

z = wrf_user_getvar(a[i],"z",j) ;;;;;;getting elevations

uvmet = wrf_user_getvar(a[i],"uvmet",j) ;;;;;;extracting velocity data

u_temp = uvmet(0,:,:,:) ;;;;;;splitting into x and y components

v_temp = uvmet(1,:,:,:)

delete(uvmet)

if ((rank .ne. 0)) then ;;;;;;;;if not equal to wind speed or to direction

Uu = wrf_user_getvar(a[i],vrble(rank),j) ;;;;;;;;getting other variable

end if

do k = 0, dimsizes(lvlsint)-1 ;;;;;;loop through 4 elevations from bottom

;rescnhrz@MainTitle = "HT:"+lvlsint(k)+" m" ;;;;;;title is elevation for
this figure

uu = wrf_user_intrp3d(u_temp,z,"h",lvlsint(k),0.,False)
;;;;;;;interpolating to a single height above ground

vv = wrf_user_intrp3d(v_temp,z,"h",lvlsint(k),0.,False)
;;;;;;;interpolating to a single height

if ((rank .eq. 0)) then

UU = (uu^2+vv^2)^0.5 ;;;;;;;;getting wind speed

else

UU = wrf_user_intrp3d(Uu,z,"h",lvlsint(k),0.,False)
;;;;;;;;interpolating the diagnostic

end if

if (zmhrz .eq. True) then

UUU = UU(y_start:y_end,x_start:x_end) ;;;;;;zooming in for U

ter = Ter(y_start:y_end,x_start:x_end) ;;;;;;zooming in for terrain

u = uu(y_start:y_end,x_start:x_end)

v = vv(y_start:y_end,x_start:x_end)

else

UUU = UU ;;;;;;no zooming in for U

ter = Ter ;;;;;;no zooming in for terrain

u = uu

v = vv

end if

rescnhrz@TimeLabel = timess(j) ;;;;;;;sets time label

;contour = wrf_contour(a[i], awkscnhrza, UUU, rescnhrz) ;;;;;;;makes
contour for U

;contour_2 = wrf_contour(a[i], awkscnhrza, ter, rester) ;;;;;;;makes
contour for terrain

;vectr = wrf_vector(a[i], awkscnhrza, u, v, resv) ;;;;;;;makes vector
plot for velocity

;over_id(counter) = wrf_map_overlays(a[i], awkscnhrza,
(/contour_2,contour,vectr/), pltres, mpres)

if (k .eq. 0) then ;;;;;;;for comparisons just get lowest height

pltresz = True

pltresz@PanelPlot = True

pltresz@NoTitles = True

pltresz@CommonTitle = False

;pltresz@FramePlot = False

rescnhrzz = rescnhrz

resterz = rester

resvz = resv

rescnhrzz@lbLabelBarOn = False ;;;;;;;turn off individual label bars

; rescnhrzz@mpShapeMode = "FreeAspect" ;;;;;;;frees aspect

; rescnhrzz@vpWidthF = 0.8

; rescnhrzz@vpHeightF = 0.4

; resterz@lbLabelBarOn = False ;;;;;;;turn off individual label bars

;resterz@mpShapeMode = "FreeAspect" ;;;;;;;frees aspect

;resterz@vpWidthF = 0.8

;resterz@vpHeightF = 0.4

;resvz@lbLabelBarOn = False ;;;;;;;turn off individual label bars

;resvz@mpShapeMode = "FreeAspect" ;;;;;;;frees aspect

;resvz@vpWidthF = 0.8

;resvz@vpHeightF = 0.4

rescnhrzz@tiYAxisString = "Latitude " + names(i+1)

resterz@tiYAxisString = "Latitude " + names(i+1)

resvz@tiYAxisString = "Latitude " + names(i+1)

print(ystz)

print(yndz)

print(i)

contourz = wrf_contour(a[i], wkscnhrzcomp, UU(ystz:yndz,xstz:xndz),
rescnhrzz) ;;;;;;;makes contour for U

contour_2z = wrf_contour(a[i], wkscnhrzcomp, Ter(ystz:yndz,xstz:xndz),
resterz) ;;;;;;;makes contour for terrain

vectrz = wrf_vector(a[i], wkscnhrzcomp, uu(ystz:yndz,xstz:xndz),
vv(ystz:yndz,xstz:xndz), resvz) ;;;;;;;makes vector plot for velocity

comparisons(i) = wrf_map_overlays(a[i], wkscnhrzcomp,
(/contour_2z,contourz,vectrz/), pltresz, mpresz)

delete(pltresz)

end if

delete(UU)

delete(uu)

delete(vv)

;counter = counter + 1 ;;;;;;;continuing counter

end do ;;;;;;;ending elevation loop

;if (dimsizes(lvlsint) .ne. 1)

; gsn_panel(awkscnhrza, over_id, (/2,2/), panres) ;;;;;;;;panelling if
needed

;else

; draw(over_id(0)) ;;;;;;;;draw the figure

; frame(awkscnhrza) ;;;;;;;;frame the figure

;end if

;delete(contour)

;delete(contour_2)

;delete(vectr)

;delete(awkscnhrza) ;;;;;;;;for some reason deleting this deletes the
contour values in comaparisons (PROBLEM)

delete(UUU)

delete(u)

delete(v)

delete(u_temp)

delete(v_temp)

delete(z)

;delete(over_id)

delete(ter)

;delete(counter)

if (rank .ne. 0) then

delete(Uu)

end if

delete(Ter)

delete(mpresz)

end do ;;;;;;;;ending file loop

resP = True

;resP@txString = "Common Title"

resP@gsnPanelLabelBar = True

gsn_panel(wkscnhrzcomp,comparisons,(/num_files,1/),resP)

delete(comparisons)

delete(wkscnhrzcomp)

delete(resP)

delete(contourz)

delete(contour_2z)

delete(vectrz)

end do

Thanks,

Nikola

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Sep 8 09:08:48 2011

This archive was generated by hypermail 2.1.8 : Mon Sep 12 2011 - 13:37:01 MDT