.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/The_GS_Standard/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_The_GS_Standard_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-45 .. code-block:: default # raise Exception("Get the resolve model 0 working. json files need changing etc.") # Path to example files data_path = '..//..//supplemental//region//MAP' metadata = join(data_path, "data//Resolve_survey_md.json") # Establish the Survey survey = Survey(metadata) # Define input CSV-format data file and associated variable mapping file d_data = join(data_path, 'data//Resolve.csv') d_supp = join(data_path, 'data//Resolve_data_md.json') # Read data and format 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 = join(data_path, 'model//Resolve_model.csv') m_supp = join(data_path, 'model//Resolve_model_md.json') # Read model data and format survey.add_tabular(type='csv', data_filename=m_data, metadata_file=m_supp) # Save NetCDF file d_out = join(data_path, 'model//Resolve.nc') survey.write_netcdf(d_out) .. GENERATED FROM PYTHON SOURCE LINES 46-47 Read in the netcdf files .. GENERATED FROM PYTHON SOURCE LINES 47-52 .. code-block:: default new_survey = Survey().read_netcdf(d_out) print(type(new_survey)) print(type(new_survey.tabular[0])) .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 53-54 Plotting .. GENERATED FROM PYTHON SOURCE LINES 54-65 .. code-block:: default plt.figure() new_survey.tabular[0].gs_tabular.scatter('DTM', vmin=30, vmax=50) plt.xlim([500000, 540000]) plt.ylim([1175000, 1210000]) plt.figure() new_survey.tabular[1].gs_tabular.scatter('DEM') # print(new_survey.tabular[0]['qd_final']) print(new_survey.tabular[1]) plt.show() .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/The_GS_Standard/images/sphx_glr_plot_csv_to_netcdf_001.png :alt: plot csv to netcdf :srcset: /examples/The_GS_Standard/images/sphx_glr_plot_csv_to_netcdf_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/The_GS_Standard/images/sphx_glr_plot_csv_to_netcdf_002.png :alt: plot csv to netcdf :srcset: /examples/The_GS_Standard/images/sphx_glr_plot_csv_to_netcdf_002.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none Dimensions: (index: 9999, layer_depth: 30, nv: 2) Coordinates: spatial_ref float64 ... * index (index) int32 0 1 2 3 4 5 ... 9994 9995 9996 9997 9998 * layer_depth (layer_depth) float64 0.5 1.55 2.7 ... 109.2 119.7 132.5 * nv (nv) int64 0 1 x (index) float64 5.36e+05 5.36e+05 ... 5.298e+05 5.297e+05 y (index) float64 1.205e+06 1.205e+06 ... 1.197e+06 z (index) float64 ... Data variables: (12/18) layer_depth_bnds (layer_depth, nv) float64 ... LINE (index) int64 ... LAT_WGS84_dd (index) float64 ... LON_WGS84_dd (index) float64 ... X_WGS84_Albers (index) float64 ... Y_WGS84_Albers (index) float64 ... ... ... RESDATA (index) float64 ... RESTOTAL (index) float64 ... RHO_I (index, layer_depth) float64 ... RHO_I_STD (index, layer_depth) float64 ... DOI_CONSERVATIVE (index) float64 ... DOI_STANDARD (index) float64 ... Attributes: content: inverted resistivity models comment: This dataset includes inverted resistivity models derived from ... .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 1.642 seconds) .. _sphx_glr_download_examples_The_GS_Standard_plot_csv_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_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 `_