
.. 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_skytem.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_examples_Creating_GS_Files_plot_csv_skytem.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_examples_Creating_GS_Files_plot_csv_skytem.py:


CSV & Rasters: Multi-dataset Survey with Derivative Products
------------------------------------------------------------

This example demonstrates the typical workflow for creating a GS file for an AEM survey in its entirety, i.e., the NetCDF file contains all related datasets together, e.g., raw data, processed data, inverted models, and derivative products. Specifically, this survey contains:

1. Minimally processed (raw) AEM data and raw/processed magnetic data provided by SkyTEM
2. Fully processed AEM data used as input to inversion
3. Laterally constrained inverted resistivity models
4. Point-data estimates of bedrock depth derived from the AEM models
5. Interpolated magnetic and bedrock depth grids

Note:
To make the size of this example more managable, some of the input datasets have been downsampled relative to the source files in the data release referenced below.

Source Reference: Minsley, B.J, Bloss, B.R., Hart, D.J., Fitzpatrick, W., Muldoon, M.A., Stewart, E.K., Hunt, R.J., James, S.R., Foks, N.L., and Komiskey, M.J., 2022, Airborne electromagnetic and magnetic survey data, northeast Wisconsin (ver. 1.1, June 2022): U.S. Geological Survey data release, https://doi.org/10.5066/P93SY9LI.

.. GENERATED FROM PYTHON SOURCE LINES 20-30

.. code-block:: Python

    import matplotlib.pyplot as plt
    from os.path import join
    import numpy as np
    import gspy
    from gspy import Survey, Metadata
    import xarray as xr
    from pprint import pprint
    import warnings
    warnings.filterwarnings('ignore')








.. GENERATED FROM PYTHON SOURCE LINES 31-33

Initialize the Survey
^^^^^^^^^^^^^^^^^^^^^

.. GENERATED FROM PYTHON SOURCE LINES 33-43

.. code-block:: Python


    # Path to example files
    data_path = '..//data_files//skytem_csv'

    # Survey metadata file
    metadata = join(data_path, "data//skytem_survey.yml")

    # Establish the Survey
    survey = Survey.from_dict(metadata)








.. GENERATED FROM PYTHON SOURCE LINES 44-49

.. literalinclude:: /../../examples/data_files/skytem_csv/data/skytem_survey.yml
   :language: yaml
   :linenos:
   :caption: Survey YAML file


.. GENERATED FROM PYTHON SOURCE LINES 52-54

Create a Data Branch
^^^^^^^^^^^^^^^^^^^^

.. GENERATED FROM PYTHON SOURCE LINES 54-58

.. code-block:: Python


    data_container = survey.gs.add_container('data', **dict(content = "raw and processed data",
                                                            comment = "<extra info goes here>"))








.. GENERATED FROM PYTHON SOURCE LINES 59-60

Attach leaves to the data branch

.. GENERATED FROM PYTHON SOURCE LINES 62-63

1. Raw Data

.. GENERATED FROM PYTHON SOURCE LINES 63-79

.. code-block:: Python


    # Import raw AEM data from CSV-format.
    # Define input data file and associated metadata file
    d_data1 = join(data_path, 'data//skytem_contractor_data.csv')
    d_supp1 = join(data_path, 'data//skytem_contractor_data.yml')

    raw_systems = Metadata.read(join(data_path, "data//skytem_system.yml"))

    # raw_systems = {"skytem_system" : survey["nominal_system"],
            #   "magnetic_system" : survey["magnetic_system"]}

    # Add the raw AEM data as a tabular dataset,
    # pass the EM system from the survey
    rd = data_container.gs.add(key='raw_data', data=d_data1,
                               metadata_file=d_supp1, system=raw_systems)








.. GENERATED FROM PYTHON SOURCE LINES 80-81

2. Processed Data

.. GENERATED FROM PYTHON SOURCE LINES 81-89

.. code-block:: Python


    # Import processed AEM data from CSV-format.
    # Define input data file and associated metadata file
    d_data2 = join(data_path, 'data//skytem_processed_data.csv')
    d_supp2 = join(data_path, 'data//skytem_processed_data.yml')

    print(rd['skytem_system'])





