OVERVIEW
BACKGROUND
REQUIREMENTS
USER GUIDE
   cloudmask.py
   shadowmask.py
   spotCASM.py
DOWNLOAD
LICENSE
T-SHIRT

spotCASM.py

Method

Firstly, cloud marker pixels are identified using an image-specific threshold defined in green-midinfrared space. Segments for possible cloud objects are then grown using the watershed transform. Secondly, possible cloud-shadows are identified by projecting the possible cloud objects away from the sun, and defining local thresholds, assuming that all clouds within a SPOT image will be at a similar height. Thirdly, the cloud and shadow objects are compared, and only those that are of a similar size are kept in the final mask images.

Modes

The program has two modes, which can be used in sequence.

  1. Use auto mode to generate masks, shapefiles of marker points, and blank polygon shapefiles in case they are needed.
  2. Edit the point shapefiles to reduce errors, and rerun the program in manual mode.
  3. Edit the polygon shapefiles to reduce errors, and rerun the program in manual mode.

Limitations

The program has some limitations:

  1. It can be quite slow, taking up to two hours to complete a single image.
  2. It requires a lot of memory. For example a 365 MB image required 5.7 GB of RAM.

Examples

To run in auto mode on an image called test.img:

spotCASM.py -i test.img -m auto -d -v

This will produce output called test_cloudmask.img, test_shadowmask.img, test_cloudpoints.shp, test_shadowpoints.shp, test_cloudpolys.shp and test_shadowpolys.shp.

If the qvf and history modules are installed (written by JRSRP) you can use standard names:

spotCASM.py -i s5hgre_49353489_20081109_bbfm5.img -m auto -s

Help

Usage: spotCASM.py [options]
        
Options:
-h, --help
Show this help message and exit
        
-i, --image <string>
REQUIRED. Cloudy image in any GDAL format, as either unsigned 8 or 16
bit integer.

-m, --mode <auto|manual>
REQUIRED. The mode to operate in.
        
-s, --standard
Use standard JRSRP filenames.

-d, --default
Use default filenames.

-v, --make-vectors
Make vector shapefiles.

--metafile <string>
Metadata file that contains the sun and sensor aquisition angles
(dim format).

--format <string>
GDAL format for output images (default=HFA). 

--cloudmask <string>
Binary cloud mask image to be produced.

--shadowmask <string>
Binary cloud-shadow mask image to be produced.

--cloudpoints <string>
Point shapefile marking clouds.

--shadowpoints <string>
Point shapefile marking shadows.

--cloudpolys <string>
Polygon shapefile outlining clouds.

--shadowpolys <string>
Polygon shapefile outlining shadows.

-b, --buff <int>
The number of additional pixels used to buffer the cloud mask image
(default=5).