Combination View Flat View Tree View
Threads [ Previous | Next ]
RE: band math gives bad result
toggle
band math gives bad result
band math
3/22/12 1:04 PM
hello,

I am trying to make a band math calculation by this formula
exp10(-0.29-0.708* log10(Rrs_488/ Rrs_547)+1.12* pow(log10(Rrs_488/ Rrs_547),2)) [1]

I use L2 MODIS file.

As a result I get a black image with only few grey pixels.. If is calculate the new band by only equation

-0.29-0.708* log10(Rrs_488/ Rrs_547)+1.12* pow(log10(Rrs_488/ Rrs_547),2) [2]

I get normal image result. But once i put it into () of exp10 (same with exp and pow functions) - i get this black one.
I checked the values of the image calculated by formula [2] - they are positive or negative in different areas.

I also tried to calculate the band by equation [2] and then use it's values in next calculations by exp10(new band) - but result is the same..

If take any pixel value from that range and calculate, for example, POWER(10,X) function in excel with that values on X - I get normal positive values.

Parts of formula works, but it all - not. What is wrong, what should I change? May be there are some limitations somewhere on writing expressions..?

Thank you very much
Evgenia
Flag Flag
RE: band math gives bad result
3/23/12 2:28 PM as a reply to Evgenia Gurova.
Dear Evgenia,

I only have a suspicion: is it possible that the result actually is OK, but merely the colour distribution is not, and therefore you see a black image? In the lower left corner of the VISAT window there is a tool called "Colour Manipulation". Have you tried auto-adjusting the colour distribution and then applying it?

You also could check the histogram if the values are in the expected range.

If this does not help and the values are indeed invalid, could you then create a subset of your input file and upload it somewhere, so I can test?

Thanks and best regards,
Thomas
Flag Flag
RE: band math gives bad result
3/23/12 2:50 PM as a reply to Thomas Storm.
Hello Thomas

Thanks you for your reply
I checked the result - yes, pixel info shows different positive values, you are right. But I did not find a way to make the normal image. In Color manipulation and also in histogram i don't see any data range, any tries of adjustment were unsuccessful.. The data range is mostly between 0 and 1 (by pixel info) - but..
I can upload the file - but i have no FTP, so...

Evgenia
Flag Flag
RE: band math gives bad result
3/23/12 3:44 PM as a reply to Evgenia Gurova.
Hi Evgenia,

"Evgenia Gurova":
The data range is mostly between 0 and 1 (by pixel info) - but..


so - is the data within the range you'd expect? In that case there is a display problem.

Or is the data in an invalid range? In that case the band maths are wrong indeed. However, I have checked using log10(x) within the band maths and could not find anything funny.

So if the values the band maths compute for your image are wrong, please write an e-mail to thomas.storm@brockmann-consult.de, and I will give you access to our FTP server where you can upload a subset of your product so I can investigate further.

Best regards,
Thomas
Flag Flag
RE: band math gives bad result
3/27/12 12:44 PM as a reply to Thomas Storm.
Hello Thomas

the values seem to be correct, and looks really like display problem.
But i still did not find a way to solve it..both histogram and color manipulation sections don't show any data..

Evgenia
Flag Flag
RE: band math gives bad result
3/28/12 5:00 PM as a reply to Evgenia Gurova.
Hi Evgenia,

OK, so I think you should upload a subset of your product so I can take a look at it. Please write an e-mail to thomas.storm@brockmann-consult.de, and I will give you access to our FTP server.

Best regards,
Thomas
Flag Flag
RE: band math gives bad result
3/30/12 1:24 PM as a reply to Thomas Storm.
Hi Evgenia,

ok, I had a look at the band computed by the equation you provided and I see what you mean.
Anyway, there is no error at all; only the colour manipulation does not handle the resulting ranges well, because there are some extreme outliers. If you 'mask out' these outliers, e.g. by creating an additional band by band maths, you will receive a perfectly valid picture.
I used the expression new_band_1 < 1 ? new_band_1 : NaN to replace every value greater than 1 by NaN. new_band_1 of course is the band computed by your expression.

I hope this helps.

Best regards,
Thomas
Flag Flag
RE: band math gives bad result
5/2/12 3:51 PM as a reply to Thomas Storm.
Hello Thomas

Thank you very much for your help. It works fine with GUI, but i would like to use it in GPF..

