Math Expression
Math Expression
Hi there,
I have an issue using Math Band tool. I am trying to calculate the mean of Rrs_555 bands (MODIS Aqua). I could not find a function of mean to automatically calculate these bands. Also, I could not find informative documents in the help links regarding to my point.
Anyway, I tried to calculate the mean of these bands. First, I re-project the images. Second, I add Rrs_555 bands in a time series analysis file so that I can mathematically deal with them together. Then, I used the Math Band tool to calculate the mean of Rrs_555 as following:
(Rrs_555(1) + Rrs_555(2) + Rrs_555(3) + Rrs_555(n)) / n
The problem is that pixels with NaN values in a band cancel all valid pixels in the other bands that sharing the same ___location of NaN pixels. For instance, the mean of Rrs_555 at ___location(i,j) would be NaN if only one of the images used to calculate the mean has a NaN value in that ___location (i.e., ___location(i,j)). This is totally understandable since NaN values can not be computed with valid values. The question is how can I overcome this problem?
Regards,
Mohammad Alsahli
I have an issue using Math Band tool. I am trying to calculate the mean of Rrs_555 bands (MODIS Aqua). I could not find a function of mean to automatically calculate these bands. Also, I could not find informative documents in the help links regarding to my point.
Anyway, I tried to calculate the mean of these bands. First, I re-project the images. Second, I add Rrs_555 bands in a time series analysis file so that I can mathematically deal with them together. Then, I used the Math Band tool to calculate the mean of Rrs_555 as following:
(Rrs_555(1) + Rrs_555(2) + Rrs_555(3) + Rrs_555(n)) / n
The problem is that pixels with NaN values in a band cancel all valid pixels in the other bands that sharing the same ___location of NaN pixels. For instance, the mean of Rrs_555 at ___location(i,j) would be NaN if only one of the images used to calculate the mean has a NaN value in that ___location (i.e., ___location(i,j)). This is totally understandable since NaN values can not be computed with valid values. The question is how can I overcome this problem?
Regards,
Mohammad Alsahli
Filters:
-
- Subject Matter Expert
- Posts: 306
- Joined: Mon Apr 07, 2008 4:40 pm America/New_York
- Been thanked: 3 times
Math Expression
To achieve this use the Mosaic Tool on the reprojected files and skip the time series and band math part.
Also using the OCSSW processors (l2bin and l3mapgen) is another approach.
The Math Band equation to do what you want would be quite complex with nested if statements because your divisor (n) would be dependent upon how many non NaN pixels are there for each individual pixel. You would also need to override the valid pixel expression (right click on the band and view Properties). Math Band is not the way to go for what you are doing.
Danny
Also using the OCSSW processors (l2bin and l3mapgen) is another approach.
The Math Band equation to do what you want would be quite complex with nested if statements because your divisor (n) would be dependent upon how many non NaN pixels are there for each individual pixel. You would also need to override the valid pixel expression (right click on the band and view Properties). Math Band is not the way to go for what you are doing.
Danny
Math Expression
Danny,
I used Mosaic tool. I got two bands. One is the Rrs_555, and the other is Rrs_555_count. Is the first band the sum of mosaic bands or the average?
Another question! Can I mosaic L2 images directly or I have to reproject them first?
Many thanks,
Mohammad
I used Mosaic tool. I got two bands. One is the Rrs_555, and the other is Rrs_555_count. Is the first band the sum of mosaic bands or the average?
Another question! Can I mosaic L2 images directly or I have to reproject them first?
Many thanks,
Mohammad
-
- Subject Matter Expert
- Posts: 306
- Joined: Mon Apr 07, 2008 4:40 pm America/New_York
- Been thanked: 3 times
Math Expression
Hi Mohammad, I was out of the office.
Regarding the Mosaic Tool, the band "Rrs_555" is the mean and the band "Rrs_555_count" is the number of values which went into creating the mean.
The Mosaic tool is not optimized for direct processing of level-2 files and is intended to be used on mapped files (level2 files are not mapped files). The Mosaic tool should actually work on a few level-2 files, perhaps more, but I can't make any promises on this tool regarding direct use of level2 files.
Your best options for aggregating level2 files with SeaDAS are:
1. OCSSW: l2bin followed by l3mapgen
2. Level-3 Binning Tool (ultimately produces a geographic lat/lon projected file)
3. Reproject Tool (on each source level2 file) followed by Mosaic Tool
For options 1 and 2, if you are wanting another projection besides geographic lat/lon (plate carrée) then follow this up with the Reproject Tool. If you are using option 3 then I would suggest doing this via GPT (see Help > Cookbooks > GPT Cookbook)
Danny
Regarding the Mosaic Tool, the band "Rrs_555" is the mean and the band "Rrs_555_count" is the number of values which went into creating the mean.
The Mosaic tool is not optimized for direct processing of level-2 files and is intended to be used on mapped files (level2 files are not mapped files). The Mosaic tool should actually work on a few level-2 files, perhaps more, but I can't make any promises on this tool regarding direct use of level2 files.
Your best options for aggregating level2 files with SeaDAS are:
1. OCSSW: l2bin followed by l3mapgen
2. Level-3 Binning Tool (ultimately produces a geographic lat/lon projected file)
3. Reproject Tool (on each source level2 file) followed by Mosaic Tool
For options 1 and 2, if you are wanting another projection besides geographic lat/lon (plate carrée) then follow this up with the Reproject Tool. If you are using option 3 then I would suggest doing this via GPT (see Help > Cookbooks > GPT Cookbook)
Danny