.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    <xarray.DataTree 'skytem_system'>
    Group: /survey/data/raw_data/skytem_system
        Dimensions:                                      (index: 2000,
                                                          hm_gate_times: 32,
                                                          lm_gate_times: 28,
                                                          gate_times: 22, nv: 2,
                                                          n_loop_vertices: 8, xyz: 3,
                                                          n_transmitter: 2,
                                                          transmitter_lm_waveform_time: 21,
                                                          transmitter_hm_waveform_time: 36,
                                                          n_receiver: 2, n_couplet: 4,
                                                          dim_0: 1)
        Coordinates:
          * gate_times                                   (gate_times) float64 176B 5....
          * nv                                           (nv) int64 16B 0 1
          * n_loop_vertices                              (n_loop_vertices) int64 64B ...
          * xyz                                          (xyz) int64 24B 0 1 2
          * n_transmitter                                (n_transmitter) int64 16B 0 1
          * transmitter_lm_waveform_time                 (transmitter_lm_waveform_time) float64 168B ...
          * transmitter_hm_waveform_time                 (transmitter_hm_waveform_time) float64 288B ...
          * n_receiver                                   (n_receiver) int64 16B 0 1
          * n_couplet                                    (n_couplet) int64 32B 0 1 2 3
        Inherited coordinates:
          * index                                        (index) int32 8kB 0 1 ... 1999
          * hm_gate_times                                (hm_gate_times) float64 256B ...
          * lm_gate_times                                (lm_gate_times) float64 224B ...
        Dimensions without coordinates: dim_0
        Data variables: (12/35)
            gate_times_bnds                              (gate_times, nv) float64 352B ...
            lm_gate_times_bnds                           (lm_gate_times, nv) float64 448B ...
            hm_gate_times_bnds                           (hm_gate_times, nv) float64 512B ...
            n_loop_vertices_bnds                         (n_loop_vertices, nv) float64 128B ...
            xyz_bnds                                     (xyz, nv) float64 48B -0.5 ....
            transmitter_label                            (n_transmitter) <U2 16B 'LM'...
            ...                                           ...
            couplet_data_type                            (n_couplet) <U4 64B 'dBdt' ....
            couplet_gate_times                           (n_couplet) <U13 208B 'lm_ga...
            data_normalized                              (dim_0) bool 1B True
            skytem_skb_gex_available                     (dim_0) bool 1B True
            reference_frame                              <U26 104B 'right-handed posi...
            coil_orientations                            <U4 16B 'X, Z'
        Attributes:
            type:        system
            mode:        airborne
            method:      electromagnetic, time domain
            instrument:  SkyTEM 304M
            name:        skytem_system




.. GENERATED FROM PYTHON SOURCE LINES 90-91

Example of how systems can be selected and modified to accurately match the processed data

.. GENERATED FROM PYTHON SOURCE LINES 91-95

.. code-block:: Python

    proc_systems = {"skytem_system" : rd["skytem_system"].isel(lm_gate_times=np.s_[1:],
                                                              hm_gate_times=np.s_[10:]),
              "magnetic_system" : rd["magnetic_system"]}








.. GENERATED FROM PYTHON SOURCE LINES 96-97

Add the processed AEM data as a tabular dataset, passing the updated systems

.. GENERATED FROM PYTHON SOURCE LINES 97-100

.. code-block:: Python

    pd = data_container.gs.add(key='processed_data', data=d_data2,
                               metadata_file=d_supp2, system=proc_systems)








.. GENERATED FROM PYTHON SOURCE LINES 101-106

.. literalinclude:: /../../examples/data_files/skytem_csv/data/skytem_processed_data.yml
   :language: yaml
   :linenos:
   :caption: Processed Data YAML file


.. GENERATED FROM PYTHON SOURCE LINES 109-111

Create a Models Branch
^^^^^^^^^^^^^^^^^^^^^^

.. GENERATED FROM PYTHON SOURCE LINES 111-115

.. code-block:: Python


    # Create a new container for models
    model_container = survey.gs.add_container('models', **dict(content = "Inverted models",
                                                              comment = "This is a test"))







.. GENERATED FROM PYTHON SOURCE LINES 116-117

3. Inverted Models

.. GENERATED FROM PYTHON SOURCE LINES 117-127

.. code-block:: Python


    # Import inverted AEM models from CSV-format.
    # Define input data file and associated metadata file
    m_data3 = join(data_path, 'model//skytem_inverted_models.csv')
    m_supp3 = join(data_path, 'model//skytem_inverted_models.yml')

    # Add the inverted AEM models as a tabular dataset
    mods = model_container.gs.add(key='inverted_models', data=m_data3,
                                  metadata_file=m_supp3)








