Read and plot the snapshot-form output of PSGRN/PSCMP (Wang et al., 2006) and QSSPSTATIC (Wang et al., 2017), using GMT and Matlab, via GMT-MEX.
Both codes are aimed at computing co- and post-seismic deformation (and other geophysical observables, e.g. gravity, tilt) due to dislocations (mostly earthquakes). Snapshot outputs provide all observables, at all computation points, at a given time. PSGRN/PSCMP models a multi-layered half-space, the so called "flat earth" approximation, while QSSP does so in a spherical earth domain.
This is an overly simplified explanation, to provide context for anyone unfamiliar with the codes.
Refer to the codes authors' papers linked above and note that I am implying no endorsement by their authors.
To do: document the example.
-
GMT and GMT-MEX, note that building GMT-MEX on Linux is not trivial (see this gmt-mex issue)
-
No reliance on any Matlab toolbox (checked with matlab.codetools.requiredFilesAndProducts). GNU/Octave compatiblity needs to be assessed.
This was started as a mean to plot maps for an ad-hoc case, with a comfortable level of automation, as achievable under under quite tight deadlines :)
(and I am not actively maintaining it, since the set goals were met)
Specific issues aside, it has two main pitfalls:
-
performing the "snapshot file to maps" step is meant to be abstracted by
gmtMexGrid2grd
. There is no "one size fits all" solution and automating some parameters (chiefly: major and minor ticks for z-contours and colormap extents) is prone to breaking easily. Map are still produced, but may end up ranging from somewhat unclear to outright ugly. This issue presented clearly already in the specific use case for which these functions were written - choices made in the automation of plotting parameters were hand tailored around those problems. In general use, expect having to fine-tune some parameters which are not exposed as arguments (and should be). So: it is quite a leaky abstraction. 😅 -
gmtMexGrid2grd
is quite a monolithic do-it-all function: data loading and processing are kept together with plot production. A radical refactor, defining a "snapshot" class, constitutes a good starting point for improvement.
In addition to these, tests are missing.