:author: 周茂
:date: 2026-01-12

.. index:: ! sph2grd
.. program:: sph2grd

sph2grd
========

:官方文档: :doc:`gmt:sph2grd`
:简介: 使用球谐系数计算网格

**sph2grd** 模块利用球谐系数表文件计算特定的网格值。球谐系数模型的格式为
L，M，C[L，M]，S[L，M]

语法
-----

**gmt sph2grd**
[ *table* ]
:option:`-G`\ *grdfile*
:option:`-I`\ *increment*
:option:`-R`\ *region*
[ :option:`-D`\ [**g**\|\ **n**] ]
[ :option:`-E` ]
[ :option:`-F`\ [**k**]\ *filter* ]
[ :option:`-N`\ [norm] ]
[ :option:`-Q` ]
[ :option:`-V`\ [*level*] ]
[ :option:`-bi`\ *binary* ]
[ :option:`-h`\ *headers* ]
[ :option:`-i`\ *flags* ]
[ :option:`-r`\ *reg* ]
[ :option:`-x`\ [[-]n] ]
[ :doc:`--PAR=value </conf/overview>` ]

输入数据
----------

*table*
    一个或多个球谐系数文本文件 [ 或者二进制文件，见 **-bi**]。文件预期
    的格式为四列，分别比表示阶 L，度 M，然后是余弦和正弦系数。

必须选项
----------

.. include:: explain_grd_out.rst_

.. include:: explain_-I.rst_

.. include:: explain_-R.rst_

可选选项
----------

.. option:: -D

**-D**\ [**g**\|\ **n**]
    利用位模型计算场。\ **-Dg** 表示计算引力场，\ **-Dn** 表示计算大地水准
    [ 同时使用 :option:`-E` 选项将会计算基于椭球的场 ]。

.. option:: -E

**-E**
    将参考从默认的球改变为椭球。

.. option:: -F

**-F**\ [**k**]\ *filter*
    根据特定的滤波算法设定滤波参数，默认为球谐系数中的阶数 L ，使用 **Fk** 时，
    滤波参数的单位为千米。可选的滤波算法包括：
    a) 余弦带通滤波：附加四个波长参数 *lc/lp/hp/hc* 。*lc/hc* 之外的系数被截断，
    *lp/hp* 范围内的则可以通过，其余部分将 tapering 。将波长替换为 - 可以跳过设置，
    例如： :option:`-F`-/-/50/75 为低通滤波。
    b) 高斯带通滤波：附加两个波长参数 *lo/hi*，滤波 amplitudes 为 0.5 。将波长替换为 -
    可以跳过设置，例如： :option:`-F`\ 70/- 为高通高斯滤波。

.. option:: -N

**-N**\ [norm]
    对球谐系数使用规格化。可选的规格化方法包括：

    - **m** 数学正规格化化：表面内积和为 1 (默认)。
    - **g** 大地测量规格化：表面内积和为 4pi 。
    - **s** 施密特规格化：和地磁学中相同。

.. option:: -Q

**-Q**
    系数采用物理学中的相位约定，即 :math:`(-1)^m` 因子。

.. include:: explain_-V.rst_

.. include:: explain_-bi.rst_

.. include:: explain_-h.rst_

.. include:: explain_-icols.rst_

.. include:: explain_nodereg.rst_

.. include:: explain_core.rst_

.. include:: explain_help.rst_

.. include:: explain_float.rst_

.. include:: explain_grd_coord.rst_

示例
------

使用 EGM96_to_36.txt 球谐系数文件创建 1 x 1 度全球网格::

    gmt sph2grd @EGM96_to_36.txt -GEGM96_to_36.nc -Rg -I1 -V

参考文献
----------

Holmes, S. A., and Featherstone, W. E., 2002,
A unified approach to the Clenshaw summation and the recursive computation of very high degree
and order normalized associated Legendre functions:
*J. Geodesy, v. 76, p. 279-299*.

相关模块
-----------

:doc:`grdfft`,
:doc:`grdmath`
