Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pygmt.surface: Add aliases for "C", "L", "M", and "T" #2321

Merged
merged 30 commits into from
Feb 7, 2023
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9007170
alias surface.py T=tensor
jhtong33 Jan 11, 2023
4b62f0e
surface.py add tension documnets
jhtong33 Jan 13, 2023
803a278
surface add -L -M -C:
jhtong33 Jan 13, 2023
fc0ba08
Apply suggestions from code review
jhtong33 Jan 14, 2023
fbe59e2
surface add document: limit upper & lower
jhtong33 Jan 14, 2023
6cf98c8
Apply suggestions from code review
jhtong33 Jan 14, 2023
f917d9d
Apply suggestions from code review
jhtong33 Jan 15, 2023
add6d0a
/format
Jan 15, 2023
5c77c5f
format
Jan 15, 2023
ae90cc3
format bold and space
jhtong33 Jan 16, 2023
9d19405
Apply suggestions from code review
jhtong33 Jan 21, 2023
38e80c0
Apply suggestions from code review
jhtong33 Jan 21, 2023
68f7fbf
add Unit links
jhtong33 Jan 21, 2023
78f721c
add Unit links with :
jhtong33 Jan 21, 2023
15680a7
add Unit links
jhtong33 Jan 21, 2023
d05a7a5
Merge branch 'GenericMappingTools:main' into main
jhtong33 Jan 21, 2023
c6fcf49
adding grdgradient_shading
jhtong33 Jan 21, 2023
bffc4c2
[format-command] fixes
actions-bot Jan 23, 2023
8c9505a
Apply suggestions from code review
jhtong33 Jan 27, 2023
e5f5c54
code finish
jhtong33 Jan 27, 2023
1fdc625
Merge branch 'GenericMappingTools:main' into mini_branch
jhtong33 Jan 27, 2023
2897d2f
Merge branch 'main' into main
weiji14 Feb 6, 2023
3256f2b
Apply suggestions from code review
jhtong33 Feb 6, 2023
2d433b0
add tension more infomation
jhtong33 Feb 6, 2023
1492de9
Merge branch 'main' of github.com:JingHuiTong/pygmt into main
jhtong33 Feb 6, 2023
3c8fd2c
mini_branch/ surface.py T=tension more information
jhtong33 Feb 6, 2023
968bda3
Fix conflicts
jhtong33 Feb 6, 2023
6136b8a
Merge remote-tracking branch 'origin/main' into main
jhtong33 Feb 6, 2023
5653ef1
[format-command] fixes
actions-bot Feb 6, 2023
8da18ee
Apply suggestions from code review
jhtong33 Feb 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 66 additions & 3 deletions pygmt/src/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@

@fmt_docstring
@use_alias(
C="convergence",
G="outgrid",
I="spacing",
Ll="lower",
Lu="upper",
M="maxradius",
R="region",
G="outgrid",
T="tension",
weiji14 marked this conversation as resolved.
Show resolved Hide resolved
V="verbose",
a="aspatial",
b="binary",
Expand All @@ -42,7 +47,22 @@ def surface(data=None, x=None, y=None, z=None, **kwargs):
.. math:: (1 - t)\nabla^2(z)+t\nabla(z) = 0

where :math:`t` is a tension factor between 0 and 1, and :math:`\nabla`
indicates the Laplacian operator.
indicates the Laplacian operator. Here, :math:`t = 0` gives the
"minimum curvature" solution. Minimum curvature can cause undesired
oscillations and false local maxima or minima (see Smith and Wessel,
1990), and you may wish to use :math:`t > 0` to suppress these effects.
Experience suggests :math:`t \sim 0.25` usually looks good for potential
field data and t should be larger (:math:`t \sim 0.35`) for steep
topography data. :math:`t = 1` gives a harmonic surface (no maxima or
minima are possible except at control data points). It is recommended that
the user preprocess the data with :func:`pygmt.blockmean`,
:func:`pygmt.blockmedian`, or :func:`pygmt.blockmode` to avoid spatial
aliasing and eliminate redundant data. You may impose lower and/or upper
bounds on the solution. These may be entered in the form of a fixed value,
a grid with values, or simply be the minimum/maximum input data values.
Natural boundary conditions are applied at the edges, except for
geographic data with 360-degree range where we apply periodic boundary
conditions in the longitude direction.

Takes a matrix, (x, y, z) triplets, or a file name as input.

Expand All @@ -68,7 +88,50 @@ def surface(data=None, x=None, y=None, z=None, **kwargs):
outgrid : str
Optional. The file name for the output netcdf file with extension .nc
to store the grid in.

convergence : float
jhtong33 marked this conversation as resolved.
Show resolved Hide resolved
Optional. Convergence limit. Iteration is assumed to have converged
when the maximum absolute change in any grid value is less than
``convergence``. (Units same as data z units). Alternatively,
give limit in percentage of root-mean-square (rms) deviation by
appending %. [Default is scaled to :math:`10^{{-4}}` of the rms
deviation of the data from a best-fit (least-squares) plane.]
This is the final convergence limit at the desired grid spacing;
for intermediate (coarser) grids the effective convergence limit is
divided by the grid spacing multiplier.
maxradius : int or str
Optional. After solving for the surface, apply a mask so that nodes
farther than ``maxradius`` away from a data constraint are set to NaN
[Default is no masking]. Append a distance unit (see
:gmt-docs:`Units <surface.html#units>`) if needed. One can also
select the nodes to mask by using the *n_cells*\ **c** form. Here
*n_cells* means the number of cells around the node is controlled
by a data point. As an example ``"0c"`` means that only the cell
where the point lies is filled, ``"1c"`` keeps one cell beyond
that (i.e. makes a 3x3 square neighborhood), and so on.
lower : float or str
Optional. Impose limits on the output solution. Parameter ``lower``
sets the lower bound. ``lower`` can be the name of a grid file with
lower bound values, a fixed value, **d** to set to minimum input
value, or **u** for unconstrained [Default]. Grid files used to set
the limits may contain NaNs. In the presence of NaNs, the limit of
a node masked with NaN is unconstrained.
upper : float or str
Optional. Impose limits on the output solution. Parameter ``upper``
sets the upper bound and can be the name of a grid file with upper
bound values, a fixed value, **d** to set to maximum input value,
or **u** for unconstrained [Default]. Grid files used to set the
limits may contain NaNs. In the presence of NaNs, the limit of a
node masked with NaN is unconstrained.
tension : float or str
[**b**\|\ **i**].
Optional. Tension factor[s]. These must be between 0 and 1. Tension
may be used in the interior solution (above equation, where it
suppresses spurious oscillations) and in the boundary conditions
(where it tends to flatten the solution approaching the edges). Add
**i**\ *tension* to set interior tension, and **b**\ *tension* to
set boundary tension. If you do not prepend **i** or **b**, both
will be set to the same value. [Default is 0 for both and gives
minimum curvature solution.]
{verbose}
{aspatial}
{binary}
Expand Down