diff --git a/src/seis/psmeca.c b/src/seis/psmeca.c index fb5f949..a34da01 100644 --- a/src/seis/psmeca.c +++ b/src/seis/psmeca.c @@ -103,6 +103,9 @@ struct PSMECA_CTRL { double offset[2]; struct GMT_FONT font; } S; + struct PSMECA_Q { /* -Q use linear scale */ + bool active; + } Q; struct PSMECA_T { /* -Tnplane[/] */ bool active; unsigned int n_plane; @@ -164,6 +167,7 @@ static void *New_Ctrl (struct GMT_CTRL *GMT) { /* Allocate and initialize a new C->D.depmin = -FLT_MAX; C->D.depmax = FLT_MAX; C->L.active = false; + C->Q.active = false; gmt_init_fill (GMT, &C->E.fill, 1.0, 1.0, 1.0); gmt_init_fill (GMT, &C->G.fill, 0.0, 0.0, 0.0); gmt_init_fill (GMT, &C->R2.fill, 1.0, 1.0, 1.0); @@ -191,7 +195,7 @@ static int usage (struct GMTAPI_CTRL *API, int level) { "-S[][+a][+f][+j][+o[/]] [-A[+p][+s]] [%s] " "[-C] [-D/] [-E] [-Fa[[/[]]]] [-Fe] [-Fg] " "[-Fr] [-Fp[]] [-Ft[]] [-Fz[]] [-G] [-H[]] [-I[]] %s[-L] [-M] " - "[-N] %s%s[-T[/]] [%s] [%s] [-W] [%s] [%s] %s[%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s]\n", + "[-N] %s%s[-Q] [-T[/]] [%s] [%s] [-W] [%s] [%s] %s[%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s]\n", name, GMT_J_OPT, GMT_Rgeo_OPT, GMT_B_OPT, API->K_OPT, API->O_OPT, API->P_OPT, GMT_U_OPT, GMT_V_OPT, GMT_X_OPT, GMT_Y_OPT, API->c_OPT, GMT_di_OPT, GMT_e_OPT, GMT_h_OPT, GMT_i_OPT, GMT_p_OPT, GMT_qi_OPT, GMT_tv_OPT, GMT_colon_OPT, GMT_PAR_OPT); @@ -264,6 +268,7 @@ static int usage (struct GMTAPI_CTRL *API, int level) { GMT_Usage (API, 1, "\n-M Set same size for any magnitude. Size is given with -S."); GMT_Usage (API, 1, "\n-N Do Not skip/clip symbols that fall outside map border [Default will ignore those outside]."); GMT_Option (API, "O,P"); + GMT_Usage (API, 1, "\n-Q scale beachballs with moment (linear) rather than magnitude (log) [off]"); GMT_Usage (API, 1, "\n-T[/]"); GMT_Usage (API, -2, "Draw specified nodal (s) and circumference only to provide a transparent beach ball " "using the current pen (see -W; or append alternative pen):"); @@ -493,6 +498,9 @@ static int parse (struct GMT_CTRL *GMT, struct PSMECA_CTRL *Ctrl, struct GMT_OPT case 'N': /* Do not skip points outside border */ Ctrl->N.active = true; break; + case 'Q': /* linear size scale */ + Ctrl->Q.active = true; + break; case 'S': /* Get format and size */ Ctrl->S.active = true; switch (opt->arg[0]) { /* parse format */ @@ -633,8 +641,8 @@ EXTERN_MSC int GMT_psmeca (void *V_API, int mode, void *args) { int n_rec = 0, n_plane_old = 0, error; int n_scanned = 0; unsigned int xcol = 0, scol = 0, icol = 0, tcol_f = 0, tcol_s = 0; - bool transparence_old = false, not_defined = false; - + bool transparence_old = false, not_defined = false, q_warned = false; + double plot_x, plot_y, plot_xnew, plot_ynew, delaz, *in = NULL; double t11 = 1.0, t12 = 0.0, t21 = 0.0, t22 = 1.0, xynew[2] = {0.0}; double scale, fault, depth, size, P_x, P_y, T_x, T_y, nominal_size; @@ -967,7 +975,15 @@ EXTERN_MSC int GMT_psmeca (void *V_API, int mode, void *args) { if (Ctrl->S.read) nominal_size = scale = in[scol]; moment.mant = meca.moment.mant; moment.exponent = meca.moment.exponent; - size = (meca_computed_mw(moment, meca.magms) / 5.0) * scale; + if (Ctrl->Q.active){ /* linear scaling, with some reference moment */ + if(!q_warned){ + GMT_Report (API, GMT_MSG_WARNING, "linear moment scaling selected.\n"); + q_warned = true; + } + size = moment.mant * pow(10,moment.exponent-26) * scale; + }else{ /* default */ + size = (meca_computed_mw(moment, meca.magms) / 5.0) * scale; + } if (Ctrl->H.active) { /* Variable scaling of symbol size and pen width */ double scl = (Ctrl->H.mode == PSMECA_READ_SCALE) ? in[xcol] : Ctrl->H.value; size *= scl;