.. GENERATED FROM PYTHON SOURCE LINES 128-133

.. literalinclude:: /../../examples/data_files/skytem_csv/model/skytem_inverted_models.yml
   :language: yaml
   :linenos:
   :caption: Inverted Models YAML file


.. GENERATED FROM PYTHON SOURCE LINES 136-138

Derivative Products
^^^^^^^^^^^^^^^^^^^

.. GENERATED FROM PYTHON SOURCE LINES 140-141

4. Bedrock Picks

.. GENERATED FROM PYTHON SOURCE LINES 143-144

Adding bedrock picks to the 'data' branch

.. GENERATED FROM PYTHON SOURCE LINES 144-154

.. code-block:: Python


    # Import AEM-based estimated of depth to bedrock from CSV-format.
    # Define input data file and associated metadata file
    d_data4 = join(data_path, 'data//top_dolomite_blocky_lidar.csv')
    d_supp4 = join(data_path, 'data//bedrock_picks.yml')

    # Add the AEM-based estimated of depth to bedrock as a tabular dataset
    bedrock = data_container.gs.add(key='depth_to_bedrock', data=d_data4,
                                    metadata_file=d_supp4)








.. GENERATED FROM PYTHON SOURCE LINES 155-160

.. literalinclude:: /../../examples/data_files/skytem_csv/data/bedrock_picks.yml
   :language: yaml
   :linenos:
   :caption: Bedrock Picks YAML file


.. GENERATED FROM PYTHON SOURCE LINES 163-164

5. Raster Maps

.. GENERATED FROM PYTHON SOURCE LINES 166-167

Create a 3rd container for the derived raaster maps

.. GENERATED FROM PYTHON SOURCE LINES 167-177

.. code-block:: Python


    derived_maps = survey.gs.add_container('derived_maps', **dict(content = "raster products derived from airborne data and models"))

    # Import interpolated bedrock and magnetic maps from TIF-format.
    # Define input metadata file (which contains the TIF filenames linked to variable names)
    m_supp5 = join(data_path, 'data//magnetics_bedrock_picks.yml')

    # Add the interpolated maps as a raster dataset
    maps = derived_maps.gs.add(key='maps', metadata_file=m_supp5)








.. GENERATED FROM PYTHON SOURCE LINES 178-183

.. literalinclude:: /../../examples/data_files/skytem_csv/data/magnetics_bedrock_picks.yml
   :language: yaml
   :linenos:
   :caption: Gridded Maps YAML file


.. GENERATED FROM PYTHON SOURCE LINES 186-188

Save to NetCDF file
^^^^^^^^^^^^^^^^^^^

.. GENERATED FROM PYTHON SOURCE LINES 188-193

.. code-block:: Python


    d_out = join(data_path, 'skytem.nc')
    survey.gs.to_netcdf(d_out)









.. GENERATED FROM PYTHON SOURCE LINES 194-196

Export just one branch to file
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. GENERATED FROM PYTHON SOURCE LINES 198-199

The gspy goal is to have the complete survey in a single file. However, we can also save containers or datasets separately.

.. GENERATED FROM PYTHON SOURCE LINES 199-202

.. code-block:: Python


    data_container.gs.to_netcdf(join(data_path, 'test_datacontainer.nc'))








.. GENERATED FROM PYTHON SOURCE LINES 203-205

Opening a GS NetCDF
^^^^^^^^^^^^^^^^^^^

.. GENERATED FROM PYTHON SOURCE LINES 205-207

.. code-block:: Python

    new_survey = gspy.open_datatree(d_out)['survey']








.. GENERATED FROM PYTHON SOURCE LINES 208-210

View the Data Tree
^^^^^^^^^^^^^^^^^^

.. GENERATED FROM PYTHON SOURCE LINES 210-213

.. code-block:: Python


    print(new_survey.gs.tree)





.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    /survey
    /survey/data
    /survey/models
    /survey/derived_maps
    /survey/data/raw_data
    /survey/data/processed_data
    /survey/data/depth_to_bedrock
    /survey/models/inverted_models
    /survey/derived_maps/maps
    /survey/data/raw_data/skytem_system
    /survey/data/raw_data/magnetic_system
    /survey/data/processed_data/skytem_system
    /survey/data/processed_data/magnetic_system
    /survey/models/inverted_models/inversion_parameters





.. GENERATED FROM PYTHON SOURCE LINES 214-216

