|
| 1 | +""" |
| 2 | +wiggle - Plot z=f(x,y) anomalies along tracks. |
| 3 | +""" |
| 4 | +from pygmt.clib import Session |
| 5 | +from pygmt.helpers import build_arg_string, fmt_docstring, kwargs_to_strings, use_alias |
| 6 | + |
| 7 | + |
| 8 | +@fmt_docstring |
| 9 | +@use_alias( |
| 10 | + B="frame", |
| 11 | + D="position", |
| 12 | + G="color", |
| 13 | + J="projection", |
| 14 | + R="region", |
| 15 | + T="track", |
| 16 | + U="timestamp", |
| 17 | + V="verbose", |
| 18 | + W="pen", |
| 19 | + X="xshift", |
| 20 | + Y="yshift", |
| 21 | + Z="scale", |
| 22 | + c="panel", |
| 23 | + i="columns", |
| 24 | + p="perspective", |
| 25 | +) |
| 26 | +@kwargs_to_strings(R="sequence", c="sequence_comma", i="sequence_comma", p="sequence") |
| 27 | +def wiggle(self, x=None, y=None, z=None, data=None, **kwargs): |
| 28 | + r""" |
| 29 | + Plot z=f(x,y) anomalies along tracks. |
| 30 | +
|
| 31 | + Takes a matrix, (x,y,z) triplets, or a file name as input and plots z as a |
| 32 | + function of distance along track. |
| 33 | +
|
| 34 | + Must provide either ``data`` or ``x``/``y``/``z``. |
| 35 | +
|
| 36 | + Full parameter list at :gmt-docs:`wiggle.html` |
| 37 | +
|
| 38 | + {aliases} |
| 39 | +
|
| 40 | + Parameters |
| 41 | + ---------- |
| 42 | + x/y/z : 1d arrays |
| 43 | + The arrays of x and y coordinates and z data points. |
| 44 | + data : str or 2d array |
| 45 | + Either a data file name or a 2d numpy array with the tabular data. |
| 46 | + Use parameter ``columns`` to choose which columns are x, y, z, |
| 47 | + respectively. |
| 48 | + {J} |
| 49 | + {R} |
| 50 | + scale : str or float |
| 51 | + Gives anomaly scale in data-units/distance-unit. Append **c**, **i**, |
| 52 | + or **p** to indicate the distance unit (cm, inch, or point); if no unit |
| 53 | + is given we use the default unit that is controlled by |
| 54 | + :gmt-term:`PROJ_LENGTH_UNIT`. |
| 55 | + {B} |
| 56 | + position : str |
| 57 | + [**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\ |
| 58 | + **+w**\ *length*\ [**+j**\ *justify*]\ [**+al**\ |\ **r**]\ |
| 59 | + [**+o**\ *dx*\ [/*dy*]][**+l**\ [*label*]]. |
| 60 | + Defines the reference point on the map for the vertical scale bar. |
| 61 | + color : str |
| 62 | + Set fill shade, color or pattern for positive and/or negative wiggles |
| 63 | + [Default is no fill]. Optionally, append **+p** to fill positive areas |
| 64 | + (this is the default behavior). Append **+n** to fill negative areas. |
| 65 | + Append **+n+p** to fill both positive and negative areas with the same |
| 66 | + fill. Note: You will need to repeat the color parameter to select |
| 67 | + different fills for the positive and negative wiggles. |
| 68 | +
|
| 69 | + track : str |
| 70 | + Draw track [Default is no track]. Append pen attributes to use |
| 71 | + [Default is **0.25p,black,solid**]. |
| 72 | + {U} |
| 73 | + {V} |
| 74 | + pen : str |
| 75 | + Specify outline pen attributes [Default is no outline]. |
| 76 | + {XY} |
| 77 | + {c} |
| 78 | + columns : str or 1d array |
| 79 | + Choose which columns are x, y, and z, respectively if input is provided |
| 80 | + via *data*. E.g. ``columns = [0, 1, 2]`` or ``columns = "0,1,2"`` if |
| 81 | + the *x* values are stored in the first column, *y* values in the second |
| 82 | + one and *z* values in the third one. Note: zero-based indexing is used. |
| 83 | + {p} |
| 84 | + """ |
| 85 | + kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access |
| 86 | + |
| 87 | + with Session() as lib: |
| 88 | + # Choose how data will be passed in to the module |
| 89 | + file_context = lib.virtualfile_from_data( |
| 90 | + check_kind="vector", data=data, x=x, y=y, z=z |
| 91 | + ) |
| 92 | + |
| 93 | + with file_context as fname: |
| 94 | + arg_str = " ".join([fname, build_arg_string(kwargs)]) |
| 95 | + lib.call_module("wiggle", arg_str) |
0 commit comments