forked from GeoNet/data-tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
99 additions
and
683 deletions.
There are no files selected for viewing
683 changes: 0 additions & 683 deletions
683
Data_Blog/blog_01_val/.ipynb_checkpoints/data_blog_val-checkpoint.ipynb
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-159 KB
Data_Blog/blog_08_kawerau_swarm_size/.ipynb_checkpoints/swarm_1-checkpoint.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
99 changes: 99 additions & 0 deletions
99
Data_Blog/blog_12_earthquake_sounds/Earthquake_Sound.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "b3918d6c", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import soundfile as sf\n", | ||
"from obspy import UTCDateTime\n", | ||
"from obspy import Stream\n", | ||
"from obspy.clients.fdsn import Client as FDSN_Client\n", | ||
"\n", | ||
"client = FDSN_Client(\"GEONET\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "6278778b", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"1 Trace(s) in Stream:\n", | ||
"NZ.ECLS.20.HNZ | 2021-03-04T13:00:00.000000Z - 2021-03-04T15:00:00.000000Z | 200.0 Hz, 1440001 samples\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"station = 'ECLS'\n", | ||
"location = '20'\n", | ||
"channel = 'HNZ'\n", | ||
"starttime = UTCDateTime(\"2021-03-04T13:00:00.000\")\n", | ||
"endtime = UTCDateTime(\"2021-03-04T15:00:00.000\")\n", | ||
"\n", | ||
"\n", | ||
"st = client.get_waveforms(\"NZ\", station, location, channel , starttime = starttime, endtime = endtime)\n", | ||
"\n", | ||
"print(st)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "c9e6f145", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"data = st[0].data\n", | ||
"sampling_rate = 100\n", | ||
"\n", | ||
"# 1) force the signal's mean value to be zero \n", | ||
"data = data - np.mean(data)\n", | ||
"\n", | ||
"#2) limit the signal's amplitude = avoid too large peaks \n", | ||
"data_n = data/np.amax(np.absolute(data))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"id": "49caa296", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"sr_resample = 44100\n", | ||
"file_name = '/Sound_' + str(station) + '.wav'\n", | ||
"dire = ('.') #need to change directory \n", | ||
"sf.write(dire + file_name, data_n, sr_resample)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "general", | ||
"language": "python", | ||
"name": "general" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Binary file not shown.
File renamed without changes.
File renamed without changes.