I'm in the process of learning on how to remove clouds and cloud-shadows from Landsat images using GRASS. So far I was able to remove a lot of clouds from those images using i.landsat.acca
, but it seems like they still require a lot of refinements:
I followed the GRASS manual for i.landsat.acca
to obtain the image above: http://grass.osgeo.org/manuals/html70_user/i.landsat.acca.html.
Basically, the process is to run different Landsat band images for the same scene with i.landsat.toar
, and then processed with i.landsat.acca
to get the cloud areas. Then use the cloud area as a mask using r.mapcalc
:
r.mapcalc "MASK = if(isnull(clouds))"
Problem#1: the cloud edges is still visible. I need to increase the cloud-mask buffer to catch those renegade cloud edges.
Problem#2: the cloud-shadows is still visible. If I include the -s
flag to include a category for cloud-shadow when running i.landsat.acca
, a large amounts of shadow from the terrain will consequently be removed as well... So to catch the cloud-shadows, I believe I need to make a new mask for them - by offsetting the current cloud mask until they cover the cloud-shadow areas.
To achieve both objectives, I believe I need to modify and play with the r.mapcalc
command, but I can't figure out how to write it (due to my bad Math and my-even-worse programming skills)..
So, my ultimate question:
Question#1: How do I edit r.map.calc
to increase the mask area (let's say by a buffer of 10 units)?
Question#2: How do we offset a mask in r.map.calc
(in this case a little to the south-west direction)?
If I know the answer to both of these: I can combine both cloud-mask and cloud-shadow-mask, to get a relatively cloud-free image. Then it's a matter of overlaying it to images of the same scene of different dates.
I appreciate any help that I can get. Many thanks!
r.grow.distance
.. Can we use it to offset stuff around? What should I use as thedistance
parameter?