Re: Fwd: workstation problem

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Thu Sep 08 2011 - 11:30:32 MDT

Nikola,
If Adam's suggestions do not solve the problem for you, I would like to see if I can reproduce it here. There is a resource called gsnDebugWriteFileName (http://www.ncl.ucar.edu/Document/Graphics/Resources/gsn.shtml#gsnDebugWriteFileName) that could make it a bit easier. You set the resource at the beginning of your script and it saves just the needed data along with a new script and a resource file that should be runnable and hopefully will reproduce your issue. Try it and then send me the results. If they are large you may need to follow the instructions on the http://www.ncl.ucar.edu/report_bug.shtml page to upload the files. Thanks,
 -dave

On Sep 8, 2011, at 10:52 AM, Adam Phillips wrote:

> Hi Nikola,
> I've indented your code so that it is easier to debug. I've attached it here. One thing that I notice is that you are overwriting contour, contour_2, and vectr each time you go thru the k do loop, and before they are drawn in the panel plot. You are passing each of them thru wrf_map_overlays, but they get overwritten 3 times before you call gsn_panel. I have never tried this, but wonder if it isn't a good idea. Someone else will have to chime in on this. To solve it you would change contour from a (1,graphic) array to a (dimsizes(lvlsint),graphic) array...
>
> Otherwise I don't see anything else in your code that worries me. Again, someone else will have to look at this.
> Adam
>
> On 09/08/2011 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
>
> --
> ______________________________________________________________
> Adam Phillips asphilli@ucar.edu
> NCAR/Climate and Global Dynamics Division (303) 497-1726
> P.O. Box 3000
> Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli
> <test5.ncl>_______________________________________________
> 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 Thu Sep 8 11:30:41 2011

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