{ "cells": [ { "cell_type": "markdown", "id": "795ebd80-8a0f-479b-a888-161a5dfacbae", "metadata": {}, "source": [ "# Make an MTH5 from Phoenix Data\n", "\n", "This example demonstrates how to read Phoenix data into an MTH5 file. The data comes from example data in [PhoenixGeoPy](https://github.com/torresolmx/PhoenixGeoPy). Here I downloaded those data into a local folder on my computer by forking the main branch. " ] }, { "cell_type": "markdown", "id": "74989d46-d13b-47e8-8189-17f515cc736a", "metadata": {}, "source": [ "## Imports" ] }, { "cell_type": "code", "execution_count": 1, "id": "d5083c86-ebea-41d1-ade6-87e2de073b84", "metadata": {}, "outputs": [], "source": [ "from pathlib import Path\n", "\n", "from mth5.clients import MakeMTH5" ] }, { "cell_type": "markdown", "id": "b56259e6-b397-40c7-93e4-6ac30d1cdd68", "metadata": {}, "source": [ "## Data Directory\n", "\n", "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? " ] }, { "cell_type": "code", "execution_count": 2, "id": "6348263b-79f2-4bae-9981-cf4268d7a48b", "metadata": {}, "outputs": [], "source": [ "station_dir = Path(r\"c:\\MT\\ST2024\\1014\\Data\\10643_2024-03-19-190728\")" ] }, { "cell_type": "markdown", "id": "5c310e9a-522c-453d-b230-eb704232cdb7", "metadata": {}, "source": [ "## Make MTH5\n", "\n", "`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. \n", "\n", "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`.\n", "\n", "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. \n", "\n", "You will give it the `sample_rates` that you would like to archive in the MTH5.\n", "\n", "`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.\n", "\n", "`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.\n", "\n", "You can set the `mth5_filename` to something useful, default is `from_phoenix.h5`.\n", "\n", "You can set the `save_path` which can be the full path to the new H5 file or the directory to save to." ] }, { "cell_type": "code", "execution_count": 4, "id": "b4e44d4b-2173-4a9a-a6d7-f9335282eabd", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "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\n", "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\n" ] } ], "source": [ "phx_mth5_path = MakeMTH5.from_phoenix(\n", " station_dir,\n", " mth5_filename=\"from_phoenix.h5\",\n", " sample_rates=[150, 24000],\n", " receiver_calibration_dict=Path(\n", " r\"\\data\\phx\\remote\\calibrations\"\n", " ),\n", " sensor_calibration_dict=Path(\n", " r\"\\data\\phx\\remote\\calibrations\"\n", " ),\n", ")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "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.18" } }, "nbformat": 4, "nbformat_minor": 5 }