{ "cells": [ { "cell_type": "markdown", "id": "641859ba-58ee-43d6-a2d8-69dbffe4d5eb", "metadata": {}, "source": [ "# MT Object\n", "\n", "MT transfer functions come in all kinds of formats and flavors. The goal of `MT` is to centralize and standardize an MT transfer function with common metadata and accessibility to the data. `MT` inherits [`mt_metadata.transfer_function.core.TF`](https://mt-metadata.readthedocs.io/en/latest/source/tf_structure.html) which has the ability to read/write in various file types. If there is a file type that is not supported yet raise an [issue in mt-metadata](https://github.com/kujaku11/mt_metadata/issues). \n", "\n", "| Format | Description | Extension | Read | Write |\n", "|--------|-------------|-----------|------|-------|\n", "| EDI | Common [SEG format](https://library.seg.org/doi/abs/10.1190/1.1892244) | .edi | yes | yes |\n", "| EMTF XML | Anna Kelbert's [XML Format](https://library.seg.org/doi/10.1190/geo2018-0679.1) for archiving at [IRIS](https://eos.org/science-updates/taking-magnetotelluric-data-out-of-the-drawer) | .xml | yes | yes |\n", "| Z-Files | Output from Gary Egberts processing code | .zmm, .zss, .zrr | yes | yes |\n", "| J-Files | Alan Jones' format and output of Alan Chave's BIRRP code | .j | yes | no |\n", "| Zonge AVG | Zonge International processing code output | .avg | yes | no |\n", "\n", "The `MT` has a couple of important attributes and method that are described below as we progress through an example file. Here we will look at an EMTF XML because this format has the most comprehensive metadata so far.\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "46874258-5a32-4cd4-9458-fa48fe91cce2", "metadata": {}, "outputs": [], "source": [ "from mtpy import MT\n", "from mt_metadata import TF_XML" ] }, { "cell_type": "code", "execution_count": 2, "id": "7c9f3ca3-cf36-4535-8ff1-82ee5a8f3360", "metadata": {}, "outputs": [], "source": [ "mt_object = MT(TF_XML)\n", "mt_object.read()" ] }, { "cell_type": "markdown", "id": "59bca91f-dddd-4314-9fba-e857d14a77fc", "metadata": {}, "source": [ "## TF Metadata\n", "\n", "Important in describing the transfer function are metadata attributes, namely the location, what survey the station was collected in, timing, and how the data were processed. These are contained in logical metadata objects. For further reading on metadata objects see [MT-metadata](https://mt-metadata.readthedocs.io/en/latest/source/tf_structure.html)\n", "\n", " - `MT.survey_metadata`: describes the general survey details that this transfer function belongs to. \n", " - `MT.station_metadata`: describes the station location, timing, runs processed, processing scheme.\n", " - `MT.station_metadata.transfer_function`: describes how the data were processed.\n", " - `MT.station_metadata.runs`: provides details on the runs processed, timing, sample rate, channels recorded, data logger details.\n", " - `MT.station_metadata.runs[run_id].channels`: describes channel metadata including timing, sensors, location." ] }, { "cell_type": "markdown", "id": "e1313e82-649a-4364-838d-fd7ab3f26d4d", "metadata": {}, "source": [ "### Survey Metadata\n", "\n", "Survey metadata provides information about the survey ID, geographic locations, who aquired the data, is there a DOI associated with the data or publications, how the data can be used, licenses, and general information about the overall survey." ] }, { "cell_type": "code", "execution_count": 3, "id": "5f665b59-9457-4df7-992a-a9b884c85a10", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{\n", " \"survey\": {\n", " \"acquired_by.author\": \"National Geoelectromagnetic Facility\",\n", " \"citation_dataset.authors\": \"Schultz, A., Pellerin, L., Bedrosian, P., Kelbert, A., Crosbie, J.\",\n", " \"citation_dataset.doi\": \"doi:10.17611/DP/EMTF/USMTARRAY/SOUTH\",\n", " \"citation_dataset.title\": \"USMTArray South Magnetotelluric Transfer Functions\",\n", " \"citation_dataset.year\": \"2020-2023\",\n", " \"citation_journal.doi\": null,\n", " \"comments\": \"copyright.acknowledgement:The USMTArray-CONUS South campaign was carried out through a cooperative agreement between\\nthe U.S. Geological Survey (USGS) and Oregon State University (OSU). A subset of 40 stations\\nin the SW US were funded through NASA grant 80NSSC19K0232.\\nLand permitting, data acquisition, quality control and field processing were\\ncarried out by Green Geophysics with project management and instrument/engineering\\nsupport from OSU and Chaytus Engineering, respectively.\\nProgram oversight, definitive data processing and data archiving were provided\\nby the USGS Geomagnetism Program and the Geology, Geophysics and Geochemistry Science Centers.\\nWe thank the U.S. Forest Service, the Bureau of Land Management, the National Park Service,\\nthe Department of Defense, numerous state land offices and the many private landowners\\nwho permitted land access to acquire the USMTArray data.; copyright.conditions_of_use:All data and metadata for this survey are available free of charge and may be copied freely, duplicated and further distributed provided that this data set is cited as the reference, and that the author(s) contributions are acknowledged as detailed in the Acknowledgements. Any papers cited in this file are only for reference. There is no requirement to cite these papers when the data are used. Whenever possible, we ask that the author(s) are notified prior to any publication that makes use of these data.\\n While the author(s) strive to provide data and metadata of best possible quality, neither the author(s) of this data set, nor IRIS make any claims, promises, or guarantees about the accuracy, completeness, or adequacy of this information, and expressly disclaim liability for errors and omissions in the contents of this file. Guidelines about the quality or limitations of the data and metadata, as obtained from the author(s), are included for informational purposes only.; copyright.release_status:Unrestricted Release\",\n", " \"country\": [\n", " \"USA\"\n", " ],\n", " \"datum\": \"WGS84\",\n", " \"geographic_name\": \"CONUS South\",\n", " \"id\": \"CONUS South\",\n", " \"name\": null,\n", " \"northwest_corner.latitude\": 34.470528,\n", " \"northwest_corner.longitude\": -108.712288,\n", " \"project\": \"USMTArray\",\n", " \"project_lead.email\": null,\n", " \"project_lead.organization\": null,\n", " \"release_license\": \"CC0-1.0\",\n", " \"southeast_corner.latitude\": 34.470528,\n", " \"southeast_corner.longitude\": -108.712288,\n", " \"summary\": \"Magnetotelluric Transfer Functions\",\n", " \"time_period.end_date\": \"2020-10-07\",\n", " \"time_period.start_date\": \"2020-09-20\"\n", " }\n", "}" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mt_object.survey_metadata" ] }, { "cell_type": "markdown", "id": "7ebd5b7f-0b5d-4cdb-b679-2a2eff80d38e", "metadata": {}, "source": [ "### Station Metadata\n", "\n", "Station metadata is the most important to describe the transfer function, it provides ID, location, timing and then specifics on how the data were processed, run metadata, and channel metadata." ] }, { "cell_type": "code", "execution_count": 4, "id": "19546ab0-e45b-4a71-aeda-fa458a0ce536", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{\n", " \"station\": {\n", " \"acquired_by.author\": \"National Geoelectromagnetic Facility\",\n", " \"channels_recorded\": [\n", " \"ex\",\n", " \"ey\",\n", " \"hx\",\n", " \"hy\",\n", " \"hz\"\n", " ],\n", " \"comments\": \"description:Magnetotelluric Transfer Functions; primary_data.filename:NMX20b_NMX20_NMW20_COR21_NMY21-NMX20b_NMX20_UTS18.png; attachment.description:The original used to produce the XML; attachment.filename:NMX20b_NMX20_NMW20_COR21_NMY21-NMX20b_NMX20_UTS18.zmm; site.data_quality_notes.comments.author:Jade Crosbie, Paul Bedrosian and Anna Kelbert; site.data_quality_notes.comments.value:great TF from 10 to 10000 secs (or longer)\",\n", " \"data_type\": \"mt\",\n", " \"fdsn.id\": \"USMTArray.NMX20.2020\",\n", " \"geographic_name\": \"Nations Draw, NM, USA\",\n", " \"id\": \"NMX20\",\n", " \"location.datum\": \"WGS84\",\n", " \"location.declination.epoch\": \"2020.0\",\n", " \"location.declination.model\": \"WMM\",\n", " \"location.declination.value\": 9.09,\n", " \"location.elevation\": 1940.05,\n", " \"location.latitude\": 34.470528,\n", " \"location.longitude\": -108.712288,\n", " \"orientation.angle_to_geographic_north\": 0.0,\n", " \"orientation.method\": null,\n", " \"orientation.reference_frame\": \"geographic\",\n", " \"provenance.archive.comments\": \"IRIS DMC MetaData\",\n", " \"provenance.archive.name\": null,\n", " \"provenance.archive.url\": \"http://www.iris.edu/mda/ZU/NMX20\",\n", " \"provenance.creation_time\": \"2021-03-17T14:47:44+00:00\",\n", " \"provenance.creator.author\": \"Jade Crosbie, Paul Bedrosian and Anna Kelbert\",\n", " \"provenance.creator.email\": \"pbedrosian@usgs.gov\",\n", " \"provenance.creator.name\": \"Jade Crosbie, Paul Bedrosian and Anna Kelbert\",\n", " \"provenance.creator.organization\": \"U.S. Geological Survey\",\n", " \"provenance.creator.url\": \"https://www.usgs.gov/natural-hazards/geomagnetism\",\n", " \"provenance.software.author\": null,\n", " \"provenance.software.name\": \"EMTF File Conversion Utilities 4.0\",\n", " \"provenance.software.version\": null,\n", " \"provenance.submitter.author\": \"Anna Kelbert\",\n", " \"provenance.submitter.email\": \"akelbert@usgs.gov\",\n", " \"provenance.submitter.name\": \"Anna Kelbert\",\n", " \"provenance.submitter.organization\": \"U.S. Geological Survey, Geomagnetism Program\",\n", " \"provenance.submitter.url\": \"https://www.usgs.gov/natural-hazards/geomagnetism\",\n", " \"release_license\": \"CC0-1.0\",\n", " \"run_list\": [\n", " \"NMX20a\",\n", " \"NMX20b\"\n", " ],\n", " \"time_period.end\": \"2020-10-07T20:28:00+00:00\",\n", " \"time_period.start\": \"2020-09-20T19:03:06+00:00\",\n", " \"transfer_function.coordinate_system\": \"geopgraphic\",\n", " \"transfer_function.data_quality.good_from_period\": 5.0,\n", " \"transfer_function.data_quality.good_to_period\": 29127.0,\n", " \"transfer_function.data_quality.rating.value\": 5,\n", " \"transfer_function.id\": \"NMX20\",\n", " \"transfer_function.processed_by.author\": \"Jade Crosbie, Paul Bedrosian and Anna Kelbert\",\n", " \"transfer_function.processed_by.name\": \"Jade Crosbie, Paul Bedrosian and Anna Kelbert\",\n", " \"transfer_function.processed_date\": \"1980-01-01\",\n", " \"transfer_function.processing_parameters\": [],\n", " \"transfer_function.processing_type\": \"Robust Multi-Station Reference\",\n", " \"transfer_function.remote_references\": [\n", " \"NMW20\",\n", " \"COR21\",\n", " \"UTS18\"\n", " ],\n", " \"transfer_function.runs_processed\": [\n", " \"NMX20a\",\n", " \"NMX20b\"\n", " ],\n", " \"transfer_function.sign_convention\": \"exp(+ i\\\\omega t)\",\n", " \"transfer_function.software.author\": \"Gary Egbert\",\n", " \"transfer_function.software.last_updated\": \"2015-08-26\",\n", " \"transfer_function.software.name\": \"EMTF\",\n", " \"transfer_function.software.version\": null,\n", " \"transfer_function.units\": null\n", " }\n", "}" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mt_object.station_metadata" ] }, { "cell_type": "markdown", "id": "e2f92563-8d0a-4108-82be-2b2df3b364c2", "metadata": {}, "source": [ "#### Run Metadata\n", "\n", "Run metadata is located in `MT.station_metadata.runs` which is a list-dictionary object that contains the runs used for processing. " ] }, { "cell_type": "code", "execution_count": 5, "id": "5d07572e-f0a8-4bf3-a146-a269b4262aaf", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "OrderedDict([('NMX20a', {\n", " \"run\": {\n", " \"channels_recorded_auxiliary\": [],\n", " \"channels_recorded_electric\": [\n", " \"ex\",\n", " \"ey\"\n", " ],\n", " \"channels_recorded_magnetic\": [\n", " \"hx\",\n", " \"hy\",\n", " \"hz\"\n", " ],\n", " \"comments\": \"comments.author:Isaac Sageman; comments.value:X array at 0 deg rotation. All e-lines 50m. Soft sandy dirt. Water tank ~400m NE. County Rd 601 ~200m SE. Warm sunny day.\",\n", " \"data_logger.firmware.author\": null,\n", " \"data_logger.firmware.name\": null,\n", " \"data_logger.firmware.version\": null,\n", " \"data_logger.id\": \"2612-01\",\n", " \"data_logger.manufacturer\": \"Barry Narod\",\n", " \"data_logger.timing_system.drift\": 0.0,\n", " \"data_logger.timing_system.type\": \"GPS\",\n", " \"data_logger.timing_system.uncertainty\": 0.0,\n", " \"data_logger.type\": \"NIMS\",\n", " \"data_type\": \"BBMT\",\n", " \"id\": \"NMX20a\",\n", " \"sample_rate\": 1.0,\n", " \"time_period.end\": \"2020-09-20T19:29:28+00:00\",\n", " \"time_period.start\": \"2020-09-20T19:03:06+00:00\"\n", " }\n", "}), ('NMX20b', {\n", " \"run\": {\n", " \"channels_recorded_auxiliary\": [],\n", " \"channels_recorded_electric\": [\n", " \"ex\",\n", " \"ey\"\n", " ],\n", " \"channels_recorded_magnetic\": [\n", " \"hx\",\n", " \"hy\",\n", " \"hz\"\n", " ],\n", " \"comments\": \"comments.author:Isaac Sageman; comments.value:X array at 0 deg rotation. All e-lines 50m. Soft sandy dirt. Water tank ~400m NE. County Rd 601 ~200m SE. Warm sunny day.; errors:Found data gaps (2). Gaps of unknown length: 1 [1469160].]\",\n", " \"data_logger.firmware.author\": null,\n", " \"data_logger.firmware.name\": null,\n", " \"data_logger.firmware.version\": null,\n", " \"data_logger.id\": \"2612-01\",\n", " \"data_logger.manufacturer\": \"Barry Narod\",\n", " \"data_logger.timing_system.drift\": 0.0,\n", " \"data_logger.timing_system.type\": \"GPS\",\n", " \"data_logger.timing_system.uncertainty\": 0.0,\n", " \"data_logger.type\": \"NIMS\",\n", " \"data_type\": \"BBMT\",\n", " \"id\": \"NMX20b\",\n", " \"sample_rate\": 1.0,\n", " \"time_period.end\": \"2020-10-07T20:28:00+00:00\",\n", " \"time_period.start\": \"2020-09-20T20:12:29+00:00\"\n", " }\n", "})])" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mt_object.station_metadata.runs" ] }, { "cell_type": "markdown", "id": "d4a243d8-3b37-461c-8350-0ba1bca1bded", "metadata": {}, "source": [ "To access a single run you can use either the index of the run or the `run.id`" ] }, { "cell_type": "code", "execution_count": 6, "id": "eecddbd6-3edc-4f80-b44b-7ac614ac9795", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{\n", " \"run\": {\n", " \"channels_recorded_auxiliary\": [],\n", " \"channels_recorded_electric\": [\n", " \"ex\",\n", " \"ey\"\n", " ],\n", " \"channels_recorded_magnetic\": [\n", " \"hx\",\n", " \"hy\",\n", " \"hz\"\n", " ],\n", " \"comments\": \"comments.author:Isaac Sageman; comments.value:X array at 0 deg rotation. All e-lines 50m. Soft sandy dirt. Water tank ~400m NE. County Rd 601 ~200m SE. Warm sunny day.\",\n", " \"data_logger.firmware.author\": null,\n", " \"data_logger.firmware.name\": null,\n", " \"data_logger.firmware.version\": null,\n", " \"data_logger.id\": \"2612-01\",\n", " \"data_logger.manufacturer\": \"Barry Narod\",\n", " \"data_logger.timing_system.drift\": 0.0,\n", " \"data_logger.timing_system.type\": \"GPS\",\n", " \"data_logger.timing_system.uncertainty\": 0.0,\n", " \"data_logger.type\": \"NIMS\",\n", " \"data_type\": \"BBMT\",\n", " \"id\": \"NMX20a\",\n", " \"sample_rate\": 1.0,\n", " \"time_period.end\": \"2020-09-20T19:29:28+00:00\",\n", " \"time_period.start\": \"2020-09-20T19:03:06+00:00\"\n", " }\n", "}" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mt_object.station_metadata.runs[0]" ] }, { "cell_type": "code", "execution_count": 7, "id": "61957471-24e2-4a62-b849-2d2f9eac290c", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{\n", " \"run\": {\n", " \"channels_recorded_auxiliary\": [],\n", " \"channels_recorded_electric\": [\n", " \"ex\",\n", " \"ey\"\n", " ],\n", " \"channels_recorded_magnetic\": [\n", " \"hx\",\n", " \"hy\",\n", " \"hz\"\n", " ],\n", " \"comments\": \"comments.author:Isaac Sageman; comments.value:X array at 0 deg rotation. All e-lines 50m. Soft sandy dirt. Water tank ~400m NE. County Rd 601 ~200m SE. Warm sunny day.; errors:Found data gaps (2). Gaps of unknown length: 1 [1469160].]\",\n", " \"data_logger.firmware.author\": null,\n", " \"data_logger.firmware.name\": null,\n", " \"data_logger.firmware.version\": null,\n", " \"data_logger.id\": \"2612-01\",\n", " \"data_logger.manufacturer\": \"Barry Narod\",\n", " \"data_logger.timing_system.drift\": 0.0,\n", " \"data_logger.timing_system.type\": \"GPS\",\n", " \"data_logger.timing_system.uncertainty\": 0.0,\n", " \"data_logger.type\": \"NIMS\",\n", " \"data_type\": \"BBMT\",\n", " \"id\": \"NMX20b\",\n", " \"sample_rate\": 1.0,\n", " \"time_period.end\": \"2020-10-07T20:28:00+00:00\",\n", " \"time_period.start\": \"2020-09-20T20:12:29+00:00\"\n", " }\n", "}" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mt_object.station_metadata.runs[\"NMX20b\"]" ] }, { "cell_type": "markdown", "id": "48520339-54ee-4e14-9f22-7d730ec76af8", "metadata": {}, "source": [ "#### Channel Metadata\n", "\n", "Channel metadata is important because it describes orientation, location, sensors of each channel. These are accessed through the run. Similar to the runs direct access can be through the index or component name." ] }, { "cell_type": "code", "execution_count": 8, "id": "5f21fb08-c2cb-4d39-87d5-a56fafea1496", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{\n", " \"magnetic\": {\n", " \"channel_number\": 0,\n", " \"component\": \"hx\",\n", " \"data_quality.rating.value\": 0,\n", " \"filter.applied\": [\n", " false\n", " ],\n", " \"filter.name\": [],\n", " \"location.elevation\": 0.0,\n", " \"location.latitude\": 0.0,\n", " \"location.longitude\": 0.0,\n", " \"location.x\": 0.0,\n", " \"location.y\": 0.0,\n", " \"location.z\": 0.0,\n", " \"measurement_azimuth\": 9.1,\n", " \"measurement_tilt\": 0.0,\n", " \"sample_rate\": 0.0,\n", " \"sensor.id\": \"2509-23\",\n", " \"sensor.manufacturer\": \"Barry Narod\",\n", " \"sensor.name\": \"NIMS\",\n", " \"sensor.type\": \"fluxgate\",\n", " \"time_period.end\": \"2020-09-20T19:29:28+00:00\",\n", " \"time_period.start\": \"2020-09-20T19:03:06+00:00\",\n", " \"translated_azimuth\": 9.1,\n", " \"type\": \"magnetic\",\n", " \"units\": null\n", " }\n", "}" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mt_object.station_metadata.runs[0].channels[0]" ] }, { "cell_type": "code", "execution_count": 9, "id": "38802e85-b0e8-427a-802f-5ba66c0857aa", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{\n", " \"magnetic\": {\n", " \"channel_number\": 0,\n", " \"component\": \"hy\",\n", " \"data_quality.rating.value\": 0,\n", " \"filter.applied\": [\n", " false\n", " ],\n", " \"filter.name\": [],\n", " \"location.elevation\": 0.0,\n", " \"location.latitude\": 0.0,\n", " \"location.longitude\": 0.0,\n", " \"location.x\": 0.0,\n", " \"location.y\": 0.0,\n", " \"location.z\": 0.0,\n", " \"measurement_azimuth\": 99.1,\n", " \"measurement_tilt\": 0.0,\n", " \"sample_rate\": 0.0,\n", " \"sensor.id\": \"2509-23\",\n", " \"sensor.manufacturer\": \"Barry Narod\",\n", " \"sensor.name\": \"NIMS\",\n", " \"sensor.type\": \"fluxgate\",\n", " \"time_period.end\": \"2020-09-20T19:29:28+00:00\",\n", " \"time_period.start\": \"2020-09-20T19:03:06+00:00\",\n", " \"translated_azimuth\": 99.1,\n", " \"type\": \"magnetic\",\n", " \"units\": null\n", " }\n", "}" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mt_object.station_metadata.runs[0].channels[\"hy\"]" ] }, { "cell_type": "markdown", "id": "d01ac5cd-3627-4039-a666-9a23c8b2323f", "metadata": {}, "source": [ "Or you can access the channel metadata through a convenience attribute" ] }, { "cell_type": "code", "execution_count": 10, "id": "c8fc1559-b761-4c74-bead-e11bb9894f17", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{\n", " \"electric\": {\n", " \"channel_number\": 0,\n", " \"component\": \"ex\",\n", " \"data_quality.rating.value\": 0,\n", " \"dipole_length\": 100.0,\n", " \"filter.applied\": [\n", " false\n", " ],\n", " \"filter.name\": [],\n", " \"measurement_azimuth\": 9.1,\n", " \"measurement_tilt\": 0.0,\n", " \"negative.elevation\": 0.0,\n", " \"negative.id\": \"40201037\",\n", " \"negative.latitude\": 0.0,\n", " \"negative.longitude\": 0.0,\n", " \"negative.manufacturer\": \"Oregon State University\",\n", " \"negative.type\": \"Pb-PbCl2 kaolin gel Petiau 2 chamber type\",\n", " \"negative.x\": -50.0,\n", " \"negative.y\": 0.0,\n", " \"negative.z\": 0.0,\n", " \"positive.elevation\": 0.0,\n", " \"positive.id\": \"40201038\",\n", " \"positive.latitude\": 0.0,\n", " \"positive.longitude\": 0.0,\n", " \"positive.manufacturer\": \"Oregon State University\",\n", " \"positive.type\": \"Pb-PbCl2 kaolin gel Petiau 2 chamber type\",\n", " \"positive.x2\": 50.0,\n", " \"positive.y2\": 0.0,\n", " \"positive.z2\": 0.0,\n", " \"sample_rate\": 0.0,\n", " \"time_period.end\": \"2020-09-20T19:29:28+00:00\",\n", " \"time_period.start\": \"2020-09-20T19:03:06+00:00\",\n", " \"translated_azimuth\": 9.1,\n", " \"type\": \"electric\",\n", " \"units\": null\n", " }\n", "}" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mt_object.ex_metadata" ] }, { "cell_type": "markdown", "id": "a5c3e402-1e9a-4364-914b-69b0ea4d9c55", "metadata": {}, "source": [ "### Metadata Summary\n", "\n", "Metadata is important to keep track of and can be cumbersome, but helps future users of your data to actually use your data. There are a lot of fields here but the most important are ID, location, and timing.\n", "\n", " - mt.survey_metadata.id\n", " - mt.station_metadata.id\n", " - mt.station_metadata.location.longitude\n", " - mt.station_metadata.location.latitude\n", " - mt.station_metadata.location.elevation\n", " - mt.station_metadata.time_period.start\n", " - mt.station_metadata.time_period.end\n", " - mt.station_metadata.transfer_function.processing.parameters\n", " - mt.station_metadata.runs[0].channels[component].measurement_azimuth\n", " - mt.station_metadata.runs[0].channels[component].measurement_tilt\n", " - mt.station_metadata.runs[0].channels[component].translated_azimuth\n", " - mt.station_metadata.runs[0].channels[component].translated_tilt" ] }, { "cell_type": "markdown", "id": "4491592e-0314-4ac8-b1c8-95dc3f230b7c", "metadata": {}, "source": [ "## Data\n", "\n", "The most interesting part about a transfer function is the data. This describes how the Earth response to inducing magnetic fields. Under the hood an MT object stores a generic transfer function that has input channels (sources) and output channels (reponses) as an [xarray](https://docs.xarray.dev/en/stable/index.html). \n", "\n", "The benefit of using xarray is that it has tools for combining various statistical estimates and naturally indexes across a common index. In this case we can index along period for each of the statistical estimates (transfer function, errors, and covariances). The `mt._transfer_function` object is a `xarray.Dataset` and each statistical estimate is an `xarray.DataArray`. \n", "\n", "#### Attributes\n", "\n", "The other benefit is that attributes can be store directly alongside the arrays for a self describing object. Here we have picked the most important attributes from the metadata to describe the transfer function. These are propogated with each statistical estimate so anytime you retreive `impedance` or `tipper` the attributes are in the xarray. \n", "\n", "
<xarray.Dataset>\n",
"Dimensions: (output: 5, input: 5, period: 33)\n",
"Coordinates:\n",
" * output (output) <U2 'ex' 'ey' 'hx' 'hy' 'hz'\n",
" * input (input) <U2 'ex' 'ey' 'hx' 'hy' 'hz'\n",
" * period (period) float64 4.655 5.818 ... 2.913e+04\n",
"Data variables:\n",
" transfer_function (period, output, input) complex128 (nan+na...\n",
" transfer_function_error (period, output, input) float64 nan ... nan\n",
" transfer_function_model_error (period, output, input) float64 nan ... nan\n",
" inverse_signal_power (period, output, input) complex128 (nan+na...\n",
" residual_covariance (period, output, input) complex128 (0.0012...\n",
"Attributes: (12/14)\n",
" survey: CONUS South\n",
" project: USMTArray\n",
" id: NMX20\n",
" name: Nations Draw, NM, USA\n",
" latitude: 34.470528\n",
" longitude: -108.712288\n",
" ... ...\n",
" datum: WGS84\n",
" acquired_by: National Geoelectromagnetic Facility\n",
" start: 2020-09-20T19:03:06+00:00\n",
" end: 2020-10-07T20:28:00+00:00\n",
" runs_processed: ['NMX20a', 'NMX20b']\n",
" coordinate_system: geographic<xarray.DataArray 'impedance' (period: 33, output: 2, input: 2)>\n",
"array([[[-1.160949e-01-0.2708645j , 3.143284e+00+1.101737j ],\n",
" [-2.470717e+00-0.7784633j , -1.057851e-01+0.1022045j ]],\n",
"\n",
" [[-1.051846e-01-0.1912665j , 3.169108e+00+1.007867j ],\n",
" [-2.459892e+00-0.8541335j , -1.325974e-01+0.1473665j ]],\n",
"\n",
" [[-1.289586e-02-0.1937956j , 3.064653e+00+1.063899j ],\n",
" [-2.446347e+00-0.8661013j , -1.222841e-01+0.1580956j ]],\n",
"\n",
" [[-8.208073e-02-0.3117874j , 3.042922e+00+1.006518j ],\n",
" [-2.310078e+00-0.8732821j , -1.620193e-01+0.2110874j ]],\n",
"\n",
" [[ 3.353187e-02-0.2855585j , 2.875270e+00+1.083887j ],\n",
" [-2.135730e+00-0.8666129j , -1.881319e-01+0.2420585j ]],\n",
"\n",
" [[ 1.014077e-01-0.2989493j , 2.719818e+00+1.103022j ],\n",
" [-2.073182e+00-0.8841784j , -3.048077e-01+0.2344493j ]],\n",
"\n",
" [[ 2.441069e-01-0.2828671j , 2.493647e+00+1.179619j ],\n",
" [-1.956353e+00-1.022081j , -3.447069e-01+0.1793671j ]],\n",
"...\n",
" [[ 3.475757e-02+0.0352555j , 1.770043e-01+0.2258684j ],\n",
" [-1.343957e-01-0.1432316j , -4.149757e-02-0.05223549j]],\n",
"\n",
" [[ 2.719606e-02+0.03381913j, 1.438796e-01+0.1859595j ],\n",
" [-1.121204e-01-0.1246405j , -3.594606e-02-0.04361913j]],\n",
"\n",
" [[ 2.161943e-02+0.02911898j, 1.137554e-01+0.150974j ],\n",
" [-8.744459e-02-0.103626j , -2.562943e-02-0.03531898j]],\n",
"\n",
" [[ 1.514583e-02+0.02224749j, 8.349043e-02+0.1184608j ],\n",
" [-6.363958e-02-0.08284923j, -2.077583e-02-0.02673749j]],\n",
"\n",
" [[ 9.760046e-03+0.01694262j, 5.923743e-02+0.08950258j],\n",
" [-4.535258e-02-0.06544742j, -1.464005e-02-0.02036262j]],\n",
"\n",
" [[ 1.027061e-02+0.01265869j, 4.057636e-02+0.0674322j ],\n",
" [-3.114365e-02-0.0496578j , -1.030061e-02-0.01919869j]],\n",
"\n",
" [[ 4.834623e-03+0.00983358j, 2.643963e-02+0.05098311j],\n",
" [-2.203037e-02-0.03744689j, -2.953623e-03-0.01293358j]]])\n",
"Coordinates:\n",
" * output (output) <U2 'ex' 'ey'\n",
" * input (input) <U2 'hx' 'hy'\n",
" * period (period) float64 4.655 5.818 7.314 ... 1.872e+04 2.913e+04\n",
"Attributes:\n",
" survey: CONUS South\n",
" project: USMTArray\n",
" id: NMX20\n",
" name: Nations Draw, NM, USA\n",
" latitude: 34.470528\n",
" longitude: -108.712288\n",
" elevation: 1940.05\n",
" declination: 9.09\n",
" datum: WGS84\n",
" acquired_by: National Geoelectromagnetic Facility\n",
" start: 2020-09-20T19:03:06+00:00\n",
" end: 2020-10-07T20:28:00+00:00\n",
" runs_processed: ['NMX20a', 'NMX20b']\n",
" coordinate_system: geographic"
],
"text/plain": [
"