13.12 fitcircle¶

官方文档: fitcircle 拟合球面上数据点的平均位置及圆弧

13.12.1 必选选项¶

<table>

-L<norm>

• -L1 解法1
• -L2 解法2
• -L-L3 同时输出解法1和解法2的结果

The -L1 solution is so called because it approximates the minimization of the sum of absolute values of cosines of angular distances. This solution finds the mean position as the Fisher average of the data, and the pole position as the Fisher average of the cross-products between the mean and the data. Averaging cross-products gives weight to points in proportion to their distance from the mean, analogous to the “leverage” of distant points in linear regression in the plane.

The -L2 solution is so called because it approximates the minimization of the sum of squares of cosines of angular distances. It creates a 3 by 3 matrix of sums of squares of components of the data vectors. The eigenvectors of this matrix give the mean and pole locations. This method may be more subject to roundoff errors when there are thousands of data. The pole is given by the eigenvector corresponding to the smallest eigenvalue; it is the least-well represented factor in the data and is not easily estimated by either method.

13.12.2 选项¶

-Ff|m|n|s|c

• f Flat Earth mean location
• m mean location
• n north pole of great circle
• s south pole of great circle
• c pole of small circle and its colatitude, which requires -S
-S[<lat>]

The pole will be constrained to lie on the great circle connecting the pole of the best-fit great circle and the mean location of the data. Optionally append the desired fixed latitude of the small circle [Default will determine the latitude].

13.12.3 示例¶

#!/bin/bash
# test/fitcircle/circles.sh
#
# Tests gmt fitcircle on spherical data points

ps=fitcircle_ex1.ps

# Fit great circle to red points and small circle to green points
# Plot the best-fitting great and small circles as well as the
# location of the mean locations and pole locations for both
# the -L1 and -L2 options (i.e., -L3).

gmt fitcircle gcircle.txt -L3 > g.txt
gmt fitcircle scircle.txt -L3 -S > s.txt
gpole1=grep "L1 N Hemisphere" g.txt | gawk '{printf "%s/%s\n", $1,$2}'
gpole2=grep "L2 N Hemisphere" g.txt | gawk '{printf "%s/%s\n", $1,$2}'
spole1=grep "L1 Small Circle Pole" s.txt | gawk '{printf "%s/%s\n", $1,$2}'
spole2=grep "L2 Small Circle Pole" s.txt | gawk '{printf "%s/%s\n", $1,$2}'
slat1=grep "L1 Small Circle" s.txt | gawk '{print 90-$NF}' slat2=grep "L2 Small Circle" s.txt | gawk '{print 90-$NF}'
gmt psxy -Rg -JG-30/40/7i -P -Bg -K gcircle.txt -Sc0.04i -Gred -Xc -Yc > $ps gmt psxy -R -J -O -K scircle.txt -Sc0.04i -Ggreen >>$ps
gmt project -G1 -T$gpole1 -L-180/180 | gmt psxy -R -J -O -K -W3p >>$ps
gmt project -G1 -T$gpole2 -L-180/180 | gmt psxy -R -J -O -K -W1p,- >>$ps
gmt project -G1/$slat1 -T$spole1 -L-180/180 | gmt psxy -R -J -O -K -W3p >> $ps gmt project -G1/$slat2 -T$spole2 -L-180/180 | gmt psxy -R -J -O -K -W1p,- >>$ps
grep "Great Circle Pole" g.txt | gmt psxy -R -J -O -K -Sa0.2i -Gred -W0.25p >> $ps grep "Small Circle Pole" s.txt | gmt psxy -R -J -O -K -Sa0.2i -Ggreen -W0.25p >>$ps
grep "L1 Average" g.txt | gmt psxy -R -J -O -K -Sa0.2i -Gyellow -W0.25p >> $ps grep "L2 Average" g.txt | gmt psxy -R -J -O -K -Sa0.2i -Gyellow -W0.25p >>$ps
grep "L1 Average" s.txt | gmt psxy -R -J -O -K -Sa0.2i -Gyellow -W0.25p >> $ps grep "L2 Average" s.txt | gmt psxy -R -J -O -K -Sa0.2i -Gyellow -W0.25p >>$ps
gmt psxy -R -J -O -T >> \$ps
rm g.txt s.txt gmt.* fitcircle示例