Page 1 of 3

can't use captureImage

Posted: Fri Sep 08, 2017 6:44 pm
by joleenf
Screen Shot 2017-09-08 at 1.39.15 PM.png


I updated to Version 1.7beta1 2017-09-07, and there seems to be a problem with captureImage. This error message is a variation on a theme. When I load an image, I get a ValueError as well without the no time step warning.

Screen Shot 2017-09-08 at 1.57.03 PM.png


Thanks,
Joleen

Re: can't use captureImage

Posted: Fri Sep 08, 2017 6:59 pm
by bobc
Hi Joleen -

This is related to Inquiry 2176, which is in programmer iteration. The objective of this inquiry is to improve captureImage so it will capture the image that you are looking at, instead of just the first frame in a loop. The way that this will work is an index= keyword which will be added to captureImage. So, you could do something like index=5, which would capture an image of the 5th frame in the loop. This work has yet to be competed. However, for now, you can just tack "index=0" to your captureImage commands and things should work like they have in the past. So your captureImage command would be:

Code: Select all

activeDisplay().captureImage('/Users/joleenf/test/test.png', index=0)

If this doesn't work, or if you have any questions, please let me know. I'll update you when there is progress on this inquiry.

Thanks -
Bob Carp

Re: can't use captureImage

Posted: Fri Sep 08, 2017 9:44 pm
by Jon
Hi Joleen,

Sorry about that. I believe the problem has been fixed with my latest commit, though Bob hasn't taken a crack at it yet!

Re: can't use captureImage

Posted: Mon Sep 11, 2017 4:27 pm
by bobc
Hi Joleen and Jon -

Just a heads up that there are still problems with captureImage(). I put the inquiry back in programmer iteration.

Thanks -
Bob

Re: can't use captureImage

Posted: Mon Sep 11, 2017 5:45 pm
by joleenf
Thanks for the heads-up. I have been using the captureImage fairly generically and have not run into any issues yet.

Joleen

Re: can't use captureImage

Posted: Mon Sep 11, 2017 6:04 pm
by bobc
Hi Joleen -

Just on the chance that we are doing something differently, here's what I'm doing to cause an issue:

  1. Through a script, create a loop of 10 GOES-16 CONUS images.
  2. Play through the loop in the display and things look fine.
  3. Run a captureImage command from the Jython Shell.
  4. The image is captured, but if I play through the loop in the Main Display, the images don't change but the layer labels do.

I almost missed this at first since I was checking the layer label times in my image captures and not looking at the actual images themselves.

- Bob

Re: can't use captureImage

Posted: Mon Sep 11, 2017 9:19 pm
by joleenf
Hi Bob,

At this point, I am displaying image by image (removing layers between times) and saving a single image at a time with index=0. However, the behavior you describe was similar to a problem I had when trying to use a nextStep() or takeStepForward(). I only have the remnants of the code around, I decided to use the single image, capture, clear the panel, display the next image approach. Here is the snippet I still have in my code. I have not used the following code since early January of this year.

Joleen

Code: Select all

fname_template = '{}{}-{:04d}.jpg'

anim = panel[0].getAnimation()
times = anim.getTimes()
steps = anim.getNumSteps()

label='Full Disk ({} um)     CONUS ({} um)     Meso ({} um)'.format((fd[0]['satband-band-label'].split())[0],
           (conus[0]['satband-band-label'].split())[0],(meso1[0]['satband-band-label'].split())[0])

for x in range(steps):
    idx = anim.getCurrent()

    fname = fname_template.format(fdFileH,parms['day'],idx)
    timestep = str(times[x+1])

    formatStuff=[Matte(
                 background='black',
                 top=90,
                 ),
         TextOverlay(
                 text=label,
                 place="UM,0,30",
                 anchor="UM",
                 fontSize="24",
                 color="yellow",
                 ),
         TextOverlay(
                 text=str(timestep),
                 place="UM,0,60",
                 anchor="UM",
                 fontSize="24",
                 color="yellow",
                 ),
              ]


    #print 'idx=%s timestep=%s fname=%s' % (idx, timestep, fname)
    panel[0].captureImage(filename=fname, formatting=formatStuff)
    if (maxidx < idx):
       maxidx=idx
    anim.takeStepForward()



Re: can't use captureImage

Posted: Tue Sep 12, 2017 6:19 am
by hproe
Joleen and Bob -

Why aren't you using writeImageAtIndex(filename,index,...) instead of captureImage?

HP

Re: can't use captureImage

Posted: Tue Sep 12, 2017 10:09 am
by joleenf
Hi HP,

At the time, I was struggling to get writeImageAtIndex to work consistently as well. I would have to check for the old versions in a repository so that I can rerun to remind myself what was happening.

Joleen

Re: can't use captureImage

Posted: Tue Sep 12, 2017 11:34 am
by hproe
Hi Joleen -

I have uploaded to the SSEC server (im Sequence_save.py) my method for saving image sequences that uses writeImageAtIndex(). Maybe you can make use of it. I never had problems with this code, although I do not know how it would behave in most recent nightlies. In these days, I have to run a nightly from early June, due to a different problem.

HP