I was going to download some of the broadband hydrophone data from RS01SBPS-PC01A-08-HYDBBA103 to look at sample rate and check the data quality but it’s all archived in miniseed format. Is there a relatively straightforward way to batch download a month’s worth of files and convert them to a useful format (wav or flac or even, god forbid, mp3)?
thanks!
Not my area of expertise, but here are a few (if dated) links on the OOI website that might help you get started…
I have included a snippet of code below to generate flac and wav from mseed:
# Requirements
# https://pypi.org/project/SoundFile/
# pip install SoundFile
#
# https://docs.obspy.org/
# https://pypi.org/project/obspy/
# pip install obspy
import obspy
from soundfile import SoundFile
# Path to mseed file
url = 'https://rawdata.oceanobservatories.org/files/RS03AXBS/LJ03A/09-HYDBBA302/2021/02/04/OO-AXVM1--YDH-2021-02-04T00:15:00.000015.mseed'
# Import mseed file into obspy stream
stream = obspy.read(url, ssl_verify=False)
# Convert obspy stream to wav format
stream.write('OO-AXVM1--YDH-2021-02-04T00:15:00.000015.wav', format='WAV', framerate=64000)
# Convert obspy stream to flac format
with SoundFile('OO-AXVM1--YDH-2021-02-04T00:15:00.000015.flac', 'w', 64000, 1, 'PCM_24') as f:
f.write(stream[0].data / ((2.0 ** 23) - 1))