CG6 data#
gSolve can import CG6 data from the instrument format file (not the Lynx format file) using the CG6Data class from the scintrex module.
Tip
Example script to process CG6 data can be found in the examples folder.
Import what’s needed.
from pathlib import Path
from gsolve import GravitySurvey
from gsolve.scintrex import CG6Data
from gsolve.tide.earth_tide import LongmanTidalCorrection
Set up the directory and files required.
data_path = Path(__file__).parent.parent
obs_path = data_path / "scintrex"
instrument_file = obs_path / "CG6_internal_format.dat"
Load and parse CG6 data#
Tip
loop information is read from the line column by setting loop_from_line=True
cg6data = CG6Data.from_file(instrument_file, loop_from_line=True)
Tip
An alternate method for defining loop is to set them based on gaps in observation times.
Use 12h gap to define a new loop and start loop numbering from 1.
cg6data.set_loop(time_gap="12h", loop_start=1)
Prepare gSolve objects#
Both observations and sites objects can be created directly from the cg6data.
Gravity Observations#
obs = cg6data.to_gsolve_observations()
Set the (beta) calibration factor#
obs.set_calibration_factor(1.0)
Plot the observed data for loop #2#
fig, ax = obs.plot_observed_data(
2,
"datetime",
"meter_reading_mgal",
savefilename=str(obs_path) + "/cg6_observations.png",
)
GravitySites#
Warning
This takes coordinates from CG-6 file, which may not be accurate enough for bouguer corrections if coords_source = ‘gps’, these should not be used for bouguer corrections as it just uses the instrument GPS```
sites = cg6data.to_gsolve_sites(coords_source='user') # gps or user
Set reference gravity, activate ties#
Here we use a dictionary to set the value of “WAIRAKEI_ABS to 0.0”.
sites.set_reference_gravity({"WAIRAKEI_ABS": 0.0})
sites.activate_ties(["WAIRAKEI_ABS"])
Calculate the earth tide correction which requires location information from sites#
longman = LongmanTidalCorrection(amp_factor=1.2)
obs.apply_earth_tide_correction(sites, tide_corrector=longman)
Calculate earth tide corrected gravity#
obs.calculate_tide_corrected_gravity()
Make a survey from the observations and sites#
survey = GravitySurvey(obs, sites)
Solve for gravity#
results = survey.solve_lstsq(
method=1, use_loops=True, calculate_calibration_factor=False, percentile_clipping=99
)
Inspect the results#
print(results.site_solution)
print(results.obs_solution)
results.plot_residual_drift(loop=1, filename=str(obs_path) + "/ cg6_residual_cdf.png")
results.plot_residual_cdf(loop=1, filename=str(obs_path) + "/ cg6_residual_drift.png")
results.plot_residual_drift(loop=2, filename=str(obs_path) + "/ cg6_residual_cdf.png")
results.plot_residual_cdf(loop=2, filename=str(obs_path) + "/ cg6_residual_drift.png")