Re: arrays of graphics devices

From: <brownrig_at_nyahnyahspammersnyahnyah>
Date: Thu Jul 05 2012 - 09:31:09 MDT

Hi Doug,

I can't say for certain at the moment, but this would appear to be
either a bug or a rather curious scoping behavior. In trying to
duplicate this, I did:

   filenames = (/ "foo1", "foo2", "foo3" /)
   wks = new(3, "graphic" )
   do i=0,2
      wks(i) = gsn_open_wks("ps",filenames(i))
      gsn_define_colormap(wks(i),"BlueGreen14")
      gsn_draw_colormap(wks(i))
   end do

...which works. I modified the loop to look more like yours:

   do i=0,2
      foo = gsn_open_wks("ps",filenames(i))
      wks(i) = foo
      delete(foo)
      gsn_define_colormap(wks(i),"BlueGreen14")
      gsn_draw_colormap(wks(i))
   end do

...which also works. However, if I do this:

   do i=0,2
      wks(i) = gsn_open_wks("ps",filenames(i))
   end do
   do i=0,2
      gsn_define_colormap(wks(i),"BlueGreen14")
     gsn_draw_colormap(wks(i))
   end do

It fails.

We'll have to look into this more...

Rick

On Wed, 4 Jul 2012 09:50:17 +0000
  Douglas Lowe <Douglas.Lowe@manchester.ac.uk> wrote:
> Hi all,
>
> Is it possible to open graphics devices within an array, rather than
>as individual objects?
>
> We've attempted to use the code below to do this, but all that
>happens is that as one graphics object is added to the array the rest
>are closed.
>
> ------------------------------------------------------------------------------------------------------
>
> type = "ps"
> wks_array = new(nspc*2, "graphic") ; create workstation array
>
>
> do ispc = 0,nspc-1
> print("opening workstations "+2*ispc+" and "+(2*ispc+1))
> wks_temp1 = gsn_open_wks(type,savefile(2*ispc))
> wks_temp2 = gsn_open_wks(type,savefile(2*ispc+1))
>
> wks_array(2*ispc) = wks_temp1
> wks_array(2*ispc+1) = wks_temp2
> delete(wks_temp1)
> delete(wks_temp2)
> end do
>
> ------------------------------------------------------------------------------------------------------
>
> We're attempting to open the graphics objects in this way so that we
>can loop through our processing code
> (rather than have to duplicate everything 12 times). Does ncl
>support pointers? If so would it be possible for
> us to use those to do this instead?
>
> Thanks,
> Doug
> _______________________________________________
> 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 Jul 5 09:31:18 2012

This archive was generated by hypermail 2.1.8 : Mon Jul 09 2012 - 10:45:32 MDT