Coder Social home page Coder Social logo

jpvantassel / swprepost Goto Github PK

View Code? Open in Web Editor NEW
34.0 2.0 16.0 3.64 MB

A Python package for surface-wave inversion pre- and post-processing.

License: Other

Python 92.55% Jupyter Notebook 7.45%
dinver geopsy inversion surface-waves dispersion pre-processing post-processing swinvert

swprepost's Introduction

swprepost - A Python Package for Surface Wave Inversion Pre- and Post-Processing

Joseph P. Vantassel, The University of Texas at Austin

DOI PyPI - License CircleCI Documentation Status Language grade: Python Codacy badge Codecov PyPI - Python Version

Table of Contents


About swprepost


swprepost is an open-source Python package for performing surface wave inversion pre- and post-processing. swprepost was initially developed by Joseph P. Vantassel under the supervision of Professor Brady R. Cox at The University of Texas at Austin. The package continues to be developed by Joseph P. Vantassel.

The package includes multiple class definitions for interacting with the various components required for surface wave inversion. It is designed to integrate seamlessly with the dinver module of the popular open-source software geopsy, however has been written in a general manner to ensure its usefulness with other inversion programs. Furthermore, some of the class definitions provided, such as GroundModel, may even be of use to those working in the geotechnical or geophysical fields, but who do not perform surface wave inversion.

If you use swprepost in your research or consulting we ask you please cite the following:

Joseph Vantassel. (2020). jpvantassel/swprepost: latest (Concept). Zenodo. http://doi.org/10.5281/zenodo.3839998

Vantassel, J.P. and Cox, B.R. (2021). SWinvert: a workflow for performing rigorous 1-D surface wave inversions. Geophysical Journal International 224, 1141-1156. https://doi.org/10.1093/gji/ggaa426

Note: For software, version specific citations should be preferred to general concept citations, such as that listed above. To generate a version specific citation for swprepost, please use the citation tool for that specific version on the swprepost archive.

A Few Examples

All examples presented here can be replicated using the Jupyter notebook titled ReadmeExamples.ipynb in the examples/basic directory.

Import 100 ground models in less than 0.5 seconds

time_start = time.perf_counter()
gm_suite = swprepost.GroundModelSuite.from_geopsy(fname="inputs/from_geopsy_100gm.txt")
time_stop = time.perf_counter()
print(f"Elapsed Time: {np.round(time_stop - time_start)} seconds.")
print(gm_suite)
Elapsed Time: 0.0 seconds.
GroundModelSuite with 100 GroundModels.

Plot the ground models

fig, ax = plt.subplots(figsize=(2,4), dpi=150)
# Plot 100 best
label = "100 Best"
for gm in gm_suite:
    ax.plot(gm.vs2, gm.depth, color="#ababab", label=label)
    label=None
# Plot the single best in different color
ax.plot(gm_suite[0].vs2, gm_suite[0].depth, color="#00ffff", label="1 Best")
ax.set_ylim(50,0)
ax.set_xlabel("Vs (m/s)")
ax.set_ylabel("Depth (m)")
ax.legend()
plt.show()

Plot of 100 best shear wave velocity profiles.

Compute and plot their uncertainty

fig, ax = plt.subplots(figsize=(2,4), dpi=150)
disc_depth, siglnvs = gm_suite.sigma_ln()
ax.plot(siglnvs, disc_depth, color="#00ff00")
ax.set_xlim(0, 0.2)
ax.set_ylim(50,0)
ax.set_xlabel("$\sigma_{ln,Vs}$")
ax.set_ylabel("Depth (m)")
plt.show()

Plot of the lognormal standard deviation of the 100 best shear wave velocity profiles.

Getting Started


Installing or Upgrading swprepost

  1. If you do not have Python 3.6 or later installed, you will need to do so. A detailed set of instructions can be found here.

  2. If you have not installed swprepost previously use pip install swprepost. If you are not familiar with pip, a useful tutorial can be found here. If you have an earlier version and would like to upgrade to the latest version of swprepost use pip install swprepost --upgrade.

  3. Confirm that swprepost has installed/updated successfully by examining the last few lines of text displayed in the console.

Using swprepost

To start learning about swprepost, we recommend walking through the provided examples.

  1. To access the examples you can download the latest release of the project archived on zenodo.

  2. Unzip the project folder titled swprepost-vX.X.X.zip. And move the example directory to any location of your choosing. You can now discard the other files and directories in the .zip.

  3. Explore the Jupyter notebooks in the basic directory for a no-coding-required introduction to the swprepost package. If you have not installed Jupyter, detailed instructions can be found here.

  4. Move to the adv directory and follow the Jupyter notebook title example_swinvert_workflow.ipynb for an example of swprepost applied in the context of the SWinvert workflow (Vantassel and Cox, 2021). This workflow demonstrates how to use swprepost to perform surface wave processing and swbatch for running batch-style surface wave inversion. For more information on swbatch see its GitHub page.

  5. Enjoy!

swprepost's People

Contributors

jpvantassel 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

Watchers

 avatar  avatar

swprepost's Issues

Issue in the Python code 'example_swinvert_workflow.ipynb'

Hello.
I am a Ph.D. Research Scholar.
While running the code 'example_swinvert_workflow.ipynb' which is in the folder 'adv', while running the cell below the section 'If running remotely on DesignSafe-CI', it shows the message
'File "", line 93
from agavepy.async import AgaveAsyncResponse
^
SyntaxError: invalid syntax'.

I request you to let me know what can be done.

Reasampling - suggested improvement

Hi,

Currently the pmin and pmax values are set manually and throw value errors if they are above the range of the data. This could be refactored to automatically set the values to the maximum and minimum possible if an error is encountered.

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.