Zonalstats
- class eolab.georastertools.Zonalstats(stats: List[str], categorical: bool = False, valid_threshold: float = 0.0, area: bool = False, prefix: str | None = None, bands: List[int] = [1])[source]
Bases:
RastertoolRaster tool that computes zonal statistics of a raster product.
Attributes
Whether to compute the statistics multiplied by the pixel area
List of bands to process
Whether to compute the counts of every unique pixel values
Filename containing the categories when computing stats per categories in the geometries
Type of the category file, either 'raster' or 'vector'
Column name identifying categories in categroy_file (only if file format is geometries)
Dict with classes index as keys and names to display as values
Name of the chart file to generate
Whether to display the chart
The list of generated stats in the same order as the input files
The list of dates when they can be extracted from the input files' names
After processing one or several files, this method enables to retrieve a dictionary that contains the statistics for each inputfile's date:
The geometries where to compute zonal statistics
The column name identifying the name of the geometry
Whether intermediate VRT images shall be kept
Output format for the features stats
Path of the output directory where are stored the results
Prefix of the features stats (one per band)
Number of sigmas for identifying outliers
List of stats to compute
List of all possible output format are provided by fiona.supported_drivers.keys()
List of stats that can be computed.
Minimum percentage of valid pixels in a shape to compute its statistics
Dir where to store intermediate VRT images
Whether to compute stats for geometries within the raster (if False, stats for all geometries intersecting the raster are computed)
Methods
Zonalstats.__init__(stats[, categorical, ...])Constructor
Zonalstats.compute_stats(raster, bands, ...)Compute the statistics of the input data.
Zonalstats.postprocess_files(inputfiles, ...)Generate the chart if requested after computing stats for each input file
Zonalstats.process_file(inputfile)Compute the stats for a single input file
Zonalstats.process_files(inputfiles)Run the rastertool to a set of input files.
Zonalstats.with_chart([chart_file, ...])Set up the charting capability
Zonalstats.with_geometries(geometries[, within])Set up the geometries where to compute stats.
Zonalstats.with_outliers(sigma)Set up the computation of outliers
Zonalstats.with_output([outputdir, ...])Set up the output.
Zonalstats.with_per_category(category_file)Set up the zonal stats computation per categories
Zonalstats.with_vrt_stored(keep_vrt)Configure if the intermediate VRT images that are generated when handling the input files (which can be complex raster product composed of several band files) shall be stored to disk or not - for debug purpose for instance.