|
sgsPy
structurally guided sampling
|
#include <strat.h>
Public Member Functions | |
| OptimAllocationDataManager (raster::GDALRasterWrapper *p_raster, int bandNum, std::string allocation) | |
| ~OptimAllocationDataManager () | |
| void | init (int numStrata, int xBlockSize, int yBlockSize) |
| void | readNewBlock (int xBlockSize, int yBlockSize, int xBlock, int yBlock, int xValid, int yValid) |
| void | update (int index, int strata) |
| std::vector< double > | getAllocationPercentages (void) |
Public Attributes | |
| helper::RasterBandMetaData | band |
| std::vector< helper::Variance > | variances |
| bool | used = false |
This struct deals with the 'optim' allocation method. The optim allocation method requires that the within-strata variance be calculated based on a seperate raster band. This struct stores band information for the raster band which is used to calculate the variance, the variance per strata, as well as whether the optim method is used.
|
inline |
Constructor, creates an instance of OptimAllocationDataManager given a pointer to the raster containing the band to use, as well as the integer band number. The allocation method is also passed, and if the allocation is not 'optim', this struct remains unused.
| GDALRasterWrapper | *p_raster |
| int | bandNum |
| std::string | allocation |
|
inline |
Deconstructor, this method frees memory which would be allocated if this object was used.
|
inline |
This function gets the allocation percentages per strata using the variances. The optim allocation method is specified by Gregoire and Valentine https://doi.org/10.1201/9780203498880 Section 5.4.4. The method requires that the count and standard deviation of a particular strata be multiplied, and the proportion of samples to go to the particular strata strata is this product divided by the sum of the product of standard deviation and count for every strata.
The proportions are calculated using the vector of Variance calculations which have been updated throughout the iteration if the raster, and returned as a vector of double.
|
inline |
Initializes some of the data within the struct, setting the size of the vector which contains Variance information, as well as allocating the memory which will be used to store the raster band.
| int | numStrata |
| int | xBlockSize |
| int | yBlockSize |
|
inline |
This function reads a new block of data in from the raster band which this struct controls.
| int | xBlockSize |
| int | yBlockSize |
| int | xBlock |
| int | yBlock |
| int | xValid |
| int | yValid |
|
inline |
This function updates the Variance calculation for a particular pixel. The index of the pixel within the block is given, to get the pixel value. The strata is also given to indicate which strata's variance to update. This function should not be called if the pixel is nan.
| int | index |
| int | strata |
| helper::RasterBandMetaData sgs::strat::OptimAllocationDataManager::band |
| bool sgs::strat::OptimAllocationDataManager::used = false |
| std::vector<helper::Variance> sgs::strat::OptimAllocationDataManager::variances |