Repository navigation
Closed
Labels
feature requestNew feature wanted
Description
This issue serves as the central place for discussing and tracking the implementation of the pygmt.grdhisteq class in PyGMT. The issue will be closed when the initial implementation is complete. Progress is tracked at PyGMT: Wrapping GMT modules.
Documentation
- GMT: https://docs.generic-mapping-tools.org/dev/grdhisteq.html
- GMT.jl: https://www.generic-mapping-tools.org/GMTjl_doc/documentation/modules/grdhisteq
- PyGMT: https://www.pygmt.org/dev/api/generated/pygmt.grdhisteq.html
GMT Option Flags and Modifiers
☑️: Implemented; ⬜: To be implemented/discussed; Strikethrough: Won't implement.
- ☑️
-C(divisions): Set the number of divisions of the data range [Default is 16]. - ☑️
-D[file]: Dump the equalization table to a file or stdout (grdhisteq.compute_bins). - ☑️
-G(outgrid): Output grid file name (grdhisteq.equalize_grid). - ☑️
-N(gaussian): Produce an output grid with standard normal scores; optionally force scores into ±norm range. - ☑️
-Q(quadratic): Perform quadratic equalization [Default is linear]. - ☑️
-R(region): Restrict equalization to a sub-region. - ☑️
-V(verbose): Verbosity level. : Use-X/-YFigure.shift_origininstead.- ⬜
-f(coltypes): Column data types for table output fromgrdhisteq.compute_bins. - ☑️
-h(header): Write header record to ASCII output fromgrdhisteq.compute_bins(only valid whenoutput_type="file"). : Use--PAR=valuepygmt.configinstead.
Notes on Input Formats
grid: Accepts a file path orxarray.DataArraygrid as input for both methods.grdhisteq.equalize_grid: Returns anxarray.DataArrayifoutgridisNone; otherwise returnsNoneand writes the grid to disk.grdhisteq.compute_bins: Returns apandas.DataFrameornumpy.ndarray(controlled byoutput_type); returnsNoneifoutfileis set.- The
gaussianparameter (-N) is only valid forgrdhisteq.equalize_gridand has no effect forgrdhisteq.compute_bins. - Both methods perform weighted histogram equalization for geographic grids to account for node area varying with latitude.
- The
-hheader parameter forcompute_binsis only allowed whenoutput_type="file"; aGMTParameterErroris raised otherwise.
Linked Pull Requests
- Initial feature implementation – Wrap grdhisteq #1433
- Inline docstring examples added in Wrap grdhisteq #1433
- Implement
-f(column data types) option forcompute_binstable output - Add a gallery or tutorial example (e.g., applying histogram equalization to Earth relief data to produce a perceptually uniform colormap, comparing
equalize_gridoutput with the original relief)
Related Issues and Discussions
grdhisteq.compute_binsoutput can be fed directly intopygmt.makecptto create a colormap where each color interval covers an equal area of the grid, which is particularly effective for datasets with skewed distributions (e.g., bathymetry, gravity anomalies).grdhisteq.equalize_gridwithgaussian=Trueis useful as a pre-processing step before applying statistical tests that assume normally distributed data.- The class-based design (
grdhisteq.equalize_grid/grdhisteq.compute_bins) mirrorspygmt.triangulate(triangulate.regular_grid/triangulate.delaunay_triples), exposing two distinct output modes of the same underlying GMT module.
Metadata
Metadata
Assignees
Labels
feature requestNew feature wanted
Type
Projects
- StatusShow more project fieldsNo status
Activity