Giter Club home page Giter Club logo

pysurf96's Introduction

PySurf96

Python3 Code style: black

Modelling Surface Wave Dispersion Curves

This is a slim wrapper around the program surf96 from Computer programs in seismology by R. Hermann (http://www.eas.slu.edu/eqc/eqccps.html) for forward modelling of Rayleigh and Love wave dispersion curves.

In this realisation the Fortran77 code is wrapped by f2py, which makes the forward computation approximately 8x faster compared over calling a Python subprocess.

More useful software for seismology at https://pyrocko.org.

Installation

This package is for Python 3.

Prerequisits is a Fortran77 compiler, like GNU GCC.

pip3 install .

Or through pip:

pip install git+https://github.com/miili/pysurf96

Documentation

Essentially this is a single function, surf96. Here is the docstring:

Calculate synthetic surface wave dispersion curves for a given earth model, wave type and periods.

This is a slim Fortran wrapper around surf96 from Computer Programs in Seismology from R. Hermann (2013)

Args:
    thickness (np.ndarray): Layer thickness in kilometers.
    vp (np.ndarray): Layer Vp velocity.
    vs (np.ndarray): Layer Vs velocity.
    rho (np.ndarray): Layer density in g/m^3.
    periods (np.ndarray): The periods in seconds, where wave velocity is calculated
    wave (WaveType, optional): The wave type, "love" or "rayleigh". Defaults to "love".
    mode (int, optional): Mode of the wave, 1: fundamental, 2: second-mode, etc... Defaults to 1.
    velocity (Velocity, optional): "group" or "phase" velocity. Defaults to "group".
    flat_earth (bool, optional): Assume a flat earth. Defaults to True.
Raises:
    ValueError: Raised when input values are unexpected.
    Surf96Error: If surf96 fortran code raises an error,
        this may be due to low velocity zone.
Returns:
    np.ndarray: The surface wave velocities at defined periods.

Example

import numpy as np
from pysurf96 import surf96

# Define the velocity model in km and km/s
thickness = np.array([5.0, 23.0, 8.0, 0])
vs = np.array([2, 3.6, 3.8, 3.3])
vp = vs * 1.73
rho = vp * 0.32 + 0.77

# Periods we are interested in
periods = np.linspace(1.0, 20.0, 20)

velocities = surf96(
    thickness,
    vp,
    vs,
    rho,
    periods,
    wave="love",
    mode=1,
    velocity="group",
    flat_earth=True,

Citations and Acknowledgments

Herrmann, R. B. (2013) Computer programs in seismology: An evolving tool for instruction and research, Seism. Res. Lettr. 84, 1081-1088, doi:10.1785/0220110096

Thanks to Hongjian Fang for creating the Fortran subroutine (https://github.com/caiweicaiwei/SurfTomo)

pysurf96's People

Contributors

miili 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pysurf96's Issues

srfker96 implementation

Hi,

Thanks for this great wrapper. Would you consider adding a wrapper around the srfker96 , so we can have also the derivatives?

Compiler problem

Hi and thank you for this package!
I'm approaching python and coding in general, so sorry if my issue is trivial.

I'm trying to install pysurf96 using anaconda prompt shell and command prompt (on windows) and terminal (on mac). For both machines I get the same error (attached are the output of the terminal). I've installed obspy, numpy and a gfortran compiler (conda install -c conda-forge gcc). Could you help me?
All the best
Riccardo
Logout2.txt
Logout1.txt

License?

Hi!
Your package has no license! Can you please attach one so I know how I may use it?
Thanks!

Installation Problem

Hi, thanks for your great work.
I'm planning to use the code, but couldn't install it. tried using:
pip install git+https://github.com/miili/pysurf96
but keep receiving this error:
flang.exe: error: unsupported fixed-format line length in argument '-ffixed-line-length-none'

Hope you could help me to fix it!

Maybe there is a bug in the programs

Thanks for your code. It's very helpful, but I found a bug recently. When I computed the phase velocity of rayleigh wave with these parameters

thickness=np.array([0.3,0]
vp=np.array([2.6, 5.29])
vs=np.array([1.12, 3.14])
rho=np.array([2.12,2.58])
periods=1/np.arange(6,1,-1)

surf96 threw an error. But If I make the thickness=np.array([0.301,0]), or even [0.3001, 0], it runs sucessfully! Why? This problem confused me . Could you help me find the answer?

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.