
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples/The_GS_Standard/plot_tifs_to_netcdf.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

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

        Click :ref:`here <sphx_glr_download_examples_The_GS_Standard_plot_tifs_to_netcdf.py>`
        to download the full example code

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

.. _sphx_glr_examples_The_GS_Standard_plot_tifs_to_netcdf.py:


Multiple TIFs to NetCDF conversion
----------------------------------
Dataset References:
Minsley, B.J., James, S.R., Bedrosian, P.A., Pace, M.D., Hoogenboom, B.E., and Burton, B.L., 2021, Airborne electromagnetic, magnetic, and radiometric survey of the Mississippi Alluvial Plain, November 2019 - March 2020: U.S. Geological Survey data release, https://doi.org/10.5066/P9E44CTQ.
James, S.R., and Minsley, B.J., 2021, Combined results and derivative products of hydrogeologic structure and properties from airborne electromagnetic surveys in the Mississippi Alluvial Plain: U.S. Geological Survey data release, https://doi.org/10.5066/P9382RCI.

.. GENERATED FROM PYTHON SOURCE LINES 10-15

.. code-block:: default

    import matplotlib.pyplot as plt
    from os.path import join
    from gspy import Survey
    from pprint import pprint








.. GENERATED FROM PYTHON SOURCE LINES 16-18

Convert the TIFs data to netcdf
+++++++++++++++++++++++++++++++

.. GENERATED FROM PYTHON SOURCE LINES 18-37

.. code-block:: default


    data_path = "..//..//supplemental//region//MAP"

    # Define ..//supplemental information file
    ..//supplemental = join(data_path, "data//Tempest_survey_md.json")

    # Add ..//supplemental information to the survey
    survey = Survey(..//supplemental)

    # Define input TIF-format data file and associated variable mapping file
    d_grid_supp = join(data_path, 'data//Tempest_rasters_md.json')

    # Read data and format as Griddata class object
    survey.add_raster(metadata_file=d_grid_supp)

    # Write NetCDF
    d_out = join(data_path, 'data//tifs.nc')
    survey.write_netcdf(d_out)








.. GENERATED FROM PYTHON SOURCE LINES 38-39

Read in the netcdf files

.. GENERATED FROM PYTHON SOURCE LINES 39-41

.. code-block:: default

    new_survey = Survey.read_netcdf(d_out)








.. GENERATED FROM PYTHON SOURCE LINES 42-43

Plotting

.. GENERATED FROM PYTHON SOURCE LINES 43-44

.. code-block:: default

    new_survey.raster['resistivity'].plot(col='z', vmax=3, cmap='jet')
    plt.show()


.. image-sg:: /examples/The_GS_Standard/images/sphx_glr_plot_tifs_to_netcdf_001.png
   :alt: z = 0.0, z = 5.0, z = 10.0, z = 15.0, z = 20.0
   :srcset: /examples/The_GS_Standard/images/sphx_glr_plot_tifs_to_netcdf_001.png
   :class: sphx-glr-single-img






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

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


.. _sphx_glr_download_examples_The_GS_Standard_plot_tifs_to_netcdf.py:

.. only:: html

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


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

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

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

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


.. only:: html

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

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