Re: Fwd: workstation problem

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Sep 12 2011 - 11:44:31 MDT

Hi Nikola,

One important thing to note is that wrf_map_overlays will delete the contour and vector plots from your map if PanelPlot is not set to True.

I couldn't see where "pltres" was getting set, but I didn't see:

   pltres@PanelPlot = True

--Mary

On Sep 8, 2011, at 10:23 AM, Nikola Marjanovic wrote:

>
> I shortened the code below to make it easier to interpret.
>
> -Nikola
>
>>
>>
>> -------- 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
>
> ;awkscnhrza =
> gsn_open_wks(img,"h"+case+"_"+elname(rank)+"_xy_contour_"+names(i+1)+"_"+timess(j))
> ;;;;;;;;;;;;;;contour and vector data in wkscnhrzcomp get deleted here
> in loop (PROBLEM)
>
> ;gsn_define_colormap(awkscnhrza,"gui_default") ;;;;;;creating default
> color scheme
>
> ;over_id = new(4,graphic) ;;;;;;array of 4 graphics for paneling
>
> ;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)
>
> do k = 0, dimsizes(lvlsint)-1 ;;;;;;loop through 4 elevations from bottom
>
> 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
>
> UU = wrf_user_intrp3d(Uu,z,"h",lvlsint(k),0.,False)
> ;;;;;;;;interpolating the diagnostic
>
> UUU = UU ;;;;;;no zooming in for U
>
> ter = Ter ;;;;;;no zooming in for terrain
>
> u = uu
>
> v = vv
>
>
> ;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@tiYAxisString = "Latitude " + names(i+1)
>
> resterz@tiYAxisString = "Latitude " + names(i+1)
>
> resvz@tiYAxisString = "Latitude " + names(i+1)
>
> 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
>
> ; gsn_panel(awkscnhrza, over_id, (/2,2/), panres) ;;;;;;;;panelling if
> needed
>
> ;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)
>
> delete(Uu)
>
> 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
>>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Sep 12 11:44:38 2011

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