You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue serves as the central place for discussing and tracking the implementation of the pygmt.sph2grd function in PyGMT. The issue will be closed when the initial implementation is complete. Progress is tracked at PyGMT: Wrapping GMT modules.
☑️: Implemented; ⬜: To be implemented/discussed; Strikethrough: Won't implement.
⬜ -D [g|n]: Disable the cos(lat) conversion in the Legendre polynomials by selecting a normalization that is designed for geographic (g) or Cartesian (n) grids.
☑️ -G (outgrid): Output grid file name.
☑️ -I (spacing): Grid spacing.
⬜ -Nm|s|g: Choose normalization for the coefficients: m for mathematical, s for Schmidt quasi-normalized, g for geodetic [Default is g].
⬜ -Q: If set, coefficients are expressed in terms of Legendre polynomials (not the default spherical harmonics).
☑️ -R (region): Output grid region.
☑️ -V (verbose): Verbosity level.
-X/-Y: Use Figure.shift_origin instead.
☑️ -b (binary): Binary input/output.
⬜ -d: Replace NaN with a specified nodata value on input/output.
⬜ -e: Pattern matching to select input rows.
⬜ -f (coltypes): Column data types.
⬜ -g: Gap detection.
☑️ -h (header): Read/write header records.
☑️ -i (incols): Select input columns.
☑️ -r (registration): Set grid node registration to gridline or pixel.
⬜ -s: Skip rows containing NaN values.
⬜ -w: Wrap repeated cycles.
☑️ -x (cores): Set the number of cores for multi-threading.
--PAR=value: Use pygmt.config instead.
Notes on Input Formats
data: Accepts a file path or 2-D numpy.ndarray with columns L, M, C[L,M], S[L,M] (degree, order, cosine, and sine coefficients).
outgrid: If not set, returns an xarray.DataArray; if set to a file path, writes the grid to disk and returns None.
Both spacing and region are required parameters.
The spherical harmonic coefficients are typically global (use region="g" for a 360°×180° grid).
This issue serves as the central place for discussing and tracking the implementation of the
pygmt.sph2grdfunction in PyGMT. The issue will be closed when the initial implementation is complete. Progress is tracked at PyGMT: Wrapping GMT modules.Documentation
GMT Option Flags and Modifiers
☑️: Implemented; ⬜: To be implemented/discussed;
Strikethrough: Won't implement.-D[g|n]: Disable thecos(lat)conversion in the Legendre polynomials by selecting a normalization that is designed for geographic (g) or Cartesian (n) grids.-G(outgrid): Output grid file name.-I(spacing): Grid spacing.-Nm|s|g: Choose normalization for the coefficients: m for mathematical, s for Schmidt quasi-normalized, g for geodetic [Default is g].-Q: If set, coefficients are expressed in terms of Legendre polynomials (not the default spherical harmonics).-R(region): Output grid region.-V(verbose): Verbosity level.: Use-X/-YFigure.shift_origininstead.-b(binary): Binary input/output.-d: Replace NaN with a specified nodata value on input/output.-e: Pattern matching to select input rows.-f(coltypes): Column data types.-g: Gap detection.-h(header): Read/write header records.-i(incols): Select input columns.-r(registration): Set grid node registration to gridline or pixel.-s: Skip rows containing NaN values.-w: Wrap repeated cycles.-x(cores): Set the number of cores for multi-threading.: Use--PAR=valuepygmt.configinstead.Notes on Input Formats
data: Accepts a file path or 2-Dnumpy.ndarraywith columns L, M, C[L,M], S[L,M] (degree, order, cosine, and sine coefficients).outgrid: If not set, returns anxarray.DataArray; if set to a file path, writes the grid to disk and returnsNone.spacingandregionare required parameters.region="g"for a 360°×180° grid).Linked Pull Requests
-D(normalization for geographic vs. Cartesian) option-N(coefficient normalization scheme) option-Q(Legendre polynomial input) option-d,-e,-f,-g,-s,-w)Related Issues and Discussions
pygmt.sph2grdis the companion topygmt.grd2sph(not yet implemented); together they form a round-trip spherical harmonic analysis/synthesis workflow.Figure.grdimageorFigure.grdcontour.regionto avoid computing unnecessary nodes.