.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/Creating_GS_Files/plot_dat_loupe.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_Creating_GS_Files_plot_dat_loupe.py: DAT & XYZ (Loupe TEM) --------------------- This example demonstrates conversion of data from Loupe Geophysics' time domain electromagnetic (TEM) backpack system. The raw data is in .dat format as exported by the Loupe. The inverted resistivity models come as a set of syn/dat/inv .XYZ files exported by Aarhus Workbench. Source Reference: Minsley et al., in preparation, LoupeEM data and resistivity models from the Kankakee River groundwater-surface water interaction site, U.S. Geological Survey data release. .. GENERATED FROM PYTHON SOURCE LINES 12-19 .. code-block:: Python import matplotlib.pyplot as plt from os.path import join import numpy as np import gspy import warnings warnings.filterwarnings('ignore') .. GENERATED FROM PYTHON SOURCE LINES 20-22 Initialize the Survey ^^^^^^^^^^^^^^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 22-29 .. code-block:: Python # Path to example files data_path = '../data_files/loupe' # Survey metadata file metadata = join(data_path, "data//LoupeEM_survey_md.yml") .. GENERATED FROM PYTHON SOURCE LINES 30-31 Establish the Survey .. GENERATED FROM PYTHON SOURCE LINES 31-33 .. code-block:: Python survey = gspy.Survey.from_dict(metadata) .. GENERATED FROM PYTHON SOURCE LINES 34-39 .. literalinclude:: /../../examples/data_files/loupe/data/LoupeEM_survey_md.yml :language: yaml :linenos: :caption: Survey YAML file .. GENERATED FROM PYTHON SOURCE LINES 42-44 Create a 'data' branch and attach data leaves ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 44-47 .. code-block:: Python data_container = survey.gs.add_container('data', **dict(content='data container')) .. GENERATED FROM PYTHON SOURCE LINES 48-49 Attach raw data with the Loupe EM system .. GENERATED FROM PYTHON SOURCE LINES 49-53 .. code-block:: Python data = join(data_path, 'data//Kankakee.dat') metadata = join(data_path, 'data//Loupe_data_metadata.yml') .. GENERATED FROM PYTHON SOURCE LINES 54-57 .. code-block:: Python raw_data = data_container.gs.add(key='raw_data', data_filename=data, metadata_file=metadata, file_type='loupe') .. GENERATED FROM PYTHON SOURCE LINES 58-63 .. literalinclude:: /../../examples/data_files/loupe/data/Loupe_data_metadata.yml :language: yaml :linenos: :caption: Raw Data YAML file .. GENERATED FROM PYTHON SOURCE LINES 66-68 Create a 'models' branch and attach data leaves ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 70-71 Make the branch .. GENERATED FROM PYTHON SOURCE LINES 71-73 .. code-block:: Python model_container = survey.gs.add_container('models', **dict(content='models container')) .. GENERATED FROM PYTHON SOURCE LINES 74-75 Import Workbench XYZ inversion results (syn/dat/inv) .. GENERATED FROM PYTHON SOURCE LINES 77-79 GSPy automatically recognizes Workbench inversion files (syn/dat/inv), only one of the three files need to be passed to provide the base filename .. GENERATED FROM PYTHON SOURCE LINES 79-83 .. code-block:: Python d_data = join(data_path, 'model//Kankakee_MOD_dat.xyz') d_supp = join(data_path, 'model//models.yml') .. GENERATED FROM PYTHON SOURCE LINES 84-86 .. code-block:: Python md = model_container.gs.add(key='inversion', data_filename=d_data, metadata_file=d_supp) .. rst-class:: sphx-glr-script-out .. code-block:: none Detected gate_time metadata from the workbench files {'gate_times': {'centers': array([1.495e-05, 1.693e-05, 1.892e-05, 2.091e-05, 2.487e-05, 3.082e-05, 3.876e-05, 4.868e-05, 6.257e-05, 7.844e-05, 1.023e-04, 1.340e-04, 1.737e-04, 2.292e-04, 3.027e-04, 3.999e-04, 5.308e-04, 7.024e-04, 9.326e-04, 1.237e-03, 1.643e-03]), 'long_name': 'calibrated gate times', 'missing_value': 'not_defined', 'standard_name': 'gate_times', 'units': 'seconds'}} .. GENERATED FROM PYTHON SOURCE LINES 87-92 .. literalinclude:: /../../examples/data_files/loupe/model/models.yml :language: yaml :linenos: :caption: Inverted Models YAML file .. GENERATED FROM PYTHON SOURCE LINES 95-97 Save to NetCDF file ^^^^^^^^^^^^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 97-101 .. code-block:: Python d_out = join(data_path, 'Loupe.nc') survey.gs.to_netcdf(d_out) .. GENERATED FROM PYTHON SOURCE LINES 102-103 Reading back in the GS NetCDF file .. GENERATED FROM PYTHON SOURCE LINES 103-105 .. code-block:: Python new_survey = gspy.open_datatree(d_out)['survey'] .. GENERATED FROM PYTHON SOURCE LINES 106-108 Inspect the data tree ^^^^^^^^^^^^^^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 108-110 .. code-block:: Python print(new_survey) .. rst-class:: sphx-glr-script-out .. code-block:: none Group: /survey │ Dimensions: () │ Coordinates: │ spatial_ref float64 8B ... │ Data variables: │ survey_information float64 8B ... │ survey_equipment float64 8B ... │ Attributes: │ type: survey │ title: LoupeEM ground-based electromagnetic survey, Kankakee, Ind... │ institution: USGS Geology, Geophysics, and Geochemistry Science Center │ source: USGS raw and processed data, and inverted resistivity models │ history: (1) Data acquisition 20230808 - 20230809 by USGS Illinois ... │ references: Minsley, Burke J., et al., in preparation, Ground-based el... │ comment: This dataset includes minimally processed (raw) and fully ... │ summary: Ground-based electromagnetic data were collected in August... │ content: Kankakee LoupeEM survey information /survey; data containe... │ gspy_version: 2.2.4 │ conventions: GS-2.0, CF-1.13 ├── Group: /survey/data │ │ Dimensions: () │ │ Data variables: │ │ spatial_ref float64 8B ... │ │ Attributes: │ │ content: data container │ │ type: container │ └── Group: /survey/data/raw_data │ │ Dimensions: (index: 2474, gate_times: 23) │ │ Coordinates: │ │ * index (index) float64 20kB 0.0 1.0 2.0 ... 2.472e+03 2.473e+03 │ │ * gate_times (gate_times) float64 184B 1.297e-05 1.495e-05 ... 0.002183 │ │ spatial_ref float64 8B ... │ │ x (index) float64 20kB ... │ │ y (index) float64 20kB ... │ │ z (index) float64 20kB ... │ │ Data variables: (12/42) │ │ fid (index) object 20kB ... │ │ acq (index) float64 20kB ... │ │ acq_rdg (index) float64 20kB ... │ │ acq_time (index) object 20kB ... │ │ time (index) object 20kB ... │ │ ts (index) float64 20kB ... │ │ ... ... │ │ y_powerphase (index) float64 20kB ... │ │ z_powerphase (index) float64 20kB ... │ │ x_ch (index, gate_times) float64 455kB ... │ │ y_ch (index, gate_times) float64 455kB ... │ │ z_ch (index, gate_times) float64 455kB ... │ │ line (index) float64 20kB ... │ │ Attributes: │ │ content: raw loupe EM data │ │ comment: n/a │ │ type: data, │ │ mode: ground │ │ method: electromagnetic, time domain │ │ instrument: LoupeEM │ │ structure: tabular │ └── Group: /survey/data/raw_data/loupe_system │ Dimensions: (gate_times: 23, nv: 2, │ n_loop_vertices: 8, xyz: 3, │ n_transmitter: 1, waveform_time: 4, │ n_receiver: 3, n_couplet: 3) │ Coordinates: │ * nv (nv) float64 16B 0.0 1.0 │ * n_loop_vertices (n_loop_vertices) float64 64B 0.0 ..... │ * xyz (xyz) float64 24B 0.0 1.0 2.0 │ * n_transmitter (n_transmitter) float64 8B 0.0 │ * waveform_time (waveform_time) object 32B '-0.00277... │ * n_receiver (n_receiver) float64 24B 0.0 1.0 2.0 │ * n_couplet (n_couplet) float64 24B 0.0 1.0 2.0 │ Data variables: (12/35) │ gate_times_bnds (gate_times, nv) float64 368B ... │ n_loop_vertices_bnds (n_loop_vertices, nv) float64 128B ... │ xyz_bnds (xyz, nv) float64 48B ... │ transmitter_label (n_transmitter) ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_dat_loupe.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_dat_loupe.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_