Skip to content

Commit

Permalink
Rename shake & vs30 (#8127)
Browse files Browse the repository at this point in the history
* Change internal references to shake to grdshake and same for vs30

* Rename the shake rst's

* Rename the C sources too.

* Cosmetics

* Update doc/rst/source/reference/supplemental-packages.rst

Co-authored-by: Dongdong Tian <[email protected]>

* REviews

---------

Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Paul Wessel <[email protected]>
  • Loading branch information
3 people authored Dec 4, 2023
1 parent 98bcb45 commit 73e6577
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 71 deletions.
26 changes: 13 additions & 13 deletions doc/rst/source/modules-classic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -714,19 +714,19 @@ SEGY
seis
----

+----------------------------------+--------------------+
| :doc:`/supplements/seis/pscoupe` | |pscoupe_purpose| |
+----------------------------------+--------------------+
| :doc:`/supplements/seis/psmeca` | |psmeca_purpose| |
+----------------------------------+--------------------+
| :doc:`/supplements/seis/pspolar` | |pspolar_purpose| |
+----------------------------------+--------------------+
| :doc:`/supplements/seis/pssac` | |pssac_purpose| |
+----------------------------------+--------------------+
| :doc:`/supplements/seis/shake` | |shake_purpose| |
+--------------------------------+----------------------+
| :doc:`/supplements/seis/vs30` | |vs30_purpose| |
+--------------------------------+----------------------+
+-----------------------------------+--------------------+
| :doc:`/supplements/seis/pscoupe` | |pscoupe_purpose| |
+-----------------------------------+--------------------+
| :doc:`/supplements/seis/psmeca` | |psmeca_purpose| |
+-----------------------------------+--------------------+
| :doc:`/supplements/seis/pspolar` | |pspolar_purpose| |
+-----------------------------------+--------------------+
| :doc:`/supplements/seis/pssac` | |pssac_purpose| |
+-----------------------------------+--------------------+
| :doc:`/supplements/seis/grdshake` | |grdshake_purpose| |
+---------------------------------+----------------------+
| :doc:`/supplements/seis/grdvs30` | |grdvs30_purpose| |
+---------------------------------+----------------------+

spotter
-------
Expand Down
30 changes: 15 additions & 15 deletions doc/rst/source/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ All modules are requested via a call to the :doc:`gmt` program.
supplements/seis/meca
supplements/seis/polar
supplements/seis/sac
supplements/seis/shake
supplements/seis/vs30
supplements/seis/grdshake
supplements/seis/grdvs30
supplements/spotter/backtracker
supplements/spotter/gmtpmodeler
supplements/spotter/grdpmodeler
Expand Down Expand Up @@ -740,19 +740,19 @@ SEGY
seis
----

+--------------------------------+------------------+
| :doc:`/supplements/seis/coupe` | |coupe_purpose| |
+--------------------------------+------------------+
| :doc:`/supplements/seis/meca` | |meca_purpose| |
+--------------------------------+------------------+
| :doc:`/supplements/seis/polar` | |polar_purpose| |
+--------------------------------+------------------+
| :doc:`/supplements/seis/sac` | |sac_purpose| |
+--------------------------------+------------------+
| :doc:`/supplements/seis/shake` | |shake_purpose| |
+--------------------------------+------------------+
| :doc:`/supplements/seis/vs30` | |vs30_purpose| |
+--------------------------------+------------------+
+-----------------------------------+--------------------+
| :doc:`/supplements/seis/coupe` | |coupe_purpose| |
+-----------------------------------+--------------------+
| :doc:`/supplements/seis/meca` | |meca_purpose| |
+-----------------------------------+--------------------+
| :doc:`/supplements/seis/polar` | |polar_purpose| |
+-----------------------------------+--------------------+
| :doc:`/supplements/seis/sac` | |sac_purpose| |
+-----------------------------------+--------------------+
| :doc:`/supplements/seis/grdshake` | |grdshake_purpose| |
+-----------------------------------+--------------------+
| :doc:`/supplements/seis/grdvs30` | |grdvs30_purpose| |
+-----------------------------------+--------------------+

spotter
-------
Expand Down
4 changes: 2 additions & 2 deletions doc/rst/source/reference/supplemental-packages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ This package contains the programs
:doc:`meca </supplements/seis/meca>`,
:doc:`polar </supplements/seis/polar>`,
:doc:`sac </supplements/seis/sac>`,
:doc:`sac </supplements/seis/vs30>`, and
:doc:`sac </supplements/seis/shake>`, which are used by seismologists
:doc:`grdvs30 </supplements/seis/grdvs30>`, and
:doc:`grdshake </supplements/seis/grdshake>`, which are used by seismologists
for plotting focal mechanisms (including cross-sections
and polarities), compute Vs30 velocities, intensity maps and SAC files.
The coupe, meca, and polar were developed by Kurt Feigl and Genevieve
Expand Down
4 changes: 2 additions & 2 deletions doc/rst/source/supplements/module_supplements_purpose.rst_
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@

.. |rotsmoother_purpose| replace:: Get mean rotations and covariance matrices from set of finite rotations

.. |shake_purpose| replace:: Compute Peak Ground Acceleration/Velocity and Intensity
.. |grdshake_purpose| replace:: Compute Peak Ground Acceleration/Velocity and Intensity

.. |vs30_purpose| replace:: Convert topographic slope to Vs30 velocities
.. |grdvs30_purpose| replace:: Convert topographic slope to Vs30 velocities

.. |x2sys_binlist_purpose| replace:: Create bin index listing from track data files

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
.. index:: ! shake
.. index:: ! grdshake
.. include:: ../module_supplements_purpose.rst_

*****
shake
*****
********
grdshake
********

|shake_purpose|
|grdshake_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*] ]
**gmt grdshake** *ingrid* |-G|\ *outgrid*
|-L|\ *fault.dat*
|-M|\ *mag*
[ |-C|\ *a,v,i* ]
[ |-F|\ *mecatype* ]
[ |SYN_OPT-R| ]
[ |SYN_OPT-V| ]
[ |SYN_OPT-i| ]
Expand Down Expand Up @@ -94,11 +94,11 @@ To compute the intensity grid using the previously computed Vs30 velocities (*vs
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
gmt grdshake vs30.grd -Gshake_intensity.grd -Lline.dat -Ci -M7 -V


See Also
--------

:doc:`vs30`,
:doc:`grdvs30`,
:doc:`gmt </gmt>`
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
.. index:: ! vs30
.. index:: ! grdvs30
.. include:: ../module_supplements_purpose.rst_

*****
vs30
*****
*******
grdvs30
*******

|vs30_purpose|
|grdvs30_purpose|

Synopsis
--------

.. include:: ../../common_SYN_OPTs.rst_

**gmt vs30** *ingrid* |-G|\ *outgrid*
|-C|\ [**-C**\ *val*\|\ *fname*[**+g**]]
**gmt grdvs30** *ingrid* |-G|\ *outgrid*
|-C|\ *val*\|\ *fname*\ [**+g**]
[ |SYN_OPT-R| ]
[ |SYN_OPT-V| ]
[ |-W|\ [**-W**\ *water_vel*] ]
[ |-W|\ *water_vel* ]
[ |SYN_OPT-i| ]
[ |SYN_OPT-r| ]
[ |SYN_OPT-:| ]
Expand All @@ -41,7 +41,7 @@ Required Arguments

.. _-C:

**-C**\ *val*\|\ *fname*[**+g**]
**-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
Expand Down Expand Up @@ -88,7 +88,7 @@ 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
gmt grdvs30 topo.grd -C0 -Gvs30.grd -V


Reference
Expand All @@ -99,5 +99,5 @@ Reference
See Also
--------

:doc:`shake`,
:doc:`grdshake`,
:doc:`gmt </gmt>`
2 changes: 1 addition & 1 deletion src/seis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
set (SUPPL_NAME seis)
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 shake.c vs30.c ${SUPPL_LONG_OPT_H})
set (SUPPL_PROGS_SRCS psmeca.c pspolar.c pscoupe.c pssac.c grdshake.c grdvs30.c ${SUPPL_LONG_OPT_H})
set (SUPPL_LIB_SRCS ${SUPPL_PROGS_SRCS} utilmeca.c sacio.c)
set (SUPPL_EXAMPLE_FILES README.seis)
8 changes: 4 additions & 4 deletions src/seis/shake.c → src/seis/grdshake.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

