GithubHelp home page GithubHelp logo

michaelgrund / gmt-plotting Goto Github PK

View Code? Open in Web Editor NEW
98.0 2.0 24.0 256.81 MB

Collection of GMT (Generic Mapping Tools) scripts, jupyter notebooks (using PyGMT) and files (including digitized map content, colormaps, grid files etc.)

Shell 0.08% GLSL 0.29% Jupyter Notebook 99.63%
geophysics geospatial gmt jupyter-notebook pygmt seismology bash earth-science earthquakes maps

gmt-plotting's Introduction

GMT-plotting

Note

Updates for PyGMT based notebooks are carried out at irregular intervals. The GMT bash scripts are not maintained anymore.

Did you find a bug or have suggestions for improvements? Simply open a new issue or pull request.

Collection of GMT (Generic Mapping Tools) scripts and files (including digitized map content, colormaps, grid files etc.). All scripts should run with GMT versions >= 5.2.1 and < 6.0.0 . Each directory in this repository represents a single stand-alone application (individual manuals in pdf format are included as well):

Some directories include Jupyter Notebooks in which I use PyGMT, a Python interface for GMT (Tian et al., 2024) to generate the individual maps and plots (see the ▶️ symbol).


If you make use of the content in this repository please acknowledge GMT (e.g. Wessel et al., 2013; 2019), PyGMT (Tian et al., 2024), our published papers and/or my PhD thesis in whose framework several of the scripts and notebooks were developed:

  • Ritter, J.R.R., Fröhlich, Y., Sanz Alonso, Y. & Grund, M. (2022), Short-scale laterally varying SK(K)S shear wave splitting at BFO, Germany – implications for the determination of anisotropic structures, Journal of Seismology, 26, 1137-1156, https://doi.org/10.1007/s10950-022-10112-w.

  • Grund, M. & Ritter, J.R.R. (2020), Shear-wave splitting beneath Fennoscandia - Evidence for dipping structures and laterally varying multilayer anisotropy, Geophysical Journal International, 223, 1525–1547, https://doi.org/10.1093/gji/ggaa388.

  • Grund, M. & Ritter, J.R.R. (2019), Widespread seismic anisotropy in Earth’s lowermost mantle beneath the Atlantic and Siberia, Geology, 47(2), 123–126, https://doi.org/10.1130/G45514.1.

  • Grund, M. (2019), Exploring geodynamics at different depths with shear wave splitting, Dissertation, Karlsruhe Institute of Technology (KIT), https://doi.org/10.5445/IR/1000091425.


Although I now work outside of academia as a data scientist, I provide these GMT/PyGMT examples and notebooks in the hope that they will be useful for other students, scientists or interested map creators.

Final figure outputs of a few examples are shown below. Details and further references can be found in the individual directories.

PLOT_GMT_all


References

  • Tian, D., Uieda, L., Leong, W. J., Fröhlich, Y., Schlitzer, W., Grund, M., Jones, M., Toney, L., Yao, J., Magen, Y., Jing-Hui, T., Materna, K., Belem, A., Newton, T., Anant, A., Ziebarth, M., Quinn, J., & Wessel, P. (2024), PyGMT: A Python interface for the Generic Mapping Tools, v0.12.0, Zenodo, https://zenodo.org/records/11062720.
  • Wessel, P., Luis, J. F., Uieda, L., Scharroo, R., Wobbe, F., Smith, W. H. F. & Tian, D. (2019), The generic mapping tools version 6. Geochemistry, Geophysics, Geosystems, 20(11), 5556-5564, https://doi.org/10.1029/2019GC008515.
  • Wessel, P., Smith, W. H. F., Scharroo, R., Luis, J., & Wobbe, F. (2013), Generic mapping tools: improved version released. Eos, Transactions American Geophysical Union, 94(45), 409-410, https://doi.org/10.1002/2013EO450001.

gmt-plotting's People

Contributors

michaelgrund avatar yvonnefroehlich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gmt-plotting's Issues

009_paper_GR2020/Figure S10: Wrong colormap set up in colorwheel

In Figure S10 (009_paper_GR2020), the colormap represented by the colorwheel does not match the color-coding used for the bars of the splits. The plots in the Supplementary Material of Grund & Ritter (2020) shown up on page 28 look correct.
compare_SuppMat_JN_GR2020_FigS10

Suggestions to fix this issue
This Jupyter Notebook seems not completely finished. However, maybe the code snippets below can serve as an orientations, in case further work on this JN is planed.

(1) Adjust colormap used for plotting the data points

  • limitation: Not the same color-coding as used for the maps in the Supp Material
  • cell 11, line 4: reverse=True (not False)
# generate colormap for values between 0 and 360 degrees
pygmt.makecpt(
    cmap="romaO", 
    series=[0 ,360 , 1], 
    reverse=True,   # not False
    output="cmapmod.cpt",
)

(2) Adjust creation of colorwheel via Matplotlib

  • limitation: Problem to save the new colorwheel as (eps) file via matplotlib.pyplot.savefig. Error message FigureCanvasPS._print_figure() got an unexpected keyword argument 'figsize'
# define plotting range
theta = np.linspace(0, 2*pi, 360)  # no shift by 0.5*pi anymore
rho = ([1.22, 2])
	
# plot in polar projection, loop over the whole range 0 to 360 degrees
for ii in range(360):
	# backazimuth in seismology
	# from North (0 deg)
	ax.set_theta_offset(pi/2)
	# clockwise, i.e. to East (90 deg)
	ax.set_theta_direction(-1)
	plt.polar(
	    [theta[ii], theta[ii]], 
	    rho, 
	    color=[cmapa[0][ii], cmapa[1][ii], cmapa[2][ii]], 
	    linewidth=2,
	)

(3) Use PyGMT instead of Matplotlib to create colorwheel

  • limitation: Running time of the code
import pygmt

cmap_colorwheel = "romaO"
rho_min = 1.22
rho_max = 2

fig = pygmt.Figure()

pygmt.config(
    # make area outside of plot transparent
    PS_PAGE_COLOR="white@1",
    # make frame outline white
    MAP_FRAME_PEN="white",
)

fig.basemap(
    region=[0, 360, rho_min, rho_max],
    # geographic azimuth instead of standard angle
    # clockwise from North instead of counter-clockwise from East
    projection="P5c+a",
    frame="rltb",
)

pygmt.makecpt(
    cmap=cmap_colorwheel,
    cyclic=True,
    series=[0, 360, 1],
)

# takes some time
for i_ang in range(0,360,1):  # min, max], step
    rho = [rho_min, rho_max]
    fig.plot(
        x=[i_ang, i_ang],
        y=rho,
        zvalue=i_ang,
        pen="2p+z",
        cmap=True,
)

fig.show()

# fig.savefig(fname="colorwheel_N_cw_pygmt" + cmap_colorwheel + ".png")
# fig.savefig(fname="colorwheel_N_cw_pygmt" + cmap_colorwheel + ".eps")
# fig.savefig(fname="colorwheel_N_cw_pygmt" + cmap_colorwheel + ".pdf")

Projection issue

Hi,

reproducing the code at least in the first two examples the same error arise:

mapproject [ERROR]: Cannot specify -J option with selected form of -G

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.