Re: Fwd: workstation problem

From: Nikola Marjanovic <nikola_marjanovic_at_nyahnyahspammersnyahnyah>
Date: Thu Sep 08 2011 - 10:23:30 MDT

I shortened the code below to make it easier to interpret.


> -------- Original Message --------
> Subject: workstation problem
> Date: Wed, 7 Sep 2011 17:32:23 -0700
> From: Marjanovic, Nikola <>
> 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 =

 ;;;;;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 =
  ;;;;;;;;;;;;;;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,:,:,:)


  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)


 end if




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

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

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




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













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

 resP = True

 ;resP@txString = "Common Title"

 resP@gsnPanelLabelBar = True








 end do
> Thanks,
> Nikola
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:

ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Thu Sep 8 10:23:38 2011

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