Note
Go to the end to download the full example code.
Workbench to NetCDF
import matplotlib.pyplot as plt
from os.path import join
import numpy as np
import gspy
Convert the ASEG data to NetCDF
Initialize the Survey
# Path to example files
data_path = '..//..//..//..//example_material//example_4'
# Survey Metadata file
metadata = join(data_path, "survey.yml")
# Establish survey instance
survey = gspy.Survey.from_dict(metadata)
Raw Data -
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)
{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:
│ 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
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
Total running time of the script: (0 minutes 0.063 seconds)