Hi all,
I posted some at the start of this project at A Windows Story thread.
viewtopic.php?p=10343#p10343I decided that this was a bad approach and came up with a different plan.
I wrote a couple of programs that use the quality and state bands from the MOD09 files. One masks clouds, deep/moderate ocean, and high or moderate aerosol quantity. The other masks all pixels with less than highest quality.
The output from these programs are 8 bit files that are read by another program that combines the 2 and creates a mask.
Then bands 1, 3, and 4 are combined into a rgb image using the mask.
I then use gdalwarp to project the from sinusoidal to geographic wgs84.
The biggest problem is after masking, a lot of files are needed from a single area to fill in all missing data.
I used files from 6 different 8 day composites in the following example to try and mosaic Hawaii and there is still missing data.
Two files are involved. A file from grid h03v06 and a file from h03v07. The h stands for horizontal position and v for vertical. Each file is approximately 50 to 60 mb.
That will probably make it impossible to do the tropics or other cloudy areas because of

.
I'll probably have to use a BMNG map as a base.
Here a couple of the images produced and the result after adding data to the base. There are 4 more.The base started with a file equal to all zeros.
Attachment:
File comment: Intermediate file
500m-rgb2.jpg [ 26.61 KiB | Viewed 3922 times ]
Attachment:
File comment: Intermediate file
500m-rgb3.jpg [ 28.24 KiB | Viewed 3922 times ]
Attachment:
File comment: Result after processing 6 files
500m-rgb.jpg [ 30.16 KiB | Viewed 3922 times ]
The real goal of this project is to create a 250 meter resolution map. The green and blue channels are 500 meter. Only band 1, the red channel, is 250. If I read the 500 meter bands 1, 3, 4 and see which is greater, band 1 or 3 | band 1 or 4, then subtract the lesser from the greater, will it be better than simply scaling the green and blue up to 250 meter? (Scale up from 2400x2400 to 4800x4800.) This is rather easy but.........
This is what I plan to try but I'm not sure if it would produce a better result.
Code:
if band 1 is greater than band 3, then w = band1-500m - band3-500m, else x = band3-500m - band1-500m
if band 1 is greater than band 4, then y = band1-500m - band 4-500m else z = band4-500m - band1-500m
read band1-250m
output pixel1 = band1-250m[1], band3-500m[1], band4-500m[1]
output pixel2 = band1-250m[2], band3-500m[2] = band3-500m[1] + w or band3-500m[2] = band3-500m[1] - x, band4-500m[2] = band4-500m[1] + y or band4-500m[1] - z
.........
cartrite