From 193827578ed979bd39a21864741c0ac4c0c6b42a Mon Sep 17 00:00:00 2001 From: Joaquim Date: Sun, 3 Dec 2023 19:31:56 +0000 Subject: [PATCH] Add the missing rst's (??). Modernize the online help --- doc/rst/source/supplements/seis/shake.rst | 104 ++++++++++++++++++++++ doc/rst/source/supplements/seis/vs30.rst | 103 +++++++++++++++++++++ src/seis/shake.c | 80 +++++++++-------- src/seis/vs30.c | 59 +++++++----- 4 files changed, 288 insertions(+), 58 deletions(-) create mode 100644 doc/rst/source/supplements/seis/shake.rst create mode 100644 doc/rst/source/supplements/seis/vs30.rst diff --git a/doc/rst/source/supplements/seis/shake.rst b/doc/rst/source/supplements/seis/shake.rst new file mode 100644 index 00000000000..3fb179db752 --- /dev/null +++ b/doc/rst/source/supplements/seis/shake.rst @@ -0,0 +1,104 @@ +.. index:: ! shake +.. include:: ../module_supplements_purpose.rst_ + +***** +shake +***** + +|shake_purpose| + +Synopsis +-------- + +.. include:: ../../common_SYN_OPTs.rst_ + +**gmt shake** *ingrid* |-G|\ *outgrid* +|-L|\ [**-L**\ *fault.dat*] +|-M|\ [**-M**\ *mag*] +[ **-C**\ *a,v,i* ] +[ |-F|\ [**-F**\ *mecatype*] ] +[ |SYN_OPT-R| ] +[ |SYN_OPT-V| ] +[ |SYN_OPT-i| ] +[ |SYN_OPT-:| ] + +|No-spaces| + +Description +----------- + +Takes Vs30 velocity grid and compute the Peak Ground Acceleration/Velocity and Intensity + + +Required Arguments +------------------ + +*ingrid* + This is the input grid file. + +.. _-G: + +**-G**\ *outgrid* + This is the output grid file. If more than one component is set via -C then must contain %%s to format component code. + +.. _-L: + +**-L**\ *fault.dat* + Name of a file with the coordinates of the fault trace. + +.. _-M: + +**-M**\ *mag* + Select the magnitude of the event. + + +Optional Arguments +------------------ + +.. _-C: + +**-C**\ *a,v,i* + List of comma-separated components to be written as grids (requires -G). Choose from, *a*\ (cceleration), + *v*\ (elocity), *i*\ (ntensity) [Default is *i*]. + +.. _-F: + +**-F**\ *1*\|\ *2*\|\ *3*\|\ *4* + Select the focal mechanism type (e.g. -F1 or -F2 ...) + - 1 unknown [Default]. + - 2 strike-slip. + - 3 normal. + - 4 thrust. + +.. _-R: + +.. |Add_-R| replace:: This defines the subregion to be operated out. +.. include:: ../../explain_-R.rst_ + +.. _-V: + +.. |Add_-V| unicode:: 0x20 .. just an invisible code +.. include:: ../../explain_-V.rst_ + +.. include:: ../../explain_-icols.rst_ + +.. include:: ../../explain_colon.rst_ + +.. include:: ../../explain_help.rst_ + + +Examples +-------- + +To compute the intensity grid using the previously computed Vs30 velocities (*vs30.grd*) of an +event with magnitude 7 occurred along a fault whose trace is coordinates are provide in the +*line.dat* file, do:: + + gmt vs30.grd -Gshake_intensity.grd -Lline.dat -Ci -M7 -V + + +See Also +-------- + +:doc:`vs30`, +:doc:`gmt ` diff --git a/doc/rst/source/supplements/seis/vs30.rst b/doc/rst/source/supplements/seis/vs30.rst new file mode 100644 index 00000000000..f88f63a302b --- /dev/null +++ b/doc/rst/source/supplements/seis/vs30.rst @@ -0,0 +1,103 @@ +.. index:: ! vs30 +.. include:: ../module_supplements_purpose.rst_ + +***** +vs30 +***** + +|vs30_purpose| + +Synopsis +-------- + +.. include:: ../../common_SYN_OPTs.rst_ + +**gmt vs30** *ingrid* |-G|\ *outgrid* +|-C|\ [**-C**\ *val*\|\ *fname*[**+g**]] +[ |SYN_OPT-R| ] +[ |SYN_OPT-V| ] +[ |-W|\ [**-W**\ *water_vel*] ] +[ |SYN_OPT-i| ] +[ |SYN_OPT-r| ] +[ |SYN_OPT-:| ] + +|No-spaces| + +Description +----------- + +Takes one topographic grid in geographical coordinates and a constant craton value or a craton file +which are taken as weights ranging from 1 (one) on stable shields (craton) and 0 in active tectonic regions +-- values in between will be computed as the weighted average of the craton and tectonic models. + +An optional argument *water_vel* is the value that water-covered areas will be set to; the default is 600. + + +Required Arguments +------------------ + +*ingrid* + This is the input grid file. + +.. _-C: + +**-C**\ *val*\|\ *fname*[**+g**] + Argument *val* can be one of these three: + - A value *val* between 0 and 1, where 0 means a stable Craton and 1 an Active region. + - The name of a multi-segment file with the *cratons* polygons. In this case the polygons will be + feed to grdmask to compute a cratons/active tectonic mask. Use **-C**\ *@cratons.xy* to download + a cratons file from the GMT server. + - The name of a grid with the cratons/active tectonic regions. In this case the **+g** suffix + is mandatory to indicate that we are reading a grid. + +.. _-G: + +**-G**\ *outgrid* + This is the output grid file. + + +Optional Arguments +------------------ + +.. _-R: + +.. |Add_-R| replace:: This defines the subregion to be operated out. +.. include:: ../../explain_-R.rst_ + +.. _-W: + +**-W**\ *water_vel* + *water_vel* sets the Vs30 value used in areas designated as water in the landmask [default=600] + +.. _-V: + +.. |Add_-V| unicode:: 0x20 .. just an invisible code +.. include:: ../../explain_-V.rst_ + +.. include:: ../../explain_-icols.rst_ + +.. include:: ../../explain_-r.rst_ + +.. include:: ../../explain_colon.rst_ + +.. include:: ../../explain_help.rst_ + + +Examples +-------- + +To compute a Vs30 estimate of the *topo.grd* grid and a craton value of 0, do:: + + gmt vs30 topo.grd -C0 -Gvs30.grd -V + + +Reference +--------- + +- https://github.com/usgs/earthquake-global_vs30/blob/master/src/grad2vs30.c + +See Also +-------- + +:doc:`shake`, +:doc:`gmt ` diff --git a/src/seis/shake.c b/src/seis/shake.c index 76aff135dde..1429467f2fd 100644 --- a/src/seis/shake.c +++ b/src/seis/shake.c @@ -104,30 +104,37 @@ static char set_unit_and_mode (char *arg, unsigned int *mode) { static int usage (struct GMTAPI_CTRL *API, int level) { const char *name = gmt_show_name_and_purpose (API, THIS_MODULE_LIB, THIS_MODULE_CLASSIC_NAME, THIS_MODULE_PURPOSE); - if (level == GMT_MODULE_PURPOSE) return (GMT_NOERROR); - GMT_Message (API, GMT_TIME_NONE, "usage: %s -G -L | -Dx0y0/x1/y1 -M [-Ca,v,i] [-F] [%s] [%s] [%s]\n", - name, GMT_Rgeoz_OPT, GMT_V_OPT, GMT_f_OPT); + GMT_Usage (API, 0, "usage: %s -G -L | -Dx0y0/x1/y1 -M [-Ca,v,i] [-F] [%s] [%s] [%s]\n", name, GMT_Rgeoz_OPT, GMT_V_OPT, GMT_f_OPT); if (level == GMT_SYNOPSIS) return (GMT_MODULE_SYNOPSIS); - GMT_Message (API, GMT_TIME_NONE, "\t The grid with the Vs30 velocities.\n"); - GMT_Message (API, GMT_TIME_NONE, "\t-G Specify file name for output grid file(s).\n"); - GMT_Message (API, GMT_TIME_NONE, "\t If more than one component is set via -C then must contain %%s to format component code.\n"); - GMT_Message (API, GMT_TIME_NONE, "\t-D x0/y0/x1/y1 End points of the fault trace.\n"); - GMT_Message (API, GMT_TIME_NONE, "\t-L Alternatively provide a name of a file with the coordinates of the fault trace.\n"); - GMT_Message (API, GMT_TIME_NONE, "\t-M Select magnitude.\n"); - GMT_Message (API, GMT_TIME_NONE, "\n\tOPTIONS:\n"); + GMT_Message (API, GMT_TIME_NONE, " REQUIRED ARGUMENTS:\n"); + gmt_ingrid_syntax (API, 0, "Name of grid (or image) to extract a subset from"); + gmt_outgrid_syntax (API, 'G', "Set name of the output grid file"); + GMT_Usage (API, -2, "If more than one component is set via -C then must contain %%s to format component code.\n"); + GMT_Usage (API, 1, "\n-D"); + GMT_Usage (API, -2, "End points of the fault trace."); + GMT_Usage (API, 1, "\n-L"); + GMT_Usage (API, -2, "Alternatively provide a name of a file with the coordinates of the fault trace."); + GMT_Usage (API, 1, "\n-M"); + GMT_Usage (API, -2, "Select the seism magnitude."); + + GMT_Message (API, GMT_TIME_NONE, "\n OPTIONAL ARGUMENTS:\n"); + GMT_Usage (API, 1, "\n-C[a|v|i]"); if (API->external) - GMT_Message (API, GMT_TIME_NONE, "\t-C List of comma-separated components to be written as grids. Choose from\n"); + GMT_Usage (API, -2, "List of comma-separated components to be written as grids. Choose from:"); else - GMT_Message (API, GMT_TIME_NONE, "\t-C List of comma-separated components to be written as grids (requires -G). Choose from\n"); - GMT_Message (API, GMT_TIME_NONE, "\t a, v, i. [Default is i(ntensity)].\n"); - GMT_Message (API, GMT_TIME_NONE, "\t-F Select focal mechanism type (e.g. -F1 or -F2 ...).\n"); - GMT_Message (API, GMT_TIME_NONE, "\t 1 unknown [Default].\n"); - GMT_Message (API, GMT_TIME_NONE, "\t 2 strike-slip.\n"); - GMT_Message (API, GMT_TIME_NONE, "\t 3 normal.\n"); - GMT_Message (API, GMT_TIME_NONE, "\t 4 thrust.\n\n"); + GMT_Usage (API, -2, "List of comma-separated components to be written as grids (requires -G). Choose from:"); + GMT_Usage (API, 3, "a (acceleration)"); + GMT_Usage (API, 3, "v (velocity)"); + GMT_Usage (API, 3, "i (intensity). This is the default."); + GMT_Usage (API, 1, "\n-F[1|2|3|4]"); + GMT_Usage (API, -2, "Select focal mechanism type (e.g. -F1 or -F2 ...)."); + GMT_Usage (API, 3, "- 1 unknown [Default]."); + GMT_Usage (API, 3, "- 2 strike-slip."); + GMT_Usage (API, 3, "- 3 normal."); + GMT_Usage (API, 3, "- 4 thrust."); GMT_Option (API, "R,V"); GMT_Option (API, "f,i,:"); @@ -143,7 +150,7 @@ static int parse (struct GMT_CTRL *GMT, struct SHAKE_CTRL *Ctrl, struct GMT_Z_IO * returned when registering these sources/destinations with the API. */ - unsigned int n, n_errors = 0, n_files = 0, pos = 0; + unsigned int n_errors = 0, n_files = 0, pos = 0; char txt_a[GMT_LEN256] = {""}, p[GMT_LEN16] = {""}; struct GMT_OPTION *opt = NULL; struct GMTAPI_CTRL *API = GMT->parent; @@ -165,7 +172,7 @@ static int parse (struct GMT_CTRL *GMT, struct SHAKE_CTRL *Ctrl, struct GMT_Z_IO /* Processes program-specific parameters */ case 'C': /* Requires -G and selects which components should be written as grids */ - Ctrl->C.active = true; + n_errors += gmt_M_repeated_module_option (API, Ctrl->C.active); while ((gmt_strtok (opt->arg, ",", &pos, p)) && Ctrl->C.n_selected < 3) { switch (p[0]) { case 'a': Ctrl->C.selected[0] = Ctrl->G.do_PGA = true; break; @@ -186,7 +193,7 @@ static int parse (struct GMT_CTRL *GMT, struct SHAKE_CTRL *Ctrl, struct GMT_Z_IO } break; case 'D': /* x0/y0[x1/y1] */ - Ctrl->D.active = true; + n_errors += gmt_M_repeated_module_option (API, Ctrl->D.active); Ctrl->D.line = strdup (opt->arg); break; case 'G': /* Output filename */ @@ -205,13 +212,13 @@ static int parse (struct GMT_CTRL *GMT, struct SHAKE_CTRL *Ctrl, struct GMT_Z_IO } break; case 'F': - Ctrl->F.active = true; + n_errors += gmt_M_repeated_module_option (API, Ctrl->F.active); Ctrl->F.imeca = atoi (opt->arg); if (Ctrl->F.imeca < 1 || Ctrl->F.imeca > 4) GMT_Report (GMT->parent, GMT_MSG_NORMAL, "-F error. 'type' must be in [1 4]\n"); break; case 'L': /* -L[+u[+|-]] */ - Ctrl->L.active = true; + n_errors += gmt_M_repeated_module_option (API, Ctrl->L.active); Ctrl->L.file = gmt_get_filename(API, opt->arg, "u"); if (!gmt_check_filearg (GMT, 'L', Ctrl->L.file, GMT_IN, GMT_IS_DATASET)) { GMT_Report (GMT->parent, GMT_MSG_NORMAL, "-L error. Must provide either an existing file name or line coordinates.\n"); @@ -219,7 +226,7 @@ static int parse (struct GMT_CTRL *GMT, struct SHAKE_CTRL *Ctrl, struct GMT_Z_IO } break; case 'M': - Ctrl->M.active = true; + n_errors += gmt_M_repeated_module_option (API, Ctrl->M.active); Ctrl->M.rmw = atof(opt->arg); break; default: /* Report bad options */ @@ -283,7 +290,7 @@ EXTERN_MSC int GMT_shake (void *V_API, int mode, void *args) { Ctrl = New_Ctrl (GMT); /* Allocate and initialize a new control structure */ if ((error = parse (GMT, Ctrl, &io, options)) != 0) Return (error); - /*---------------------------- This is the grd2xyz main code ----------------------------*/ + /*---------------------------- This is the grdshake main code ----------------------------*/ gmt_M_memcpy (wesn, GMT->common.R.wesn, 4, double); /* Current -R setting, if any */ @@ -291,7 +298,7 @@ EXTERN_MSC int GMT_shake (void *V_API, int mode, void *args) { if ((G = GMT_Read_Data (API, GMT_IS_GRID, GMT_IS_FILE, GMT_IS_SURFACE, GMT_CONTAINER_ONLY, NULL, Ctrl->In.file, NULL)) == NULL) /* Get header only */ Return (API->error); - if (gmt_M_is_subset (GMT, G->header, wesn)) /* If subset requested make sure wesn matches header spacing */ + if (gmt_M_is_subset (GMT, G->header, wesn)) /* If subset requested make sure wesn matches header spacing */ gmt_M_err_fail (GMT, gmt_adjust_loose_wesn (GMT, wesn, G->header), ""); /* Read data */ @@ -344,7 +351,7 @@ EXTERN_MSC int GMT_shake (void *V_API, int mode, void *args) { gmt_set_segmentheader (GMT, GMT_OUT, false); /* Since processing of -L file might have turned it on [should be determined below] */ } - xyline = Lin->table[0]; /* Can only be one table since we read a single file */ + xyline = Lin->table[0]; /* It can only be one table since we read a single file */ if (proj_type == GMT_GEO2CART) { /* Must convert the line points first */ for (seg = 0; seg < xyline->n_segments; seg++) { @@ -376,10 +383,10 @@ EXTERN_MSC int GMT_shake (void *V_API, int mode, void *args) { u = ss = rns = 0; rs = 1; } - /* - ------------------------------------------------------------ - ! calcula o termo de magnitude scaling para o pga e pgv - ! nao depende da distancia mas apenas da magnitude - ! ------------------------------------------------------------- */ + /* ------------------------------------------------------------- + compute the term of magnitude scaling for the pga and pgv. + It doesn't depend on the distance but only on magnitude. + ------------------------------------------------------------- */ rmh_pga = 6.75; rmh_pgv = 8.50; rfm_pga = -0.53804*u - 0.50350*ss - 0.75472*rns - 0.50970*rs; @@ -405,7 +412,6 @@ EXTERN_MSC int GMT_shake (void *V_API, int mode, void *args) { for (i = 0; i < G->header->n_columns; i++, k++) { rlon = G->header->wesn[XLO] + i * G->header->inc[GMT_X]; ij = gmt_M_ijp(G->header, j, i); - //ij = k; (void)gmt_near_lines (GMT, rlon, rlat, xyline, Ctrl->L.mode, &dist, &xnear, &ynear); @@ -415,9 +421,7 @@ EXTERN_MSC int GMT_shake (void *V_API, int mode, void *args) { rfd_pgv = (-0.87370+0.10060*(Ctrl->M.rmw-4.5))*log(r_pgv/1.0) - 0.00334*(r_pgv-1.0); rfd_pga4nl = (-0.66050+0.11970*(Ctrl->M.rmw-4.5))*log(r_pga/5.0) - 0.01151*(r_pga-5.0); - /* ------------------------------------------------------------- - ! calcula o efeito de sitio - ! ------------------------------------------------------------- */ + /* Compute the site effect */ tmp = log(G->data[ij] / 760); flin_pga = -0.360 * tmp; flin_pgv = -0.600 * tmp; @@ -442,7 +446,7 @@ EXTERN_MSC int GMT_shake (void *V_API, int mode, void *args) { bnl_pga = bnl_pgv = 0.; } - /* ---- verificar se as condicoes s�o sempre em pga !!!!!!!!!!!!!!!!!!!!! */ + /* ---- check if the conditions are always in pga */ c_pga = +bnl_pga * k2; d_pga = -bnl_pga * k3; c_pgv = +bnl_pgv * k2; d_pgv = -bnl_pgv * k3; @@ -484,7 +488,7 @@ EXTERN_MSC int GMT_shake (void *V_API, int mode, void *args) { if (GMT_Set_Comment (API, GMT_IS_GRID, GMT_COMMENT_IS_OPTION | GMT_COMMENT_IS_COMMAND, options, Grid[k])) Return (API->error); - if (!API->external) kk = k; /* On command line we pick item k from an array of 3 items */ + if (!API->external) kk = k; /* On command line we pick item k from an array of 3 items */ if (strstr (Ctrl->G.file[kk], "%s")) sprintf (file, Ctrl->G.file[kk], code[k]); else @@ -493,7 +497,7 @@ EXTERN_MSC int GMT_shake (void *V_API, int mode, void *args) { if (GMT_Write_Data (API, GMT_IS_GRID, GMT_IS_FILE, GMT_IS_SURFACE, GMT_CONTAINER_AND_DATA, NULL, file, Grid[k]) != GMT_NOERROR) { Return (API->error); } - kk++; /* For the external interface we take them in the order given as there is not an array of 3 */ + kk++; /* For the externals interface we take them in the given order */ } if (Ctrl->L.active) diff --git a/src/seis/vs30.c b/src/seis/vs30.c index f0eaff114bb..df0d4ae4999 100644 --- a/src/seis/vs30.c +++ b/src/seis/vs30.c @@ -1,3 +1,21 @@ +/*-------------------------------------------------------------------- + * + * Copyright (c) 1991-2020 by the GMT Team (https://www.generic-mapping-tools.org/team.html) + * See LICENSE.TXT file for copying and redistribution conditions. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; version 3 or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * Contact info: www.generic-mapping-tools.org + *--------------------------------------------------------------------*/ +/* + /* * grad2vs30: convert topographic slope to Vs30 * @@ -25,9 +43,6 @@ * Additionally, we waive copyright and related rights in the work worldwide through the CC0 1.0 * Universal public domain dedication. * - * The getpar package (src/getpar.c, src/libget.h, src/getpar.3) is included with the express - * permission of the author, Robert W. Clayton. - * * J. Luis * re-writen after https://github.com/usgs/earthquake-global_vs30/blob/master/src/grad2vs30.c * Version: 6 API @@ -113,26 +128,29 @@ double craton_table[6][4] = static int usage (struct GMTAPI_CTRL *API, int level) { const char *name = gmt_show_name_and_purpose (API, THIS_MODULE_LIB, THIS_MODULE_CLASSIC_NAME, THIS_MODULE_PURPOSE); - if (level == GMT_MODULE_PURPOSE) return (GMT_NOERROR); - GMT_Message (API, GMT_TIME_NONE, "usage: %s -G [-C|fname[+g]] [-W] [%s] [%s]\n", - name, GMT_Rgeoz_OPT, GMT_V_OPT); + GMT_Usage (API, 0, "usage: %s -G [-C|fname[+g]] [-W] [%s] [%s]\n", + name, GMT_Rgeoz_OPT, GMT_V_OPT); if (level == GMT_SYNOPSIS) return (GMT_MODULE_SYNOPSIS); - GMT_Message (API, GMT_TIME_NONE, "\t The input grid name of the topography.\n"); - GMT_Message (API, GMT_TIME_NONE, "\t-G File name for output grid with the Vs30 velocities.\n"); - GMT_Message (API, GMT_TIME_NONE, "\t-C Argument can be one of three:\n"); - GMT_Message (API, GMT_TIME_NONE, "\t - A value between 0 and 1, where 0 means a stable Craton and 1 an Active region.\n"); - GMT_Message (API, GMT_TIME_NONE, "\t - The name of a multi-segment file with the 'cratons' polygons. In this case the\n"); - GMT_Message (API, GMT_TIME_NONE, "\t polygons will be feed to grdmask to compute a cratons/active tectonic mask.\n"); - GMT_Message (API, GMT_TIME_NONE, "\t - The name of a grid with the cratons/active tectonic regions.\n"); - GMT_Message (API, GMT_TIME_NONE, "\n\tOPTIONS:\n"); - GMT_Message (API, GMT_TIME_NONE, "\t-W water_vel sets the Vs30 value used in areas designated as water in the\n"); - GMT_Message (API, GMT_TIME_NONE, "\t landmask [default=600]\n\n"); + GMT_Message (API, GMT_TIME_NONE, " REQUIRED ARGUMENTS:\n"); + gmt_ingrid_syntax (API, 0, "Name of grid (or image) to extract a subset from"); + gmt_outgrid_syntax (API, 'G', "Set name of the output grid file"); + GMT_Usage (API, 1, "\n-C[+g]"); + GMT_Usage (API, -2, "Argument can be one of three:"); + GMT_Usage (API, 3, "- A value between 0 and 1, where 0 means a stable Craton and 1 an Active region."); + GMT_Usage (API, 3, "- The name of a multi-segment file with the 'cratons' polygons. In this case the " + "polygons will be feed to grdmask to compute a cratons/active tectonic mask." + "In this case the +g suffix is mandatory to indicate that we are reading a grid."); + GMT_Usage (API, 3, "- The name of a grid with the cratons/active tectonic regions."); + + GMT_Message (API, GMT_TIME_NONE, "\n OPTIONAL ARGUMENTS:\n"); + GMT_Usage (API, 1, "\n-W"); + GMT_Usage (API, -2, "'water_vel' sets the Vs30 value used in areas designated as water in the landmask [default=600]"); GMT_Option (API, "R,V"); GMT_Option (API, "bi,i,r,:"); - + return (GMT_MODULE_USAGE); } @@ -166,7 +184,7 @@ static int parse (struct GMT_CTRL *GMT, struct VS30_CTRL *Ctrl, struct GMT_Z_IO /* Processes program-specific parameters */ case 'C': /* Polygon file with the Cratons limits */ - Ctrl->C.active = true; + n_errors += gmt_M_repeated_module_option (API, Ctrl->C.active); Ctrl->C.file = gmt_get_filename (API, opt->arg, ""); if ((pch = strstr(opt->arg, "+g")) != NULL) Ctrl->C.is_grid = true; /* Useless if Ctrl->C.file = NULL is set below */ @@ -181,7 +199,8 @@ static int parse (struct GMT_CTRL *GMT, struct VS30_CTRL *Ctrl, struct GMT_Z_IO } break; case 'G': /* Output file */ - if ((Ctrl->G.active = gmt_check_filearg (GMT, 'G', opt->arg, GMT_OUT, GMT_IS_GRID))) + n_errors += gmt_M_repeated_module_option (API, Ctrl->G.active); + if (!gmt_check_filearg (GMT, 'G', opt->arg, GMT_OUT, GMT_IS_GRID)) Ctrl->G.file = strdup (opt->arg); else n_errors++; @@ -230,7 +249,7 @@ static int check_grid_compat (struct GMTAPI_CTRL *API, struct GMT_GRID *A, struc * function a #define for speed, but the execution time is utterly dwarfed by the read/write * times so there was no point.) */ -inline double interpVs30(double *tt, double lg) { +static inline double interpVs30(double *tt, double lg) { return exp(tt[0] + (tt[1] - tt[0]) * (lg - tt[2]) / (tt[3] - tt[2])); }