creating a formula for an RGB composite

Post any questions, ideas, or topics related to Jython and Python scripting.
Post Reply
User avatar
kbedka1
Posts: 428
Joined: Wed Jan 28, 2009 7:27 pm

creating a formula for an RGB composite

Post by kbedka1 »

I'm trying to create a formula for an RGB composite. I added the following to my Local Jython User's Library:

def AVHRR_DAYTIME_RGB(ch01,ch03,ch04):
red = rescale(ch01,0,1,0,255);
grn = rescale(ch03-ch04,0,50,0,255);
blu = rescale(ch04,320,220,0,255);
return combineRGB(red,grn,blu);

The formula I entered in the Formula Editor is AVHRR_DAYTIME_RGB(ch01,ch03,ch04)

When I select the formula, I am prompted for my ch01, ch03, and ch04 parameters. When I create display, I get a message in the bottom of my display window "image values must be mapped to Red, Green, or Blue only" and nothing displays on the map. What am I doing wrong here?
User avatar
tomw
Posts: 296
Joined: Tue Dec 23, 2008 3:40 pm

Re: creating a formula for an RGB composite

Post by tomw »

What "Display" type are you selecting? I believe you have to use "3 Color (RGB) Image"...
User avatar
kbedka1
Posts: 428
Joined: Wed Jan 28, 2009 7:27 pm

Re: creating a formula for an RGB composite

Post by kbedka1 »

aha, good call, I was using image display. When I use 3 Color (RGB) Image, it works. All is well! Thanks
Post Reply