Loupe to NetCDF

import matplotlib.pyplot as plt
from os.path import join
import numpy as np
import gspy

Convert the Loupe csv data to NetCDF

Initialize the Survey

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

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

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

data_container = survey.gs.add_container('data')

data = join(data_path, 'data//Kankakee.dat')
metadata = join(data_path, 'data//Loupe_data_metadata.yml')
data_container.gs.add(key='raw_data', data_filename=data, metadata_file=metadata, file_type='loupe')
<xarray.DatasetView> Size: 2MB
Dimensions:       (index: 2474, gate_times: 23)
Coordinates:
    spatial_ref   float64 8B 0.0
  * index         (index) int32 10kB 0 1 2 3 4 5 ... 2469 2470 2471 2472 2473
    x             (index) float64 20kB 5.248e+05 5.248e+05 ... 5.246e+05
    y             (index) float64 20kB 4.583e+06 4.583e+06 ... 4.583e+06
    z             (index) float64 20kB 211.5 211.5 211.5 ... 211.0 211.1 211.1
  * gate_times    (gate_times) float64 184B 1.297e-05 1.495e-05 ... 0.002183
Data variables: (12/45)
    fid           (index) object 20kB '1' '2' '3' '4' ... '2961' '2962' '2963'
    acq           (index) float64 20kB 1.0 1.0 1.0 1.0 1.0 ... 6.0 6.0 6.0 6.0
    acq_rdg       (index) float64 20kB 0.0 1.0 2.0 3.0 ... 424.0 425.0 426.0
    acq_time      (index) object 20kB '20230808T175252.504075397Z' ... '20230...
    time          (index) object 20kB '20230808T175253.000000000Z' ... '20230...
    ts            (index) float64 20kB 1.692e+09 1.692e+09 ... 1.692e+09
    ...            ...
    y_powerphase  (index) float64 20kB 1.006 1.07 1.008 ... -2.718 -2.558 -2.693
    z_powerphase  (index) float64 20kB 1.663 1.679 1.748 ... 1.081 0.9304 0.8736
    X_CH          (index, gate_times) float64 455kB 491.5 357.4 ... 0.001494
    Y_CH          (index, gate_times) float64 455kB -6.219 6.26 ... -0.0268
    Z_CH          (index, gate_times) float64 455kB 499.8 434.7 ... 0.01253
    line          (index) int64 20kB 1 1 1 1 1 1 1 1 1 1 ... 6 6 6 6 6 6 6 6 6 6
Attributes:
    content:     raw data
    comment:     This dataset includes minimally processed (raw) AEM data
    type:        data
    method:      electromagnetic
    instrument:  loupe


Save to NetCDF file

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

Reading back in

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

Plotting

plt.figure()
new_survey['data/raw_data']['height'].plot(label='height')
new_survey['data/raw_data']['tx_height'].plot(label='tx_height')
new_survey['data/raw_data']['rx_height'].plot(label='rx_height')
plt.tight_layout()
plt.legend()

plt.show()
spatial_ref = 0.0

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

Gallery generated by Sphinx-Gallery