.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/Data_conversion/plot_csv_to_netcdf.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_Data_conversion_plot_csv_to_netcdf.py: CSV to NetCDF conversion ------------------------- Dataset Reference: Burton, B.L., Minsley, B.J., Bloss, B.R., and Kress, W.H., 2021, Airborne electromagnetic, magnetic, and radiometric survey of the Mississippi Alluvial Plain, November 2018 - February 2019: U.S. Geological Survey data release, https://doi.org/10.5066/P9XBBBUU. .. GENERATED FROM PYTHON SOURCE LINES 9-13 .. code-block:: default import matplotlib.pyplot as plt from os.path import join from gspy import Survey .. GENERATED FROM PYTHON SOURCE LINES 14-16 Convert the CSV data folder to netcdf ++++++++++++++++++++++++++++++++++++++ .. GENERATED FROM PYTHON SOURCE LINES 16-43 .. code-block:: default # Path to example files data_path = '..//..//supplemental//' metadata = data_path + "region//MAP//data//Resolve_survey_information.json" # Establish the Survey survey = Survey(metadata) # Define input CSV-format data file and associated variable mapping file d_data = data_path + 'region//MAP//data//Resolve.csv' d_supp = data_path + 'region//MAP//data//Resolve_data_information.json' # Read data and format as Linedata class object survey.add_tabular(type='csv', data_filename=d_data, metadata_file=d_supp) # Define input CSV-format model file and associated variable mapping file m_data = data_path + 'region//MAP//model//Resolve_model_0.csv' m_supp = data_path + 'region//MAP//model//Resolve_model_information.json' # Read model data and format as Linemodel class object survey.add_tabular(type='csv', data_filename=m_data, metadata_file=m_supp) # Save NetCDF file d_out = data_path + 'region//MAP//model//Resolve.nc' survey.write_netcdf(d_out) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none DEP_BOT passed dimensions do not align with data, skipping THK passed dimensions do not align with data, skipping .. GENERATED FROM PYTHON SOURCE LINES 44-45 Read in the netcdf files .. GENERATED FROM PYTHON SOURCE LINES 45-47 .. code-block:: default new_survey = Survey().read_netcdf(d_out) .. GENERATED FROM PYTHON SOURCE LINES 48-49 Plotting .. GENERATED FROM PYTHON SOURCE LINES 49-56 .. code-block:: default plt.figure() new_survey.tabular[0].scatter('DTM', vmin=30, vmax=50) plt.xlim([500000, 540000]) plt.ylim([1175000, 1210000]) plt.figure() new_survey.tabular[1].scatter('DEM') plt.show() .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/Data_conversion/images/sphx_glr_plot_csv_to_netcdf_001.png :alt: spatial_ref = 0.0 :srcset: /examples/Data_conversion/images/sphx_glr_plot_csv_to_netcdf_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/Data_conversion/images/sphx_glr_plot_csv_to_netcdf_002.png :alt: spatial_ref = 0.0 :srcset: /examples/Data_conversion/images/sphx_glr_plot_csv_to_netcdf_002.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 2.950 seconds) .. _sphx_glr_download_examples_Data_conversion_plot_csv_to_netcdf.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_csv_to_netcdf.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_csv_to_netcdf.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_