State-wide DRCM Processing

or: why big mosaics are cool

Be Careful with Both creation options and rios options


    controls = applier.ApplierControls()
    controls.setOutputDriverName('GTiff')
    options = ['COMPRESS=LZW', 'BIGTIFF=YES', 'TILED=YES', 
               'INTERLEAVE=BAND', 
               'BLOCKXSIZE=256', 'BLOCKYSIZE=256']
    controls.setCreationOptions(options)                                      
    controls.setWindowXsize(256)
    controls.setWindowYsize(256)
    
![Alt text](http://i.imgur.com/5vYgD9l.png "no. of seasons")
![Alt text](http://i.imgur.com/4n80Sui.png "no. of seasons") median no. of seasons is 92 (66,105). Maximum possible is 112.
See gdal_tutorial.html for examples of gdal and c.

    // assume all bands same size
    nXSize = GDALGetRasterBandXSize( fifthPercentileBand ); 
    nYSize = GDALGetRasterBandYSize( fifthPercentileBand ); 

    printf("allocation size: %lu\n",
          (unsigned long)nYSize* (unsigned long)nXSize*sizeof(uint8_t));
    
    // Allocate space
    pafScanline = (uint8_t *) CPLMalloc(nYSize*nXSize*sizeof(uint8_t));
    dixScanline = (uint8_t *) CPLMalloc(nYSize*nXSize*sizeof(uint8_t));
    refPixelScanline = (uint8_t *) CPLMalloc(nYSize*nXSize*sizeof(uint8_t));

    /* and read the whole thing in */
    GDALRasterIO(fifthPercentileBand , GF_Read, 0, 0, nXSize, nYSize,
		 pafScanline, nXSize, nYSize,  GDT_Byte,
		 0, 0 );
    GDALRasterIO(dixImageBand , GF_Read, 0, 0, nXSize, nYSize,
		 dixScanline, nXSize, nYSize,  GDT_Byte,
		 0, 0 );

    /* Create output */
    hDstDS = GDALCreate( hDriver, pszDstFilename, nXSize, nYSize, 1, GDT_Byte, 
                         papszOptions );
    destBand = GDALGetRasterBand( hDstDS, 1 );
    
[fullsize](http://i.imgur.com/UiFIO14.png) ![Alt text](http://i.imgur.com/UiFIO14.png "lowest 5th percentile")
[fullsize](http://i.imgur.com/nk5KeZl.png) ![Alt text](http://i.imgur.com/nk5KeZl.png "reference pixel")