This example demonstrates how to read Phoenix data into an MTH5 file. The data comes from example data in PhoenixGeoPy. Here I downloaded those data into a local folder on my computer by forking the main branch.
from pathlib import Path
from mth5.clients import MakeMTH5
Specify the station directory. Phoenix files place each channel in a folder under the station directory named by the channel number. There is also a recmeta.json
file that has metadata output by the receiver that can be useful. In the PhoenixGeopPy/sample_data
there are 2 folders one for native data, these are .bin
files which are the raw data in counts sampled at 24k. There is also a folder for segmented files, these files are calibrated to millivolts and decimated or segmented data according to the recording configuration. Most of the time you would use the segmented files?
station_dir = Path(r"c:\MT\ST2024\1014\Data\10643_2024-03-19-190728")
MakeMTH5
has a convenience method called from_phoenix
that should make it simpler to create an MTH5 from Phoenix MTU-5C data. It suggested to make one file per station, but if you are storing locally or on a long term archive then a single file with all stations is possible.
Here we will demonstrate how one would build an MTH5 from Phoenix MTU-5c data. The important things you need to do if you are collecting data with Phoenix instruments or working with Phoenix data is to export the receiver and sensor calibration files using the Phoenix software EMPower. Export these into a folder that makes logical sens to you. A common folder name would be calibrations
.
The classmethod MakeMTH5.from_phoenix
will look in the data folder for the data files. Phoenix organizes the data into folder for each channel and data are cached every 6 minutes usually, this will organize those files into the longest possible continuous runs for the 150 samples/second data. Similarly for the 24k samples/second data runs will be created for each burst, so you will have a lot of them.
You will give it the sample_rates
that you would like to archive in the MTH5.
receiver_calibration_dict
can be a dictionary where keys are the receiver ID numbers and the values are the paths to the rxcal.json
files, or the simplest way is to give it a path to the location of the rxcal.json
files you exported from EMPower and the code will sort them out and match them with the appropriate channel using the recmeta.json
file.
sensor_calibration_dict
can be a dictionary where keys are the sensor ID numbers and the values are PhoenixCalibration
objects, or the simplest is to give it a path to the scal.json
files exported from EMPower. The code will match the calibrations to the appropriate channel using the information in recmeta.json
file.
You can set the mth5_filename
to something useful, default is from_phoenix.h5
.
You can set the save_path
which can be the full path to the new H5 file or the directory to save to.
phx_mth5_path = MakeMTH5.from_phoenix(
station_dir,
mth5_filename="from_phoenix.h5",
sample_rates=[150, 24000],
receiver_calibration_dict=Path(
r"\data\phx\remote\calibrations"
),
sensor_calibration_dict=Path(
r"\data\phx\remote\calibrations"
),
)
2022-08-31 13:19:32,755 [line 596] mth5.mth5.MTH5.open_mth5 - WARNING: mth5_from_phoenix.h5 will be overwritten in 'w' mode 2022-08-31 13:19:33,267 [line 663] mth5.mth5.MTH5._initialize_file - INFO: Initialized MTH5 0.2.0 file c:\Users\jpeacock\OneDrive - DOI\mt\phoenix_example_data\10291_2019-09-06-015630\mth5_from_phoenix.h5 in mode w