.. code-block:: Python

    print(new_survey)





.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    <xarray.DataTree 'survey'>
    Group: /survey
    │   Dimensions:                 ()
    │   Coordinates:
    │       spatial_ref             float64 8B ...
    │   Data variables:
    │       survey_information      float64 8B ...
    │       flightline_information  float64 8B ...
    │       survey_equipment        float64 8B ...
    │   Attributes:
    │       type:          survey
    │       title:         SkyTEM Airborne Electromagnetic (AEM) Survey, Northeast Wi...
    │       institution:   USGS Geology, Geophysics, and Geochemistry Science Center
    │       source:        SkyTEM raw data, USGS processed data and inverted resistiv...
    │       history:       (1) Data acquisition 01/2021 - 02/2021 by SkyTEM Canada In...
    │       references:    Minsley, Burke J., B.R. Bloss, D.J. Hart, W. Fitzpatrick, ...
    │       comment:       This dataset includes minimally processed (raw) AEM and ra...
    │       summary:       Airborne electromagnetic (AEM) and magnetic survey data we...
    │       content:       Wisconsin SkyTEM survey information /survey; raw and proce...
    │       gspy_version:  2.2.8
    │       conventions:   GS-2.0, CF-1.13
    ├── Group: /survey/data
    │   │   Dimensions:      ()
    │   │   Data variables:
    │   │       spatial_ref  float64 8B ...
    │   │   Attributes:
    │   │       content:  raw and processed data
    │   │       comment:  <extra info goes here>
    │   │       type:     container
    │   ├── Group: /survey/data/raw_data
    │   │   │   Dimensions:          (index: 2000, hm_gate_times: 32, lm_gate_times: 28)
    │   │   │   Coordinates:
    │   │   │     * index            (index) float64 16kB 0.0 1.0 2.0 ... 1.998e+03 1.999e+03
    │   │   │     * hm_gate_times    (hm_gate_times) float64 256B 2.886e-05 ... 0.003544
    │   │   │     * lm_gate_times    (lm_gate_times) float64 224B -1.135e-06 ... 0.001394
    │   │   │       spatial_ref      float64 8B ...
    │   │   │       x                (index) float64 16kB ...
    │   │   │       y                (index) float64 16kB ...
    │   │   │       z                (index) float64 16kB ...
    │   │   │       t                (index) float64 16kB ...
    │   │   │   Data variables: (12/30)
    │   │   │       _60hz_intensity  (index) float64 16kB ...
    │   │   │       alt              (index) float64 16kB ...
    │   │   │       anglex           (index) float64 16kB ...
    │   │   │       angley           (index) float64 16kB ...
    │   │   │       base_mag         (index) float64 16kB ...
    │   │   │       curr_hm          (index) float64 16kB ...
    │   │   │       ...               ...
    │   │   │       mag_filt         (index) float64 16kB ...
    │   │   │       mag_raw          (index) float64 16kB ...
    │   │   │       n_wgs84          (index) float64 16kB ...
    │   │   │       rmf              (index) float64 16kB ...
    │   │   │       time             (index) object 16kB ...
    │   │   │       tmi              (index) float64 16kB ...
    │   │   │   Attributes:
    │   │   │       content:     raw data
    │   │   │       comment:     This dataset includes minimally processed (raw) AEM and raw/...
    │   │   │       type:        data
    │   │   │       structure:   tabular
    │   │   │       mode:        airborne
    │   │   │       method:      ['electromagnetic, time domain', 'magnetic']
    │   │   │       instrument:  SkyTEM 304M
    │   │   ├── Group: /survey/data/raw_data/skytem_system
    │   │   │       Dimensions:                                      (gate_times: 22, nv: 2,
    │   │   │                                                         lm_gate_times: 28,
    │   │   │                                                         hm_gate_times: 32,
    │   │   │                                                         n_loop_vertices: 8, xyz: 3,
    │   │   │                                                         n_transmitter: 2,
    │   │   │                                                         transmitter_lm_waveform_time: 21,
    │   │   │                                                         transmitter_hm_waveform_time: 36,
    │   │   │                                                         n_receiver: 2, n_couplet: 4,
    │   │   │                                                         dim_0: 1)
    │   │   │       Coordinates:
    │   │   │         * gate_times                                   (gate_times) float64 176B 5....
    │   │   │         * nv                                           (nv) float64 16B 0.0 1.0
    │   │   │         * n_loop_vertices                              (n_loop_vertices) float64 64B ...
    │   │   │         * xyz                                          (xyz) float64 24B 0.0 1.0 2.0
    │   │   │         * n_transmitter                                (n_transmitter) float64 16B ...
    │   │   │         * transmitter_lm_waveform_time                 (transmitter_lm_waveform_time) float64 168B ...
    │   │   │         * transmitter_hm_waveform_time                 (transmitter_hm_waveform_time) float64 288B ...
    │   │   │         * n_receiver                                   (n_receiver) float64 16B 0.0...
    │   │   │         * n_couplet                                    (n_couplet) float64 32B 0.0 ...
    │   │   │       Dimensions without coordinates: dim_0
    │   │   │       Data variables: (12/35)
    │   │   │           gate_times_bnds                              (gate_times, nv) float64 352B ...
    │   │   │           lm_gate_times_bnds                           (lm_gate_times, nv) float64 448B ...
    │   │   │           hm_gate_times_bnds                           (hm_gate_times, nv) float64 512B ...
    │   │   │           n_loop_vertices_bnds                         (n_loop_vertices, nv) float64 128B ...
    │   │   │           xyz_bnds                                     (xyz, nv) float64 48B ...
    │   │   │           transmitter_label                            (n_transmitter) <U2 16B ...
    │   │   │           ...                                           ...
    │   │   │           couplet_data_type                            (n_couplet) <U4 64B ...
    │   │   │           couplet_gate_times                           (n_couplet) <U13 208B ...
    │   │   │           data_normalized                              (dim_0) bool 1B ...
    │   │   │           skytem_skb_gex_available                     (dim_0) bool 1B ...
    │   │   │           reference_frame                              <U26 104B ...
    │   │   │           coil_orientations                            <U4 16B ...
    │   │   │       Attributes:
    │   │   │           type:        system
    │   │   │           mode:        airborne
    │   │   │           method:      electromagnetic, time domain
    │   │   │           instrument:  SkyTEM 304M
    │   │   │           name:        skytem_system
    │   │   └── Group: /survey/data/raw_data/magnetic_system
    │   │           Dimensions:                           (n_transmitter: 1, n_receiver: 1,
    │   │                                                  n_couplet: 1, n_base_magnetometer: 1,
    │   │                                                  base_mag_locations: 2)
    │   │           Coordinates:
    │   │             * n_transmitter                     (n_transmitter) float64 8B 0.0
    │   │             * n_receiver                        (n_receiver) float64 8B 0.0
    │   │             * n_couplet                         (n_couplet) float64 8B 0.0
    │   │             * n_base_magnetometer               (n_base_magnetometer) float64 8B 0.0
    │   │             * base_mag_locations                (base_mag_locations) float64 16B 1.0 2.0
    │   │           Data variables: (12/28)
    │   │               transmitter_label                 (n_transmitter) <U7 28B ...
    │   │               transmitter_description           (n_transmitter) <U142 568B ...
    │   │               receiver_label                    (n_receiver) <U19 76B ...
    │   │               receiver_sensor_type              (n_receiver) <U23 92B ...
    │   │               receiver_sensor_model             (n_receiver) <U6 24B ...
    │   │               receiver_sensor_manufacturer      (n_receiver) <U10 40B ...
    │   │               ...                                ...
    │   │               diurnal_correction                <U110 440B ...
    │   │               tieline_levelling                 <U33 132B ...
    │   │               microlevelling                    <U31 124B ...
    │   │               igrf_model_date                   <U21 84B ...
    │   │               igrf_model_location               <U54 216B ...
    │   │               igrf_model_height                 <U69 276B ...
    │   │           Attributes:
    │   │               type:        system
    │   │               mode:        airborne
    │   │               method:      magnetic
    │   │               instrument:  Geometrics G-822A cesium‑vapor magnetometer
    │   │               name:        magnetic_system
    │   ├── Group: /survey/data/processed_data
    │   │   │   Dimensions:          (index: 2000, lm_gate_times: 27, hm_gate_times: 22)
    │   │   │   Coordinates:
    │   │   │     * index            (index) float64 16kB 0.0 1.0 2.0 ... 1.998e+03 1.999e+03
    │   │   │     * lm_gate_times    (lm_gate_times) float64 216B 3.65e-07 ... 0.001394
    │   │   │     * hm_gate_times    (hm_gate_times) float64 176B 5.636e-05 ... 0.003544
    │   │   │       spatial_ref      float64 8B ...
    │   │   │       x                (index) float64 16kB ...
    │   │   │       y                (index) float64 16kB ...
    │   │   │       z                (index) float64 16kB ...
    │   │   │       t                (index) float64 16kB ...
    │   │   │   Data variables: (12/17)
    │   │   │       pindex           (index) float64 16kB ...
    │   │   │       sline_no         (index) float64 16kB ...
    │   │   │       record           (index) float64 16kB ...
    │   │   │       alt              (index) float64 16kB ...
    │   │   │       numdata          (index) float64 16kB ...
    │   │   │       lm_data          (index, lm_gate_times) float64 432kB ...
    │   │   │       ...               ...
    │   │   │       rx_altitude      (index) float64 16kB ...
    │   │   │       rx_altitude_std  (index) float64 16kB ...
    │   │   │       txrx_dx          (index) float64 16kB ...
    │   │   │       txrx_dy          (index) float64 16kB ...
    │   │   │       txrx_dz          (index) float64 16kB ...
    │   │   │       line_no          (index) float64 16kB ...
    │   │   │   Attributes:
    │   │   │       content:     processed data
    │   │   │       comment:     This dataset includes processed AEM data produced by USGS
    │   │   │       type:        data
    │   │   │       structure:   tabular
    │   │   │       mode:        airborne
    │   │   │       method:      electromagnetic, time domain
    │   │   │       instrument:  SkyTEM 304M
    │   │   ├── Group: /survey/data/processed_data/skytem_system
    │   │   │       Dimensions:                                      (gate_times: 22, nv: 2,
    │   │   │                                                         lm_gate_times: 27,
    │   │   │                                                         hm_gate_times: 22,
    │   │   │                                                         n_loop_vertices: 8, xyz: 3,
    │   │   │                                                         n_transmitter: 2,
    │   │   │                                                         transmitter_lm_waveform_time: 21,
    │   │   │                                                         transmitter_hm_waveform_time: 36,
    │   │   │                                                         n_receiver: 2, n_couplet: 4,
    │   │   │                                                         dim_0: 1)
    │   │   │       Coordinates:
    │   │   │         * gate_times                                   (gate_times) float64 176B 5....
    │   │   │         * nv                                           (nv) float64 16B 0.0 1.0
    │   │   │         * n_loop_vertices                              (n_loop_vertices) float64 64B ...
    │   │   │         * xyz                                          (xyz) float64 24B 0.0 1.0 2.0
    │   │   │         * n_transmitter                                (n_transmitter) float64 16B ...
    │   │   │         * transmitter_lm_waveform_time                 (transmitter_lm_waveform_time) float64 168B ...
    │   │   │         * transmitter_hm_waveform_time                 (transmitter_hm_waveform_time) float64 288B ...
    │   │   │         * n_receiver                                   (n_receiver) float64 16B 0.0...
    │   │   │         * n_couplet                                    (n_couplet) float64 32B 0.0 ...
    │   │   │       Dimensions without coordinates: dim_0
    │   │   │       Data variables: (12/35)
    │   │   │           gate_times_bnds                              (gate_times, nv) float64 352B ...
    │   │   │           lm_gate_times_bnds                           (lm_gate_times, nv) float64 432B ...
    │   │   │           hm_gate_times_bnds                           (hm_gate_times, nv) float64 352B ...
    │   │   │           n_loop_vertices_bnds                         (n_loop_vertices, nv) float64 128B ...
    │   │   │           xyz_bnds                                     (xyz, nv) float64 48B ...
    │   │   │           transmitter_label                            (n_transmitter) <U2 16B ...
    │   │   │           ...                                           ...
    │   │   │           couplet_data_type                            (n_couplet) <U4 64B ...
    │   │   │           couplet_gate_times                           (n_couplet) <U13 208B ...
    │   │   │           data_normalized                              (dim_0) bool 1B ...
    │   │   │           skytem_skb_gex_available                     (dim_0) bool 1B ...
    │   │   │           reference_frame                              <U26 104B ...
    │   │   │           coil_orientations                            <U4 16B ...
    │   │   │       Attributes:
    │   │   │           type:        system
    │   │   │           mode:        airborne
    │   │   │           method:      electromagnetic, time domain
    │   │   │           instrument:  SkyTEM 304M
    │   │   │           name:        skytem_system
    │   │   └── Group: /survey/data/processed_data/magnetic_system
    │   │           Dimensions:                           (n_transmitter: 1, n_receiver: 1,
    │   │                                                  n_couplet: 1, n_base_magnetometer: 1,
    │   │                                                  base_mag_locations: 2)
    │   │           Coordinates:
    │   │             * n_transmitter                     (n_transmitter) float64 8B 0.0
    │   │             * n_receiver                        (n_receiver) float64 8B 0.0
    │   │             * n_couplet                         (n_couplet) float64 8B 0.0
    │   │             * n_base_magnetometer               (n_base_magnetometer) float64 8B 0.0
    │   │             * base_mag_locations                (base_mag_locations) float64 16B 1.0 2.0
    │   │           Data variables: (12/28)
    │   │               transmitter_label                 (n_transmitter) <U7 28B ...
    │   │               transmitter_description           (n_transmitter) <U142 568B ...
    │   │               receiver_label                    (n_receiver) <U19 76B ...
    │   │               receiver_sensor_type              (n_receiver) <U23 92B ...
    │   │               receiver_sensor_model             (n_receiver) <U6 24B ...
    │   │               receiver_sensor_manufacturer      (n_receiver) <U10 40B ...
    │   │               ...                                ...
    │   │               diurnal_correction                <U110 440B ...
    │   │               tieline_levelling                 <U33 132B ...
    │   │               microlevelling                    <U31 124B ...
    │   │               igrf_model_date                   <U21 84B ...
    │   │               igrf_model_location               <U54 216B ...
    │   │               igrf_model_height                 <U69 276B ...
    │   │           Attributes:
    │   │               type:        system
    │   │               mode:        airborne
    │   │               method:      magnetic
    │   │               instrument:  Geometrics G-822A cesium‑vapor magnetometer
    │   │               name:        magnetic_system
    │   └── Group: /survey/data/depth_to_bedrock
    │           Dimensions:       (index: 82864)
    │           Coordinates:
    │             * index         (index) float64 663kB 0.0 1.0 2.0 ... 8.286e+04 8.286e+04
    │               spatial_ref   float64 8B ...
    │               x             (index) float64 663kB ...
    │               y             (index) float64 663kB ...
    │           Data variables:
    │               id            (index) float64 663kB ...
    │               br_elevation  (index) float64 663kB ...
    │               zstd          (index) float64 663kB ...
    │               origintype    (index) float64 663kB ...
    │               editdate      (index) object 663kB ...
    │           Attributes:
    │               content:     bedrock elevation points
    │               comment:     This dataset includes AEM-derived point estimates of the ele...
    │               type:        data
    │               structure:   tabular
    │               mode:        airborne
    │               method:      electromagnetic, time domain
    │               instrument:  SkyTEM 304M
    ├── Group: /survey/models
    │   │   Dimensions:      ()
    │   │   Data variables:
    │   │       spatial_ref  float64 8B ...
    │   │   Attributes:
    │   │       content:  Inverted models
    │   │       comment:  This is a test
    │   │       type:     container
    │   └── Group: /survey/models/inverted_models
    │       │   Dimensions:           (layer_depth: 40, nv: 2, index: 2000)
    │       │   Coordinates:
    │       │     * layer_depth       (layer_depth) float64 320B 0.375 1.16 2.02 ... 262.6 343.8
    │       │     * nv                (nv) float64 16B 0.0 1.0
    │       │     * index             (index) float64 16kB 0.0 1.0 2.0 ... 1.998e+03 1.999e+03
    │       │       spatial_ref       float64 8B ...
    │       │       x                 (index) float64 16kB ...
    │       │       y                 (index) float64 16kB ...
    │       │       z                 (index) float64 16kB ...
    │       │       t                 (index) float64 16kB ...
    │       │   Data variables: (12/18)
    │       │       layer_depth_bnds  (layer_depth, nv) float64 640B ...
    │       │       pindex            (index) float64 16kB ...
    │       │       sline_no          (index) float64 16kB ...
    │       │       record            (index) float64 16kB ...
    │       │       alt               (index) float64 16kB ...
    │       │       invalt            (index) float64 16kB ...
    │       │       ...                ...
    │       │       rho_i_std         (index, layer_depth) float64 640kB ...
    │       │       dep_top           (index, layer_depth) float64 640kB ...
    │       │       dep_bot           (index, layer_depth) float64 640kB ...
    │       │       doi_conservative  (index) float64 16kB ...
    │       │       doi_standard      (index) float64 16kB ...
    │       │       line_no           (index) float64 16kB ...
    │       │   Attributes:
    │       │       content:     inverted resistivity models
    │       │       comment:     This dataset includes inverted resistivity models derived fr...
    │       │       type:        model
    │       │       structure:   tabular
    │       │       mode:        airborne
    │       │       method:      electromagnetic, time domain
    │       │       instrument:  SkyTEM 304M
    │       │       property:    electrical resistivity
    │       └── Group: /survey/models/inverted_models/inversion_parameters
    │               Dimensions:             ()
    │               Data variables:
    │                   model_file          <U33 132B ...
    │                   inversion_software  <U16 64B ...
    │                   software_version    <U9 36B ...
    │                   software_reference  <U11 44B ...
    │                   date                <U17 68B ...
    │                   description         <U253 1kB ...
    │                   data_file           <U32 128B ...
    │               Attributes:
    │                   type:        parameters
    │                   method:      electromagnetic, time domain
    │                   instrument:  SkyTEM 304M
    │                   mode:        airborne
    │                   property:    electrical resistivity
    │                   name:        inversion_parameters
    └── Group: /survey/derived_maps
        │   Dimensions:      ()
        │   Data variables:
        │       spatial_ref  float64 8B ...
        │   Attributes:
        │       content:  raster products derived from airborne data and models
        │       type:     container
        └── Group: /survey/derived_maps/maps
                Dimensions:                (x: 799, nv: 2, y: 1155)
                Coordinates:
                  * x                      (x) float64 6kB 6.551e+05 6.552e+05 ... 7.349e+05
                  * nv                     (nv) float64 16B 0.0 1.0
                  * y                      (y) float64 9kB 4.953e+05 4.952e+05 ... 3.799e+05
                    spatial_ref            float64 8B ...
                Data variables:
                    x_bnds                 (x, nv) float64 13kB ...
                    y_bnds                 (y, nv) float64 18kB ...
                    magnetic_tmi           (y, x) float64 7MB ...
                    magnetic_rmf           (y, x) float64 7MB ...
                    bedrock_top_elevation  (y, x) float32 4MB ...
                    bedrock_depth          (y, x) float32 4MB ...
                Attributes:
                    content:     gridded magnetic and bedrock maps
                    comment:     This dataset includes AEM-derived estimates of the elevation...
                    type:        data
                    structure:   raster
                    mode:        airborne
                    method:      ['electromagnetic, time domain', 'magnetic, total field']
                    instrument:  skytem
                    property:    ['total magnetic intensity', 'depth to bedrock']




