Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 14 additions & 11 deletions doc/rst/source/greenspline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Synopsis
**gmt greenspline** [ *table* ]
|-G|\ *grdfile*
[ |-A|\ *gradfile*\ **+f**\ **1**\|\ **2**\|\ **3**\|\ **4**\|\ **5** ]
[ |-C|\ [**n**]\ *value*\ [%][**+f**\ *file*][**+m**\|\ **M**] ]
[ |-C|\ [[**n**]\ *value*\ [%]][**+c**][**+f**\ *file*][**+i**] ]
[ |SYN_OPT-D3| ]
[ |-E|\ [*misfitfile*] ]
[ |-I|\ *xinc*\ [/*yinc*\ [/*zinc*]] ]
Expand Down Expand Up @@ -142,7 +142,7 @@ Optional Arguments

.. _-C:

**-C**\ [**n**]\ *value*\ [%][**+f**\ *file*][**+m**\|\ **M**]
**-C**\ [[**n**]\ *value*\ [%]][**+c**][**+f**\ *file*][**+i**]
Find an approximate surface fit: Solve the linear system for the
spline coefficients by SVD and eliminate the contribution from all
eigenvalues whose ratio to the largest eigenvalue is less than *value*
Expand All @@ -151,14 +151,17 @@ Optional Arguments
eigenvalues to the specified file for further analysis.
If a negative *value* is given then **+f**\ *file* is required and
execution will stop after saving the eigenvalues, i.e., no surface
output is produced. Specify **-Cn** to retain only the *value* largest
eigenvalues; append % if *value* is the percentage of eigenvalues
to use instead. The two last modifiers (**+m**\|\ **M**) are only
output is produced. Specify **-Cn**\ *value* to retain only the *value* largest
eigenvalues; append % if *value* is the *percentage* of eigenvalues
to use instead. The two other modifiers (**+c** and **i**) are only
available for 2-D gridding and can be used to write intermediate grids,
one per eigenvalue, and thus require a file name template with a C-format
integer specification to be given via **-G**. The **+m** modifier will
write the contributions to the grid for each eigenvalue, while **+M**
will instead produce the cumulative sum of these contributions.
one per eigenvalue, and thus require a file name with a suitable extension
to be given via **-G** (we automatically insert "_cum_###" or "_inc_###"
before the extension, using a fixed integer format for the eigenvalue
number starting at 0). The **+i** modifier will write the **i**\ ncremental
contributions to the grid for each eigenvalue, while **+c** will instead
produce the **c**\ umulative sum of these contributions. Use both modifiers
to write both types of intermediate grids.

.. _-D:

Expand Down Expand Up @@ -369,9 +372,9 @@ of the surface slope in the NW direction, try::
gmt greenspline @Table_5_11.txt -R0/6.5/-0.2/6.5 -I0.1 -Sr0.95 -V -Z1 -Q-45 -Gslopes.nc

To use Cartesian cubic splines and evaluate the cumulative solution as a function of eigenvalue,
using the output template with three digits for the eigenvalue, try::
using output file based on the main grid name (such as contribution_cum_033.nc), try::

gmt greenspline @Table_5_11.txt -R0/6.5/-0.2/6.5 -I0.1 -Gcontribution_%3.3d.nc -Sc -Z1 -C+M
gmt greenspline @Table_5_11.txt -R0/6.5/-0.2/6.5 -I0.1 -Gcontribution.nc -Sc -Z1 -C+c

Finally, to use Cartesian minimum curvature splines in recovering a
surface where the input data is a single surface value (pt.txt) and the
Expand Down
5 changes: 3 additions & 2 deletions src/gmt_vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,7 @@ int gmt_svdcmp (struct GMT_CTRL *GMT, double *a, unsigned int m_in, unsigned int
int gmt_solve_svd (struct GMT_CTRL *GMT, double *u, unsigned int m, unsigned int nu, double *v, double *w, double *b, unsigned int k, double *x, double cutoff, unsigned int mode) {
/* Mode = 0: Use all singular values s_j for which s_j/s_0 > cutoff [0 = all]
* mode = 1: Use the first cutoff singular values only. If cutoff is < 1 we assume this is the fraction of eigenvalues we want.
* We return the number of eigenvalues used.
*/
double w_abs, sing_max;
int i, j, n_use = 0, n = (int)nu; /* Because OpenMP cannot handle unsigned loop variables */
Expand Down Expand Up @@ -1127,7 +1128,7 @@ int gmt_solve_svd (struct GMT_CTRL *GMT, double *u, unsigned int m, unsigned int
/* mode = 1: Find the m largest singular values, with m = cutoff (if <1 it is the fraction of values).
* Either case requires sorted singular values so we need to do some work first.
* It also assumes that the matrix passed is a squared normal equation kind of matrix
* so that the singular values are the individual variace contributions. */
* so that the singular values are the individual variance contributions. */
struct GMT_SINGULAR_VALUE {
double value;
unsigned int order;
Expand Down Expand Up @@ -1164,7 +1165,7 @@ int gmt_solve_svd (struct GMT_CTRL *GMT, double *u, unsigned int m, unsigned int
}
if (mode == 0)
GMT_Report (GMT->parent, GMT_MSG_INFORMATION,
"gmt_solve_svd: Ratio limit %g ratained %d singular values\n", cutoff, n_use);
"gmt_solve_svd: Ratio limit %g retained %d singular values\n", cutoff, n_use);
if (mode == 2)
GMT_Report (GMT->parent, GMT_MSG_INFORMATION,
"gmt_solve_svd: Selected first %d singular values\n", n_use);
Expand Down
Loading