
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples/Creating_GS_Files/plot_xyz_workbench_to_netcdf.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_xyz_workbench_to_netcdf.py>`
        to download the full example code.

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

.. _sphx_glr_examples_Creating_GS_Files_plot_xyz_workbench_to_netcdf.py:


Workbench 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 ASEG data to NetCDF
+++++++++++++++++++++++++++++++

.. GENERATED FROM PYTHON SOURCE LINES 17-18

Initialize the Survey

.. GENERATED FROM PYTHON SOURCE LINES 18-28

.. code-block:: Python


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

    # Survey Metadata file
    metadata = join(data_path, "survey.yml")

    # Establish survey instance
    survey = gspy.Survey.from_dict(metadata)








.. GENERATED FROM PYTHON SOURCE LINES 29-30

1. Raw Data -

.. GENERATED FROM PYTHON SOURCE LINES 30-51

.. code-block:: Python

    data_container = survey.gs.add_container('data', **dict(content = "raw and processed data"))

    # Import workbench data files
    # Define input data file and associated metadata file
    d_data = join(data_path, 'data//prod_726_729raw_RAW_export.xyz')
    d_supp = join(data_path, 'data//raw_data.yml')

    # Add the raw AEM data as a tabular dataset
    rd = data_container.gs.add(key='raw_data', data_filename=d_data, metadata_file=d_supp)

    print(rd)

    # # 2. Inversion results
    # model_container = survey.gs.add_container('models', **dict(content='inverse models'))

    # # Import workbench inversion results
    # d_data = join(data_path, 'model//prod_726_729_LBv2_bky_MOD_dat.xyz')
    # d_supp = join(data_path, 'model//models.yml')
    # md = model_container.gs.add(key='inversion', data_filename=d_data, metadata_file=d_supp)

    # print(md)




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

 .. code-block:: none

    {1: 'lm_z', 2: 'hm_z'}
    <xarray.DataTree 'raw_data'>
    Group: /survey/data/raw_data
    │   Dimensions:          (index: 338, lm_gate_times: 28, hm_gate_times: 37)
    │   Coordinates:
    │     * index            (index) int32 1kB 0 1 2 3 4 5 6 ... 332 333 334 335 336 337
    │     * lm_gate_times    (lm_gate_times) float64 224B 1e-07 2.25e-07 ... 0.001394
    │     * hm_gate_times    (hm_gate_times) float64 296B 5.892e-05 ... 0.01044
    │       spatial_ref      float64 8B 0.0
    │       x                (index) float64 3kB 1.746e+06 1.746e+06 ... 1.745e+06
    │       y                (index) float64 3kB 1.981e+06 1.981e+06 ... 1.983e+06
    │       z                (index) float64 3kB 4.82 5.19 5.31 5.66 ... 5.44 5.26 5.21
    │   Data variables: (12/18)
    │       date             (index) object 3kB '2022-07-26' ... '2022-07-26'
    │       time             (index) object 3kB '12:36:24.002' ... '12:42:21.342'
    │       line_no          (index) int64 3kB 101201 101201 101201 ... 200801 200801
    │       utmx             (index) float64 3kB 1.746e+06 1.746e+06 ... 1.745e+06
    │       utmy             (index) float64 3kB 1.981e+06 1.981e+06 ... 1.983e+06
    │       elevation        (index) float64 3kB 4.82 5.19 5.31 5.66 ... 5.44 5.26 5.21
    │       ...               ...
    │       tilt_y           (index) float64 3kB 3.8 3.3 3.3 3.0 2.8 ... 2.0 1.9 1.1 0.9
    │       tilt_y_std       (index) float64 3kB 1.004 1.004 1.004 ... 1.004 1.004 1.004
    │       DBDT_LM_Z        (index, lm_gate_times) float64 76kB 9.999e+03 ... 9.999e+03
    │       DBDT_STD_LM_Z    (index, lm_gate_times) float64 76kB 9.999e+03 ... 9.999e+03
    │       DBDT_HM_Z        (index, hm_gate_times) float64 100kB nan nan ... nan nan
    │       DBDT_STD_HM_Z    (index, hm_gate_times) float64 100kB nan nan ... nan nan
    │   Attributes:
    │       uuid:        9e3330ba-0aaa-448a-ac82-9990ea399e13
    │       content:     raw data
    │       comment:     ??
    │       type:        data
    │       structure:   tabular
    │       mode:        airborne
    │       method:      electromagnetic
    │       submethod:   time domain
    │       instrument:  skytem
    │       property:    
    └── Group: /survey/data/raw_data/nominal_system
            Dimensions:                                      (gate_times: 22, nv: 2,
                                                              lm_gate_times: 28,
                                                              hm_gate_times: 37,
                                                              n_loop_vertices: 8, xyz: 3,
                                                              n_transmitter: 2,
                                                              transmitter_lm_waveform_time: 21,
                                                              transmitter_hm_waveform_time: 36,
                                                              n_receiver: 1, n_component: 2)
            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 8B 0
              * n_component                                  (n_component) int64 16B 0 1
            Data variables: (12/32)
                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 592B ...
                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'...
                ...                                           ...
                component_sample_rate                        (n_component) float64 16B 0....
                component_txrx_dx                            (n_component) float64 16B -1...
                component_txrx_dy                            (n_component) float64 16B 0....
                component_txrx_dz                            (n_component) float64 16B -2...
                component_data_type                          (n_component) <U4 32B 'dBdt'...
                component_gate_times                         (n_component) <U13 104B 'lm_...
            Attributes:
                type:                      system
                mode:                      airborne
                method:                    electromagnetic
                submethod:                 time domain
                instrument:                skytem
                uuid:                      c9718fcd-cdc2-48be-a014-c693b4af673f
                name:                      nominal_system
                data_normalized:           True
                skytem_skb_gex_available:  True
                reference_frame:           right-handed positive down
                coil_orientations:         X, Z
                sample_rate:               0.1





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

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


.. _sphx_glr_download_examples_Creating_GS_Files_plot_xyz_workbench_to_netcdf.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: plot_xyz_workbench_to_netcdf.ipynb <plot_xyz_workbench_to_netcdf.ipynb>`

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

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

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

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


.. only:: html

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

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