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

Enhance meca and coupe w.r.t. adjusting positions and connecting with a line #7778

Merged
merged 23 commits into from Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3f42931
Enhance meca and coupe w.r.t. adjusting positions and connecting with…
PaulWessel Sep 2, 2023
dbc78ad
Add the +c and +o modifiers to the parser function
PaulWessel Sep 2, 2023
56af45b
Draft 1.0
PaulWessel Sep 2, 2023
73b4bbb
Update psmeca.c
PaulWessel Sep 2, 2023
5b61268
Merge branch 'master' into refresh-seis-adjust
PaulWessel Sep 3, 2023
edfebf6
Draft 1 RST
PaulWessel Sep 3, 2023
7bd8e8a
Control symbol type [circle] and fill-no-fill
PaulWessel Sep 3, 2023
351aa61
Merge branch 'master' into refresh-seis-adjust
PaulWessel Sep 3, 2023
c12545b
Merge branch 'master' into refresh-seis-adjust
PaulWessel Sep 4, 2023
97da344
Add +c to coupe after all
PaulWessel Sep 4, 2023
cfcc91c
Update src/seis/meca.h
PaulWessel Sep 4, 2023
0d091e5
Update doc/rst/source/supplements/seis/psmeca.rst
PaulWessel Sep 4, 2023
46a748f
Update doc/rst/source/supplements/seis/pscoupe.rst
PaulWessel Sep 4, 2023
b915846
Update src/seis/pscoupe.c
PaulWessel Sep 4, 2023
856af7a
Update src/seis/pscoupe.c
PaulWessel Sep 4, 2023
7c9b820
Update src/seis/psmeca.c
PaulWessel Sep 4, 2023
13e19f3
Merge branch 'master' into refresh-seis-adjust
PaulWessel Sep 9, 2023
4926bda
Set default symbol if old -C setting
PaulWessel Sep 9, 2023
6a5f365
Merge branch 'master' into refresh-seis-adjust
PaulWessel Sep 9, 2023
03ec232
Fix seis_12.sh to avoid round-off in time.
PaulWessel Sep 9, 2023
42a9b6b
Merge branch 'master' into refresh-seis-adjust
PaulWessel Sep 9, 2023
617386e
Typo
PaulWessel Sep 9, 2023
af98479
Update gmt_init.c
PaulWessel Sep 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions doc/rst/source/supplements/seis/coupe.rst
Expand Up @@ -20,6 +20,7 @@ Synopsis
|-S|\ *format*\ [*scale*][**+a**\ *angle*][**+f**\ *font*][**+j**\ *justify*][**+l**][**+m**][**+o**\ *dx*\ [/*dy*]][**+s**\ *reference*]
[ |SYN_OPT-B| ]
[ |-C|\ *cpt* ]
[ |-D|\ [**+c**][**+g**\ [*fill*]][**+o**\ *dx*\ [/*dy*]][**+p**\ *pen*][**+s**\ [*symbol*]\ *size*] ]
[ |-E|\ *fill* ]
[ |-F|\ *mode*\ [*args*] ]
[ |-G|\ *fill* ]
Expand Down Expand Up @@ -136,6 +137,27 @@ Optional Arguments
Give a CPT and let compressive part color be
determined by the z-value in the third column.

.. _-D:

**-D**\ [**+c**][**+g**\ [*fill*]][**+o**\ *dx*\ [/*dy*]][**+p**\ *pen*][**+s**\ [*symbol*]\ *size*] ]
Offsets projected focal mechanisms to the alternate distance, depth given
in the last two columns of the input file before the (optional) text
string. Instead, if alternate geographical coordinates are given in the two columns then use **+c** to first
convert them to *distance, depth* coordinates in the crossectional plane, and after projection to
plot locations you can further adjust them via a fixed plot offset **+o**\ *dx/dy* .
Alternatively, use **+o** to interpret the contents of the two
columns as plot offsets instead, or append fixed offset *dx/dy* for all adjusted events plot locations.
We will draw a line connecting the original and relocated
beachball positions and optionally place a small symbol [circle] at the original
location. Use **+s**\ *size* to set the diameter of the symbol [no symbol].
Change from circle to any of the standard geometric symbols in :doc:`plot </plot>`,
i.e., **a**\|\ **c**\|\ **d**\|\ **g**\|\ **h**\|\ **i**\|\ **n**\|\ **p**\|\ **s**\|\ **t**\|\ **x** [**c**].
The symbol will be filled with the beachball color, but a fixed color (**+g**\ *fill*)
or no fill (**+g**) can be selected.
The line pen defaults to that given via |-W| but can be overridden
by using **+p**\ *pen* [0.25p]. **Note**: If the cross symbol (**x**) is selected there is no fill since it is
just two stroked lines. Use |-W| to set line thickness and append **+c** to color the crosses as other symbols.

.. _-E:

**-E**\ *fill* :ref:`(more ...) <-Gfill_attrib>`
Expand Down
16 changes: 11 additions & 5 deletions doc/rst/source/supplements/seis/meca.rst
Expand Up @@ -16,7 +16,7 @@ Synopsis
|-J|\ *parameters*
|SYN_OPT-R|
|-S|\ *format*\ [*scale*][**+a**\ *angle*][**+f**\ *font*][**+j**\ *justify*][**+l**][**+m**][**+o**\ *dx*\ [/*dy*]][**+s**\ *reference*]
[ |-A|\ [**+p**\ *pen*][**+s**\ *size*] ]
[ |-A|\ [**+g**\ [*fill*]][**+o**\ *dx*\ [/*dy*]][**+p**\ *pen*][**+s**\ [*symbol*]\ *size*] ]
[ |SYN_OPT-B| ]
[ |-C|\ *cpt* ]
[ |-D|\ *depmin*/*depmax* ]
Expand Down Expand Up @@ -76,12 +76,18 @@ Optional Arguments

.. _-A:

**-A**\ [**+p**\ *pen*][**+s**\ *size*]
**-A**\ [**+g**\ [*fill*]][**+o**\ *dx*\ [/*dy*]][**+p**\ *pen*][**+s**\ [*symbol*]\ *size*] ]
Offsets focal mechanisms to the alternate longitudes, latitudes given
in the last two columns of the input file before the (optional) text
string. We will draw a line connecting the original and relocated
beachball positions and optionally place a small circle at the original
location. Use **+s**\ *size* to set the diameter of the circle [no circle].
string. Alternatively, use **+o** to interpret the contents of the two
columns as plot offsets instead, or append fixed offset *dx/dy* for all events.
We will draw a line connecting the original and relocated
beachball positions and optionally place a small symbol [circle] at the original
location. Use **+s**\ *size* to set the size of the symbol [no symbol].
Change from circle to any of the standard geometric symbols in :doc:`plot </plot>`,
i.e., **a**\|\ **c**\|\ **d**\|\ **g**\|\ **h**\|\ **i**\|\ **n**\|\ **p**\|\ **s**\|\ **t**\|\ **x** [**c**].
The symbol will be filled with the beachball color, but a fixed color (**+g**\ *fill*)
or no fill (**+g**) can be selected.
The line pen defaults to that given via |-W| but can be overridden
by using **+p**\ *pen* [0.25p].

Expand Down
1 change: 1 addition & 0 deletions doc/rst/source/supplements/seis/pscoupe.rst
Expand Up @@ -20,6 +20,7 @@ Synopsis
|-S|\ *format*\ [*scale*][**+a**\ *angle*][**+f**\ *font*][**+j**\ *justify*][**+l**][**+m**][**+o**\ *dx*\ [/*dy*]][**+s**\ *reference*]
[ |SYN_OPT-B| ]
[ |-C|\ *cpt* ]
[ |-D|\ [**+c**][**+g**\ [*fill*]][**+o**\ *dx*\ [/*dy*]][**+p**\ *pen*][**+s**\ [*symbol*]\ *size*] ]
[ |-E|\ *fill* ]
[ |-F|\ *mode*\ [*args*] ]
[ |-G|\ *fill* ]
Expand Down
2 changes: 1 addition & 1 deletion doc/rst/source/supplements/seis/psmeca.rst
Expand Up @@ -16,7 +16,7 @@ Synopsis
|-J|\ *parameters*
|SYN_OPT-R|
|-S|\ *format*\ [*scale*][**+a**\ *angle*][**+f**\ *font*][**+j**\ *justify*][**+l**][**+m**][**+o**\ *dx*\ [/*dy*]][**+s**\ *reference*]
[ |-A|\ [**+p**\ *pen*][**+s**\ *size*] ]
[ |-A|\ [**+g**\ [*fill*]][**+o**\ *dx*\ [/*dy*]][**+p**\ *pen*][**+s**\ [*symbol*]\ *size*] ]
[ |SYN_OPT-B| ]
[ |-C|\ *cpt* ]
[ |-D|\ *depmin*/*depmax* ]
Expand Down
4 changes: 2 additions & 2 deletions src/gmt_init.c
Expand Up @@ -3571,8 +3571,8 @@ GMT_LOCAL int gmtinit_set_env (struct GMT_CTRL *GMT) {
else if (err == 0) { /* Path already exists, check why */
if (!S_ISDIR (S.st_mode)) /* Path already exists, but it is not a directory */
GMT_Report (API, GMT_MSG_ERROR, "A file named %s already exist and prevents us creating a session directory by that name\n", API->session_dir);
else if (S_ISDIR (S.st_mode) && (S.st_mode & S_IWUSR) == 0) /* Directory already exists but is not writeable */
GMT_Report (API, GMT_MSG_ERROR, "Session directory %s already exist but is not writeable\n", API->session_dir);
else if (S_ISDIR (S.st_mode) && (S.st_mode & S_IWUSR) == 0) /* Directory already exists but is not writable */
GMT_Report (API, GMT_MSG_ERROR, "Session directory %s already exist but is not writable\n", API->session_dir);
}
}
if (GMT->session.USERDIR) GMT_Report (API, GMT_MSG_DEBUG, "GMT->session.USERDIR = %s [%s]\n", GMT->session.USERDIR, how[u]);
Expand Down
2 changes: 1 addition & 1 deletion src/seis/CMakeLists.txt
Expand Up @@ -25,7 +25,7 @@
#

set (SUPPL_NAME seis)
set (SUPPL_HEADERS meca.h meca_symbol.h utilmeca.h sacio.h)
set (SUPPL_HEADERS meca.h meca_symbol.h utilmeca.h seis_defaults.h sacio.h)
AUX_SOURCE_DIRECTORY (longopt SUPPL_LONG_OPT_H)
set (SUPPL_PROGS_SRCS psmeca.c pspolar.c pscoupe.c pssac.c ${SUPPL_LONG_OPT_H})
set (SUPPL_LIB_SRCS ${SUPPL_PROGS_SRCS} utilmeca.c sacio.c)
Expand Down
64 changes: 50 additions & 14 deletions src/seis/meca.h
Expand Up @@ -27,45 +27,81 @@
#include <stdio.h>
#include <math.h>

#define EPSIL 0.0001
#include "seis_defaults.h"

#define SEIS_MAG_REFERENCE 5.0 /* Reference magnitude for -S */
#define SEIS_MOMENT_MANT_REFERENCE 4.0 /* Mantissa for reference moment for -S */
#define SEIS_MOMENT_EXP_REFERENCE 23 /* Exponent for reference moment for -S */
#define SEIS_EPSILON 0.0001

/* Reading mode values for different formats */
#define SEIS_READ_CMT 0
#define SEIS_READ_AKI 1
#define SEIS_READ_PLANES 2
#define SEIS_READ_AXIS 4
#define SEIS_READ_TENSOR 8

#define SEIS_PLOT_DC 1
#define SEIS_PLOT_AXIS 2
#define SEIS_PLOT_TRACE 4
#define SEIS_PLOT_TENSOR 8

#define SEIS_CART_OFFSET 1 /* Cartesian plot offset in optional|trailing text */
#define SEIS_CART_OFFSET_FIX 2 /* Same, but given as fixed offset with +o on option line */

#define SEIS_EVENT_FILL 0 /* Default is to fill optional symbol with event color */
#define SEIS_FIXED_FILL 1 /* Used fixed color set via +g<fill> */
#define SEIS_NO_FILL 2 /* Skip filling the symbol */

#define squared(x) ((x) * (x))

struct AXIS {
#define SEIS_LINE_SYNTAX "[+g[<fill>]][+o[<dx>/<dy>]][+p<pen>][+s[<symbol>]<size>]"

enum Seis_scaletype {
SEIS_READ_SCALE = 0,
SEIS_CONST_SCALE = 1
};

struct SEIS_OFFSET_LINE {
bool active;
bool convert_geo; /* True if coupe -D+c, i.e., given geographical coordinates as alternate location */
unsigned int mode; /* 0-3 as above */
unsigned int symbol; /* Default to PSL_CIRCLE */
unsigned int fill_mode; /* Default to SEIS_EVENT_FILL */
double size; /* Circle size if drawn */
double off[2]; /* Cartesian offsets from actual location [0/0] */
struct GMT_PEN pen; /* Pen parameters controlling the line */
struct GMT_FILL fill; /* Fill parameters controlling the symbol fill */
};

struct SEIS_AXIS {
double str;
double dip;
double val;
int e;
};
/* val in 10**e dynes-cm */

struct MOMENT {
struct SEIS_MOMENT {
double mant;
int exponent;
};

struct nodal_plane {
struct SEIS_NODAL_PLANE {
double str;
double dip;
double rake;
};

struct MECHANISM {
struct nodal_plane NP1;
struct nodal_plane NP2;
struct MOMENT moment;
struct SEIS_MECHANISM {
struct SEIS_NODAL_PLANE NP1;
struct SEIS_NODAL_PLANE NP2;
struct SEIS_MOMENT moment;
double magms;
};

struct M_TENSOR {
struct SEIS_M_TENSOR {
int expo;
double f[6];
};
/* mrr mtt mff mrt mrf mtf in 10**expo dynes-cm */

typedef struct MOMENT st_mo;
typedef struct MECHANISM st_me;
typedef struct SEIS_MOMENT st_mo;
typedef struct SEIS_MECHANISM st_me;