Usage
To use hygra in a project:
import hygra
A simple workflow is described and shown below, encompassing the following:
load relevant parts of package
from hygra import calculations as calc
from hygra import gravity_grid as grid
setup properties of gravity component grid
## gravimeter sensor
# [m]
sensor_height = 0.25
## set flat topography
filepath = "flat"
## set x, y and z spatial domain
range_x_o = [-10, 10]
range_y_o = [-10, 10]
range_z_o = [0, -5]
## set grid discrezitation
discr_o = [1, 1, 1]
# coordinates of sensor, relative to grid (here centered in grid)
sensor = [0,0,0 + sensor_height]
# origin of grid [x, y]
grid_origin = [0,0]
construct single grid
## construct grid class
ggrid = grid.gravityGrid(
filepath,
sensor,
discr_o,
range_x_o,
range_y_o,
range_z_o,
grid_origin,
grid_shape = "circle")
## create grid
ggrid.create_gcompGrid(method = "forsberg")
construct nested grid
The example below corresponds to a two-fold nested grid. See module documentation for more information.
## construct grid class
ggrid = grid.gravityGridNested(
[filepath, filepath],
sensor,
[discr_i, discr_o],
grid_radii,
range_z,
grid_origin)
## create grid
ggrid.create_gcompGrid()
correct grid for pillar (or similar objects)
ggrid.correct_pillar_cylinder(
pillar_radius = 1.8,
pillar_center = [0,0],
extent_z = [0, -13]
)
plot gravity component grid
## horizontal or bird-view
ggrid.plot()
## horizontal or bird-view of DEM
ggrid.plot(data = "dem")
## vertical cross-section (at intersect)
ggrid.plot(orientation = "vertical")
calculate topo factor
# for overall topofactor
ggrid.topoFactor()
# for topofactor of all relevenat layers
ggrid.topoFactors()
calcuate gravity response resuling from water storage changes (WSC)
## set water storage change amount and spatial locations (here 1D)
# first 1.0 meter of soil, 10 %VWC change
sm_changes = pd.DataFrame({"z": [0, -1], "timestamp": [1,1], "value": [.1, .1]})
## caluclate signal
g_change = ggrid.calc_response(sm_changes)
saving and loading gravity component grids
## save grid to binary object (pickle)
filepath = "path/to/store/grid-binary"
ggrid.save(filepath)
## load stored gravity component grid
ggrid_loaded = grid.load_gravityGrid(filepath)