.. GENERATED FROM PYTHON SOURCE LINES 217-219

Plotting Examples
^^^^^^^^^^^^^^^^^

.. GENERATED FROM PYTHON SOURCE LINES 219-224

.. code-block:: Python


    plt.figure()
    new_survey['data']['raw_data']['height'].plot()
    plt.tight_layout()




.. image-sg:: /examples/Creating_GS_Files/images/sphx_glr_plot_csv_skytem_001.png
   :alt: spatial_ref = 0.0
   :srcset: /examples/Creating_GS_Files/images/sphx_glr_plot_csv_skytem_001.png
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 225-230

.. code-block:: Python

    pcd = new_survey['data']['processed_data']
    plt.figure()
    pcd['tx_altitude'].plot()
    plt.tight_layout()




.. image-sg:: /examples/Creating_GS_Files/images/sphx_glr_plot_csv_skytem_002.png
   :alt: spatial_ref = 0.0
   :srcset: /examples/Creating_GS_Files/images/sphx_glr_plot_csv_skytem_002.png
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 231-237

.. code-block:: Python

    m = new_survey['derived_maps']['maps']
    plt.figure()
    m['magnetic_tmi'].plot(cmap='jet')
    plt.tight_layout()

    plt.show()



.. image-sg:: /examples/Creating_GS_Files/images/sphx_glr_plot_csv_skytem_003.png
   :alt: spatial_ref = 0.0
   :srcset: /examples/Creating_GS_Files/images/sphx_glr_plot_csv_skytem_003.png
   :class: sphx-glr-single-img






.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 1.565 seconds)


.. _sphx_glr_download_examples_Creating_GS_Files_plot_csv_skytem.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_skytem.ipynb <plot_csv_skytem.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: plot_csv_skytem.py <plot_csv_skytem.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: plot_csv_skytem.zip <plot_csv_skytem.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
