looking for correct data type in RGB script

Post any questions, ideas, or topics related to Jython and Python scripting.
User avatar
hproe
Posts: 504
Joined: Sat Nov 27, 2010 3:46 pm

looking for correct data type in RGB script

Post by hproe »

I have scripts that retrieve and display sequence of RGBs and display them as a time series. The RGB formulas are equal/similar to those distributed with McV as a plugin. They all deliver individual RGBs through the function

Code: Select all

combineRGB(red,grn,blu)

The script accumulates the RGBs in the list

Code: Select all

imageSeq.append(image)

and finally creates a time series and displays it

Code: Select all

imageLoop=makeTimeSequence(imageSeq)
imLayer=imDisplay.createLayer('RGB Composite',imageLoop)

Now I have other RGB formulas that deliver the RGB with the alternative function

Code: Select all

combineRGB(red,grn,blu)

In this case there is a type conflict when the layer is created for a time series with greater than one RGB
visad.TypeException: FieldImpl.setSample: bad range type

Any idea what conversion(?) should be applied here.

cheers, HP
User avatar
bobc
Posts: 988
Joined: Mon Nov 15, 2010 5:57 pm

Re: looking for correct data type in RGB script

Post by bobc »

Hi HP -

I'm assuming that the function that is giving you the error message is mycombineRGB(). I'm replicating this error, and it comes when the RGB images are passed through makeTimeSequence(). After speaking with a programmer, I wrote up Inquiry 2282 because the makeTimeSequence() function shouldn't be necessary to create a loop of RGB images.

One thing to note though is that combineRGB() and mycombineRGB() look to return the same thing. If your reason for using mycombineRGB() was to make use of the 'RGB Composite' display type, you can actually use this display type with combineRGB() as well.

Here's a script that I'm running to get the "RGB Composite" display type working using the combineRGB() function:

Code: Select all

from visad.meteorology import ImageSequenceImpl as ISI

addeParms = dict(
    server = 'msg.ssec.wisc.edu',
    dataset = 'MSG',
    descriptor = 'FD',
    coordinateSystem = LATLON,
    location = (21,15),
    size = (600,600),
    unit = 'BRIT',
    time = ('10:00:00','14:00:00')
    )

dustLoop = []
for p in range (-5,0):
    b7 = loadADDEImage(band=7, position=p, **addeParms)
    b9 = loadADDEImage(band=9, position=p, **addeParms)
    b10 = loadADDEImage(band=10, position=p, **addeParms)
    dust = combineRGB(ISI([b7]), ISI([b9]), ISI([b10]))
    dustLoop.append(dust)

imgSeqDust = makeTimeSequence(dustLoop)
dustPanel = buildWindow(height=800,width=1400)
dustLayer = dustPanel[0].createLayer('RGB Composite', imgSeqDust)

Please let me know if you actually were seeing the error message with combineRGB(), and if you have any other questions.

Thanks -
Bob Carp
User avatar
hproe
Posts: 504
Joined: Sat Nov 27, 2010 3:46 pm

Re: looking for correct data type in RGB script

Post by hproe »

Hi Bob -

Thank you very much for your hidden hint. In fact, I want to have the 'RGB Composite' display type (for fine-tuning ranges and gammas of generic RGBs). I am not sure why (quite some time ago) in my formulas for generic RGBs I implemented the combination
A. mycombineRGB() / RGB Composite
and not
B. combineRGB()/ RGB Composite
One possibility could be that with version B I can only produce one RGB sequence (manually or with a script). Any tentative to run a second job in the same session blocks McV and I have to kill her via the task manager (version A does not suffer from this problem). With this caveat, combination B is working fine.

cheers, HP
User avatar
bobc
Posts: 988
Joined: Mon Nov 15, 2010 5:57 pm

Re: looking for correct data type in RGB script

Post by bobc »

Hi HP -

I'm trying to replicate your problem in "B" of your last post. Are you running a recent nightly?

Thanks -
Bob
User avatar
hproe
Posts: 504
Joined: Sat Nov 27, 2010 3:46 pm

Re: looking for correct data type in RGB script

Post by hproe »

Yes, I do. By a second job, I mean the same or a similiar one that retrieves and displays an RGB series, but not e.g. a script that saves the RGBs.

HP
User avatar
bobc
Posts: 988
Joined: Mon Nov 15, 2010 5:57 pm

Re: looking for correct data type in RGB script

Post by bobc »

Hi HP -

I'm running into a similar problem as you. I found that (with either single images or a loop) I could use the 'Three Color (RGB) Image' formula with the 'RGB Composite' display type only once per panel. If I try creating a second display in the same panel, then things kind of lock up. The display never completes and the status bar at the bottom of the Main Display says 'Creating Layers'. At this point, I found that I can hit the Stop sign in the Main Display, create a new tab, and use the 'RGB Composite' display type to create a loop in the new tab.

I did not run into this problem at all with the 'Three Color (RGB) Image (Auto-scale)' formula, where I could create multiple layers in the same panel using the 'RGB Composite' display type.

I wrote this up as Inquiry 2296.

You mentioned "Any tentative to run a second job in the same session blocks McV and I have to kill her via the task manager". Were you working with multiple tabs/panels when you saw the problem, or were you working within the same tab/panel?

Thanks -
Bob
User avatar
hproe
Posts: 504
Joined: Sat Nov 27, 2010 3:46 pm

Re: looking for correct data type in RGB script

Post by hproe »

Hi Bob -

I'm coming to this problem area.

1.Has there been any progress? Under a recent 1.7beta1 in Windows 10 and using combineRGB/RGB Composite, running a second job still blocks McV even when running it in a second display tab. McV has to be killed through the task manager and the results of the first job get lost.

2. Under the thread 'looking for correct data type in RGB script' you wrote:
I did not run into this problem at all with the 'Three Color (RGB) Image (Auto-scale)' formula, where I could create multiple layers in the same panel using the 'RGB Composite' display type.
I wrote this up as Inquiry 2296.

It seems that display type 'Three Color (RGB) Image (Auto-scale)' has disappeared in 1.7beta1, hasn't it?

cheers, HP
User avatar
jayh
Posts: 424
Joined: Thu Jan 15, 2009 10:34 pm

Re: looking for correct data type in RGB script

Post by jayh »

Hi HP-

1. The programming staff has not had a chance to look at this inquiry. Since this is crashing your -V sessions, I will move the priority up so it gets looked at sooner.

2. The 'Three Color (RGB) Image (Auto-scale)' is a formula, and is in the formula list, it's not a Display Type. This behavior should not have changed in the beta version. If you are seeing something different, let us know.

Thanks, Jay
User avatar
hproe
Posts: 504
Joined: Sat Nov 27, 2010 3:46 pm

Re: looking for correct data type in RGB script

Post by hproe »

Hi Jay -

1. Thanks for the promotion.
2. You are right. This is aka mycombineRGB, of course. I was confused.

cheers, HP
User avatar
hproe
Posts: 504
Joined: Sat Nov 27, 2010 3:46 pm

Re: looking for correct data type in RGB script

Post by hproe »

Hi -

After more than a year Inq. # 2296 appears still to be open. The problem continues to disturb me quite a bit, i.e. not being able to add multiple displays to the same panel when using the display type 'RGB Composite' (as opposed to using '3 Color (RGB) Image'). I am preferring 'RGB Composite' because Layer Controls let's you tune the RGBs by varying range and gamma of the colour beams. With '3 Color (RGB) Image' ranges and gammas cannot be accessed.

cheers, HP
Post Reply