McIDAS-V Support Forums

Support and discussion of the McIDAS-V software package
Forum HomeMcIDAS-V Home
It is currently 13 Jul 2020, 01:18

All times are UTC




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: can't use captureImage
PostPosted: 12 Sep 2017, 11:40 
User avatar

Joined: 19 Jan 2009, 19:16
Posts: 1119
Hi HP,

I have looked at my commit notes and I never actually used writeImageAtIndex as a function. I wanted to add some of the captureImage formatting that was borrowed/brought over from the ISL, so I copied the writeImageAtIndex function and added the extra details of colorbar, labeling, etc. In my first commit, I have a comment about how nextStep is failing randomly. In creating the animation for the GOES-16 sectors (https://www.youtube.com/watch?v=m1_XfLFeY840), I never tried to use a time driver via a script. This may have helped.

My commit message (perhaps a bit muddled and not super helpful for the MUG programmers) is

Quote:
Version which does most of the work to display a fd, conus and meso together, with M1 and M2 sectors. (Known BUGS) - FD is not looping, even though there are three different images in FD data object and array - animation next step fails, nearly randomly. While the time moves ahead, the image sometimes doesn't and vice versa perhaps this can be fixed by using a index in steps and making sure that we begin at index one.


Joleen


Top
 Profile  
 
 Post subject: Re: can't use captureImage
PostPosted: 12 Sep 2017, 17:25 
User avatar

Joined: 15 Nov 2010, 17:57
Posts: 910
Hi Joleen -

Thanks for your script with takeStepForward(). I'm replicating what you are seeing, but only if I include captureImage in the loop. I cut things down a bit, and if I run the loop with takeStepForward without captureImage, then things work fine:
Code:
for x in range(steps):
    idx = anim.getCurrent()
    time.sleep(4)
    anim.takeStepForward()

This steps through the animation, and I can go back to the Main Display and get the animation to play through the time animation widget. If I add a captureImage command before time.sleep(4), then things break where the image no longer updates through the time animation widget.

From my tests thus far, I'm thinking that this is related to the other captureImage issues going on, rather than being an issue with takeStepForward(). Do you agree with this, or have you seen issues without using captureImage in your scripts?

I'll respond to this forum when there are any updates on the status of captureImage.

Thanks -
Bob


Top
 Profile  
 
 Post subject: Re: can't use captureImage
PostPosted: 12 Sep 2017, 17:39 
User avatar

Joined: 19 Jan 2009, 19:16
Posts: 1119
Hi Bob,

I can't say that I have tried to use takeStepForward without capturing and image. Thank-you for digging deeper on this. Your finding is very interesting. If you use writeImage, do you have a problem with takeStepForward?

Joleen


Top
 Profile  
 
 Post subject: Re: can't use captureImage
PostPosted: 12 Sep 2017, 17:58 
User avatar

Joined: 15 Nov 2010, 17:57
Posts: 910
Hi Joleen -

writeImage looks to be working fine. For example, in yesterday's nightly, I ran:
Code:
imageDir = 'C:/Users/rcarp/anim/'
for x in range(steps):
    idx = anim.getCurrent()
    activeDisplay().writeImage(imageDir+'writeImage_frame_'+str(x)+'.gif')
    time.sleep(4)
    anim.takeStepForward()

All of the images were captured correctly (image and layer labels) and the time animation widget works to play the loop in the Main Display after running the script. If I substitute writeImage with captureImage then the problem appears.

I'll add this information to the inquiry.

Thanks again!
Bob


Top
 Profile  
 
 Post subject: Re: can't use captureImage
PostPosted: 18 Sep 2017, 15:32 
User avatar

Joined: 19 Jan 2009, 19:16
Posts: 1119
Just a request, could you make index=0 the default so that it is backwards compatible with old scripts?

Thanks,
Joleen


Top
 Profile  
 
 Post subject: Re: can't use captureImage
PostPosted: 18 Sep 2017, 16:58 
User avatar

Joined: 15 Nov 2010, 17:57
Posts: 910
Thanks for the request, Joleen. I added it to the inquiry. We will discuss this and I'll let you know the final verdict.

Thanks again -
Bob


Top
 Profile  
 
 Post subject: Re: can't use captureImage
PostPosted: 01 Mar 2019, 17:20 
User avatar

Joined: 19 Jan 2009, 19:16
Posts: 1119
Hi,

February 25, 2019 build version 1.9 beta1, it seems the index=0 is no longer the default, instead it is index=''. My scripts are failing. Was this an intentional change? Or, is it possible something got mixed up in one of my xml files? When I tried using tempuserpath, a strange thing happened as well, McV started interactively rather than running the script.

Thanks,
Joleen


Top
 Profile  
 
 Post subject: Re: can't use captureImage
PostPosted: 01 Mar 2019, 17:52 
User avatar

Joined: 19 Jan 2009, 19:16
Posts: 1119
Hi Jay,

I reverted back to a February 11, 2019 build and my scripts work, but -tempuserpath does not work as expected.


This is the more complicated script that I am testing (I am pretty sure it is Bob's test script)

Attachment:
rgb_and_locs.py [772 Bytes]
Downloaded 127 times


Code:
import os
# save an image to $HOME/check
home_directory = os.path.expanduser('~')
image_path = os.path.join(home_directory,'check')

# max the size of the image
panel=buildWindow(height=2160,width=3840)

m1Parms = dict(
    server = 'lead.unidata.ucar.edu',
    dataset = 'RTGOESR',
    descriptor = 'M1',
    size = (500,500),
    position = -1,
    )

# get data with params defined above
vis = loadADDEImage(band=2, mag=(-4,-4), unit='ALB', **m1Parms)
ir = loadADDEImage(band=13, mag=(1,1), unit='TEMP', **m1Parms)

sandData = sandwich(ir,vis)

visLayer = panel[0].createLayer('Image Display', vis)
sandLayer = panel[0].createLayer('RGB Composite', sandData)

final_image_name = os.path.join(image_path, "test_McV_Meso1.png")
panel[0].captureImage(final_image_name)



and this is the simple script (really silly), called hw.py

Code:
print ("Hello World!")


Top
 Profile  
 
 Post subject: Re: can't use captureImage
PostPosted: 01 Mar 2019, 18:46 
User avatar

Joined: 15 Jan 2009, 22:34
Posts: 408
Hi Joleen- I checked 1.8 and today's nightly (March 1) and was seeing the same behavior with your rgb_and_locs.py script in both versions. Here is what I'm seeing when running 3 different commands to run the script in the background:

1. ./runMcV -script /Users/jayh/rgb_and_locs.py -> Works correctly

2. ./runMcV -userpath /Users/jayh/aaaaaa -script /Users/jayh/rgb_and_locs.py -> This creates and uses the new directory for the user path, however, the script is NOT executed and there is a error in the log file:
Error running jython script:/Users/jayh/rgb_and_locs.py
java.lang.NullPointerException

3. ./runMcV -tempuserpath -script /Users/jayh/rgb_and_locs.py -> This starts a foreground session and doesn't run the script at all

Bob checked Windows as well, and was seeing different issues with -tempuserpath and these will all be documented for evaluation in inquiry 2778.

Let me know if installing today's nightly fixes the issues you had with the Feb 25th install and executing rgb_and_locs.py script.

Thanks, Jay


Last edited by jayh on 04 Mar 2019, 23:08, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: can't use captureImage
PostPosted: 04 Mar 2019, 18:39 
User avatar

Joined: 19 Jan 2009, 19:16
Posts: 1119
Hi Jay,

I downloaded Build-date: 2019-03-04 10:30 Version 1.9 beta 1 nightly for mac osx.

1.) ~/runMcV -script /Users/joleenf/rgb_and_locs.py -> fails with a null pointer exception

2.) ~/runMcV -tempuserpath -script /Users/joleenf/rgb_and_locs.py --> starts a foreground session and does try to run the script, but that fails with a null pointer exception found within the mcidasv.log of the temporary log directory created by tempuserpath.

3.) Running rgb_and_locs.py in jython shell works both with and without index=0

Joleen


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group