-
Notifications
You must be signed in to change notification settings - Fork 232
Wrap velo #525
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
Wrap velo #525
Changes from 53 commits
e3c296f
c6e3476
c2b951c
1cf7967
fc7bec8
7b905d7
1fcf089
ac05994
38514ef
fd6e421
4858aff
099a3d6
8c6c0e1
480abd0
98d5ded
dea4b1c
132995a
c908e78
6e3076a
6dff809
e5de366
76c9b28
7dccfa9
1fe7005
e2e956c
8364134
7a9de97
909827a
1e5fe88
cfcae90
92f94f1
0e66deb
437e415
dd24153
cc0ef72
34ad182
90e9e0d
d3850b7
d67bfcd
c90ec47
80743aa
2661e2c
ef3465e
86cf8a0
be959fc
0653349
c9f859d
92feb97
71d3797
9ef3983
88d1c8f
984b4cb
b8a2410
c9c7b66
23e908c
d33f7a5
6b99454
f949f16
1064c82
8a7cb44
da9ee3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
""" | ||
Velocity arrows and confidence ellipses | ||
--------------------------------------- | ||
|
||
The :meth:`pygmt.Figure.velo` method can be used to plot mean velocity arrow | ||
weiji14 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
and confidence ellipses. | ||
The example below plots red velocity arrows with light-blue confidence ellipses | ||
outlined in red with the east_velocity x north_velocity used for the station names. | ||
Note that the velocity arrows are scaled by 0.2 and the 39% confidence limit | ||
will give an ellipse | ||
which fits inside a rectangle of dimension east_sigma by north_sigma. | ||
""" | ||
|
||
import pandas as pd | ||
import pygmt | ||
|
||
fig = pygmt.Figure() | ||
df = pd.DataFrame( | ||
data={ | ||
"x": [0, -8, 0, -5, 5, 0], | ||
"y": [-8, 5, 0, -5, 0, -5], | ||
"east_velocity": [0, 3, 4, 6, -6, 6], | ||
"north_velocity": [0, 3, 6, 4, 4, -4], | ||
"east_sigma": [4, 0, 4, 6, 6, 6], | ||
"north_sigma": [6, 0, 6, 4, 4, 4], | ||
"correlation_EN": [0.5, 0.5, 0.5, 0.5, -0.5, -0.5], | ||
"SITE": ["0x0", "3x3", "4x6", "6x4", "-6x4", "6x-4"], | ||
} | ||
) | ||
fig.velo( | ||
data=df, | ||
region=[-10, 8, -10, 6], | ||
pen="0.6p,red", | ||
uncertainty_color="lightblue1", | ||
line=True, | ||
scaling="e0.2/0.39/18", | ||
weiji14 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
frame=["WSne", "2g2f"], | ||
projection="x0.8c", | ||
vector="0.3c+p1p+e+gred", | ||
) | ||
|
||
fig.show() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -423,6 +423,7 @@ def _repr_html_(self): | |
solar, | ||
subplot, | ||
text, | ||
velo, | ||
) | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,248 @@ | ||||||
""" | ||||||
velo - Plot velocity vectors, crosses, anisotropy bars, and wedges. | ||||||
""" | ||||||
import numpy as np | ||||||
import pandas as pd | ||||||
from pygmt.clib import Session | ||||||
from pygmt.exceptions import GMTInvalidInput | ||||||
from pygmt.helpers import build_arg_string, fmt_docstring, kwargs_to_strings, use_alias | ||||||
|
||||||
|
||||||
@fmt_docstring | ||||||
@use_alias( | ||||||
A="vector", | ||||||
B="frame", | ||||||
C="cmap", | ||||||
D="rescale", | ||||||
E="uncertainty_color", | ||||||
G="color", | ||||||
H="scale", | ||||||
I="shading", | ||||||
J="projection", | ||||||
L="line", | ||||||
N="no_clip", | ||||||
R="region", | ||||||
S="scaling", | ||||||
|
S="scaling", | |
S="spec", |
maxrjones marked this conversation as resolved.
Show resolved
Hide resolved
weiji14 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
weiji14 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
weiji14 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(``scaling='w'``). Can be combined with the ``confidence`` variable. | |
(``spec='w'``). Optionally, append the *confidence* to set the two-dimensional confidence limit for the ellipse with ``spec='e'`` or ``spec='r'``. |
weiji14 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
weiji14 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
weiji14 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
weiji14 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
maxrjones marked this conversation as resolved.
Show resolved
Hide resolved
weiji14 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
outs: | ||
- md5: 0d50fb17d52af222b890d44fbd9050c4 | ||
size: 48104 | ||
path: test_velo_numpy_array_numeric_only.png |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
outs: | ||
- md5: fc51d80c438a1961f700c68e207ecc3b | ||
size: 44161 | ||
path: test_velo_pandas_dataframe.png |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one last-minute comment:
This gallery example should be put in the "Seismology and Geodesy" category.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're lucky, I was just about to merge this in. Looking closely, I'm actually more tempted to put this under "Lines and vectors" as there doesn't seem to be anything seismology or geodetic about
velo
(though I'm not experienced in either of those fields).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "velo" module is in the "geodesy" supplement (https://docs.generic-mapping-tools.org/dev/supplements/geodesy/velo.html), and the input columns like "eastward, northward velocity, and uncertainty of eastward, northward velocities" are also specific to geodesy applications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, had a closer read at the Geodesy wikipedia page page and it seems to fit. I'll move the gallery example.