.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/Creating_GS_Files/plot_csv_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_csv_loupe.py: Loupe to NetCDF --------------- .. GENERATED FROM PYTHON SOURCE LINES 7-12 .. code-block:: Python import matplotlib.pyplot as plt from os.path import join import numpy as np import gspy .. GENERATED FROM PYTHON SOURCE LINES 13-15 Convert the Loupe csv data to NetCDF ++++++++++++++++++++++++++++++++++++ .. GENERATED FROM PYTHON SOURCE LINES 17-18 Initialize the Survey .. GENERATED FROM PYTHON SOURCE LINES 18-34 .. code-block:: Python # Path to example files data_path = '..//..//..//..//example_material//example_3' # Survey metadata file metadata = join(data_path, "data//LoupeEM_survey_md.yml") # Establish the Survey survey = gspy.Survey.from_dict(metadata) data_container = survey.gs.add_container('data') data = join(data_path, 'data//Kankakee.dat') metadata = join(data_path, 'data//Loupe_data_metadata.yml') data_container.gs.add(key='raw_data', data_filename=data, metadata_file=metadata, file_type='loupe') .. raw:: html
<xarray.DataTree 'raw_data'>
    Group: /survey/data/raw_data
    │   Dimensions:       (index: 11633, gate_times: 23)
    │   Coordinates:
    │     * index         (index) int32 47kB 0 1 2 3 4 ... 11628 11629 11630 11631 11632
    │     * gate_times    (gate_times) float64 184B 1.297e-05 1.495e-05 ... 0.002183
    │       spatial_ref   float64 8B 0.0
    │       x             (index) float64 93kB 5.248e+05 5.248e+05 ... 5.248e+05
    │       y             (index) float64 93kB 4.583e+06 4.583e+06 ... 4.583e+06
    │       z             (index) float64 93kB 211.5 211.5 211.5 ... 204.4 204.4 204.4
    │   Data variables: (12/45)
    │       fid           (index) object 93kB '1' '2' '3' ... '12120' '12121' '12122'
    │       acq           (index) float64 93kB 1.0 1.0 1.0 1.0 ... 25.0 25.0 25.0 25.0
    │       acq_rdg       (index) float64 93kB 0.0 1.0 2.0 3.0 ... 364.0 365.0 366.0
    │       acq_time      (index) object 93kB '20230808T175252.504075397Z' ... '20230...
    │       time          (index) object 93kB '20230808T175253.000000000Z' ... '20230...
    │       ts            (index) float64 93kB 1.692e+09 1.692e+09 ... 1.692e+09
    │       ...            ...
    │       y_powerphase  (index) float64 93kB 1.006 1.07 1.008 ... -2.935 -2.884 -2.952
    │       z_powerphase  (index) float64 93kB 1.663 1.679 1.748 ... 0.9777 1.006 1.041
    │       X_CH          (index, gate_times) float64 2MB 491.5 357.4 ... 0.01459
    │       Y_CH          (index, gate_times) float64 2MB -6.219 6.26 ... -0.002063
    │       Z_CH          (index, gate_times) float64 2MB 499.8 434.7 ... 6.37e-05
    │       line          (index) int64 93kB 1 1 1 1 1 1 1 1 ... 25 25 25 25 25 25 25 25
    │   Attributes:
    │       content:     raw data
    │       comment:     This dataset includes minimally processed (raw) AEM data
    │       type:        data
    │       method:      electromagnetic
    │       instrument:  loupe
    └── 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_component: 3)
            Coordinates:
              * nv                                   (nv) int64 16B 0 1
              * n_loop_vertices                      (n_loop_vertices) int64 64B 0 1 ... 6 7
              * xyz                                  (xyz) int64 24B 0 1 2
              * n_transmitter                        (n_transmitter) int64 8B 0
              * waveform_time                        (waveform_time) <U32 512B '-0.002777...
              * n_receiver                           (n_receiver) int64 24B 0 1 2
              * n_component                          (n_component) int64 24B 0 1 2
            Data variables: (12/35)
                gate_times_bnds                      (gate_times, nv) float64 368B -9.238...
                n_loop_vertices_bnds                 (n_loop_vertices, nv) float64 128B -...
                xyz_bnds                             (xyz, nv) float64 48B -0.5 0.5 ... 2.5
                transmitter_label                    (n_transmitter) <U1 4B 'z'
                transmitter_number_of_turns          (n_transmitter) int64 8B 13
                transmitter_coordinates              (n_transmitter, n_loop_vertices, xyz) float64 192B ...
                ...                                   ...
                component_txrx_dx                    (n_component) float64 24B -10.0 ... ...
                component_txrx_dy                    (n_component) float64 24B 0.0 0.0 0.0
                component_txrx_dz                    (n_component) float64 24B -0.75 ... ...
                component_data_type                  (n_component) <U4 48B 'dBdt' ... 'dBdt'
                component_gate_times                 (n_component) <U10 120B 'gate_times'...
                sample_rate                          object 8B None
            Attributes:
                type:                    system
                mode:                    ground
                method:                  electromagnetic
                submethod:               time domain
                instrument:              loupe
                name:                    loupe_system
                data_normalized:         True
                reference_frame:         right-handed positive down
                sample_rate:             0.1
                digitization_frequency:  504000.0
                stacks:                  360
                powerline_frequency:     60.0


.. GENERATED FROM PYTHON SOURCE LINES 35-36 Save to NetCDF file .. GENERATED FROM PYTHON SOURCE LINES 36-39 .. code-block:: Python d_out = join(data_path, 'data//Loupe.nc') survey.gs.to_netcdf(d_out) .. GENERATED FROM PYTHON SOURCE LINES 40-41 Reading back in .. GENERATED FROM PYTHON SOURCE LINES 41-43 .. code-block:: Python new_survey = gspy.open_datatree(d_out)['survey'] .. GENERATED FROM PYTHON SOURCE LINES 44-45 Plotting .. GENERATED FROM PYTHON SOURCE LINES 45-52 .. code-block:: Python plt.figure() new_survey['data/raw_data']['height'].plot(label='height') new_survey['data/raw_data']['tx_height'].plot(label='tx_height') new_survey['data/raw_data']['rx_height'].plot(label='rx_height') plt.tight_layout() plt.legend() plt.show() .. image-sg:: /examples/Creating_GS_Files/images/sphx_glr_plot_csv_loupe_001.png :alt: spatial_ref = 0.0 :srcset: /examples/Creating_GS_Files/images/sphx_glr_plot_csv_loupe_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.454 seconds) .. _sphx_glr_download_examples_Creating_GS_Files_plot_csv_loupe.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_csv_loupe.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_csv_loupe.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_csv_loupe.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_