pygmt.grdhisteq

class pygmt.grdhisteq[source]

Perform histogram equalization for a grid.

Two common use cases of pygmt.grdhisteq are to find data values that divide a grid into patches of equal area (pygmt.grdhisteq.compute_bins) or to write a grid with statistics based on some kind of cumulative distribution function (pygmt.grdhisteq.equalize_grid).

Histogram equalization provides a way to highlight data that has most values clustered in a small portion of the dynamic range, such as a grid of flat topography with a mountain in the middle. Ordinary gray shading of this grid (using pygmt.Figure.grdimage or pygmt.Figure.grdview) with a linear mapping from topography to graytone will result in most of the image being very dark gray, with the mountain being almost white. pygmt.grdhisteq.compute_bins can provide a list of data values that divide the data range into divisions which have an equal area in the image [Default is 16 if divisions is not set]. The pandas.DataFrame or ASCII file output can be used to make a colormap with pygmt.makecpt and an image with pygmt.Figure.grdimage that has all levels of gray occurring equally.

pygmt.grdhisteq.equalize_grid provides a way to write a grid with statistics based on a cumulative distribution function. In this application, the outgrid has relative highs and lows in the same (x,y) locations as the grid, but the values are changed to reflect their place in the cumulative distribution.

Methods Summary

grdhisteq.compute_bins(grid[, output_type, ...])

Perform histogram equalization for a grid.

grdhisteq.equalize_grid(grid[, outgrid])

Perform histogram equalization for a grid.