# Moment Magnitude (Mw) Calculating

**URL:** https://discourse.obspy.org/t/moment-magnitude-mw-calculating/1733
**Category:** Uncategorized
**Created:** [June 24, 2023, 4:47am UTC](https://discourse.obspy.org/t/moment-magnitude-mw-calculating/1733 "2023-06-24T04:47:20Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![kozan88](https://discourse.obspy.org/user_avatar/discourse.obspy.org/kozan88/32/661_2.png) [@kozan88](https://discourse.obspy.org/u/kozan88)
#### Post date: [June 24, 2023, 4:47am UTC](https://discourse.obspy.org/t/moment-magnitude-mw-calculating/1733/1 "2023-06-24T04:47:20Z")

</div>

Hello,  
I have sac data and XML files for my broadband seismic stations. I tried to write a script to calculate the moment magnitude (Mw) using Obspy, but I could not. I reviewed the tutorial, but I did not find anything that could help me.  
Can anyone help me with that, please?

---

<div class="post-metadata">

### Author: ![trichter](https://discourse.obspy.org/user_avatar/discourse.obspy.org/trichter/32/226_2.png) [@trichter](https://discourse.obspy.org/u/trichter)
#### Post date: [June 24, 2023, 7:35am UTC](https://discourse.obspy.org/t/moment-magnitude-mw-calculating/1733/2 "2023-06-24T07:35:47Z")

</div>

I think in the ObsPy tutorial we have only material on how to [calculate the local magnitude](https://docs.obspy.org/tutorial/advanced_exercise/advanced_exercise.html).

There are a multitude of different methods for calculating the moment magnitude. Moment tensor inversion (e.g. Grond), spectral analysis, using the envelope, etc.

[Here](https://github.com/trichter/robust_earthquake_spectra) you can find some code comparing the three mentioned methods.