I have your expression:

exp10(-0.29-0.708* log10(Rrs_488/ Rrs_547)+1.12* pow(log10(Rrs_488/ Rrs_547),2)) <= 1 ? exp10(-0.29-0.708* log10(Rrs_488/ Rrs_547)+1.12* pow(log10(Rrs_488/ Rrs_547),2)) : NaN

How should I modify it for using in GPF xml-file.. I try to put it there, but it seems to be some syntactics problem which i can not recognize..editor also highlight it with red starting from "<= 1"...

Thank you very much in advance!
Flag Flag
RE: band math gives bad result
5/2/12 4:15 PM as a reply to Evgenia Gurova.
Dear Evgenia,

Evgenia Gurova:

How should I modify it for using in GPF xml-file.. I try to put it there, but it seems to be some syntactics problem which i can not recognize..editor also highlight it with red starting from "<= 1"...


You can't use "<" and ">" directly in an XML file. You have to write "&lt;" instead of "<" and "&gt;" instead of ">". Sorry for this inconvenience (I hate it as well). Alternatively, you can encode the entire expression as CDATA. For example:

1<maskExpr><![CDATA[
2reflec_6 >= 0.0 && reflec_6 <= 1.0
3]]></maskExpr>


See http://www.w3schools.com/xml/xml_cdata.asp

Best regards
Norman
Flag Flag
RE: band math gives bad result
5/2/12 4:40 PM as a reply to Norman Fomferra.
Thank you very much, Norman..

Could you have a look once again on this:

exp10(-0.29-0.708* log10(Rrs_488/ Rrs_547)+1.12* pow(log10(Rrs_488/ Rrs_547),2)) &lt; 1 ? exp10(-0.29-0.708* log10(Rrs_488/ Rrs_547)+1.12* pow(log10(Rrs_488/ Rrs_547),2)) : NaN

I changed < , but can see this in terminal:

FILE: 2002187.1055_A_MUMM_hkm_Balt_RePr2010.L2_LAC
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Error: Could not load mediaLib accelerator wrapper classes. Continuing in pure Java mode.
Occurs in: com.sun.media.jai.mlib.MediaLibAccessor
com.sun.media.jai.mlib.MediaLibLoadException

Error: Could not parse expression: CDOM_Kow


Anything else is wrong with expression, or there is any error regarding to GPF script preparation..??
Flag Flag
RE: band math gives bad result
5/16/12 12:05 PM as a reply to Evgenia Gurova.
Hi Evgenia,

Sorry for not catching up for so long. Do you still suffer from your problem? If so, please attach the XML file, there must be something wrong with the file format, since "CDOM_Kow" is not part of your expression.

Norman
Flag Flag
RE: band math gives bad result
5/17/12 9:56 AM as a reply to Norman Fomferra.
Hello Norman

Yes, i still need to solve the problem, and now you are just in time..
Please find attached xml..

Thank you in advance
Attachments: beam_MODIS_L2_with_CDOM_UTM.xml (12.0k)
Flag Flag
RE: band math gives bad result
Answer Answer (Unmark)
5/18/12 8:18 AM as a reply to Evgenia Gurova.
Hi Evgenia,

it seems you have confused the tags 'valid expression' and 'expression' in some cases.
The expression determines the target values of the band, and each band you reference in the expression must exist in the source product. This seems to be wrong for the target band 'CDOM_Kow', where you've entered the expression 'CDOM_Kow' -- which does presumably not exist in the source product, so the error is thrown. Please check the other target bands you've specified, too.
The valid expression determines the constraints the pixels have to fulfill if they are to be considered. You have done this right in some cases (e.g. 'not landMask' seems sensible for me), but in the 'CDOM_Kow' case I think you have entered the expression as valid expression.

Hope this helps,
best regards,
Thomas
Flag Flag
RE: band math gives bad result
5/28/12 1:20 PM as a reply to Thomas Storm.
Thank you, Thomas. Now everything is fine!
Flag Flag

 

Welcome to the BEAM Forum!

We encourage you to sign in our forum and participate in the BEAM community. The forum is maintained by the BEAM project team who will most likely answer your questions within 24 hours (except during common holidays) - if not done by other community members. Collaborate, share your knowledge and learn from other users!

If you don't find what you are looking for, please also consider the following external forums: