- static grdhisteq.equalize_grid(grid, *, outgrid=None, divisions=None, region=None, gaussian=None, quadratic=None, verbose=None)
Perform histogram equalization for a grid.
pygmt.grdhisteq.equalize_gridprovides a way to write a grid with statistics based on a cumulative distribution function. The
outgridhas 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.
Full option list at https://docs.generic-mapping-tools.org/latest/grdhisteq.html
outgrid (str or None) – The name of the output netCDF file with extension .nc to store the grid in.
divisions (int) – Set the number of divisions of the data range.
quadratic (bool) – Perform quadratic equalization [Default is linear].
Select verbosity level [Default is w], which modulates the messages written to stderr. Choose among 7 levels of verbosity:
q - Quiet, not even fatal error messages are produced
e - Error messages only
w - Warnings [Default]
t - Timings (report runtimes for time-intensive algorithms);
i - Informational messages (same as
c - Compatibility warnings
d - Debugging messages
ret (xarray.DataArray or None) – Return type depends on the
outgridis a str (grid output is stored in
>>> import pygmt >>> # Load a grid of @earth_relief_30m data, with an x-range of 10 to >>> # 30, and a y-range of 15 to 25 >>> grid = pygmt.datasets.load_earth_relief( ... resolution="30m", region=[10, 30, 15, 25] ... ) >>> # Create a new grid with a Gaussian data distribution >>> grid = pygmt.grdhisteq.equalize_grid(grid=grid, gaussian=True)
This method does a weighted histogram equalization for geographic grids to account for node area varying with latitude.