#include "gmt_dev.h"

#define THIS_MODULE_CLASSIC_NAME "shake"
#define THIS_MODULE_MODERN_NAME "shake"
#define THIS_MODULE_CLASSIC_NAME "grdshake"
#define THIS_MODULE_MODERN_NAME "grdshake"
#define THIS_MODULE_LIB "seis"
#define THIS_MODULE_PURPOSE "Compute Peak Ground Acceleration/Velocity and Intensity."
#define THIS_MODULE_KEYS "<G{,LD(=,GG}"
Expand Down Expand Up @@ -142,7 +142,7 @@ static int usage (struct GMTAPI_CTRL *API, int level) {


static int parse (struct GMT_CTRL *GMT, struct SHAKE_CTRL *Ctrl, struct GMT_Z_IO *io, struct GMT_OPTION *options) {
/* This parses the options provided to shake and sets parameters in Ctrl.
/* This parses the options provided to grdshake and sets parameters in Ctrl.
* Note Ctrl has already been initialized and non-zero default values set.
* Any GMT common options will override values set previously by other commands.
* It also replaces any file names specified as input or output with the data ID
Expand Down Expand Up @@ -251,7 +251,7 @@ static int parse (struct GMT_CTRL *GMT, struct SHAKE_CTRL *Ctrl, struct GMT_Z_IO
#define Return(code) {Free_Ctrl (GMT, Ctrl); gmt_end_module (GMT, GMT_cpy); bailout (code);}

/* --------------------------------------------------------------------------------- */
EXTERN_MSC int GMT_shake (void *V_API, int mode, void *args) {
EXTERN_MSC int GMT_grdshake (void *V_API, int mode, void *args) {
uint64_t i, j, ij, k, kk, row, seg;
int error = 0, way, proj_type = 0; /* Geographic */
char file[GMT_LEN512] = {""}, *code[3] = {"a", "v", "i"};
Expand Down
17 changes: 6 additions & 11 deletions src/seis/vs30.c → src/seis/grdvs30.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@
* Version: 6 API
*/

//shake vs30.grd -Glixo.grd -Lline.dat+uk -Ci -Vl -Rvs30.grd

#include "gmt_dev.h"

#define THIS_MODULE_CLASSIC_NAME "vs30"
#define THIS_MODULE_MODERN_NAME "vs30"
#define THIS_MODULE_CLASSIC_NAME "grdvs30"
#define THIS_MODULE_MODERN_NAME "grdvs30"
#define THIS_MODULE_LIB "seis"
#define THIS_MODULE_PURPOSE "Compute VS30"
#define THIS_MODULE_KEYS "<G{,CD(=,GG}"
Expand Down Expand Up @@ -227,16 +225,16 @@ static int check_grid_compat (struct GMTAPI_CTRL *API, struct GMT_GRID *A, struc
*/
if (fabs((A->header->inc[GMT_X] - B->header->inc[GMT_X]) / A->header->inc[GMT_X]) > 0.002 ||
fabs((A->header->inc[GMT_Y] - B->header->inc[GMT_Y]) / A->header->inc[GMT_Y]) > 0.002)
return 1;
return 1;

if (fabs((A->header->wesn[XLO] - B->header->wesn[XLO]) / A->header->inc[GMT_X]) > 0.2 ||
fabs((A->header->wesn[XHI] - B->header->wesn[XHI]) / A->header->inc[GMT_X]) > 0.2 ||
fabs((A->header->wesn[YLO] - B->header->wesn[YLO]) / A->header->inc[GMT_Y]) > 0.2 ||
fabs((A->header->wesn[YHI] - B->header->wesn[YHI]) / A->header->inc[GMT_Y]) > 0.2)
return 2;
return 2;

if (A->header->registration != B->header->registration)
return 3;
return 3;

return 0;
}
Expand All @@ -256,7 +254,7 @@ static inline double interpVs30(double *tt, double lg) {
#define Return(code) {Free_Ctrl (GMT, Ctrl); gmt_end_module (GMT, GMT_cpy); bailout (code);}

/* --------------------------------------------------------------------------------- */
EXTERN_MSC int GMT_vs30 (void *V_API, int mode, void *args) {
EXTERN_MSC int GMT_grdvs30 (void *V_API, int mode, void *args) {
unsigned int row, col, j, nr, k;
uint64_t ij;
int error = 0;
Expand Down Expand Up @@ -453,9 +451,6 @@ EXTERN_MSC int GMT_vs30 (void *V_API, int mode, void *args) {
/* Do a weighted average of craton and active vs30 */
Gout->data[ij] = (float)(crat * tvs[0] + (1.0 - crat) * tvs[1]);
}

//if (row % 100 == 0)
//GMT_Report (API, GMT_MSG_VERBOSE, "Done with %ld of %ld elements\r", row * Gout->header->n_columns, Gout->header->nm);
}

GMT_Report (API, GMT_MSG_VERBOSE, "Writing output file...\n");
Expand Down

0 comments on commit 73e6577

Please sign in to comment.