Skip to content

Commit edc5f71

Browse files
committed
Merge branch 'main' into euler-inversion
2 parents 773265a + d618730 commit edc5f71

File tree

13 files changed

+643
-538
lines changed

13 files changed

+643
-538
lines changed

doc/gallery_src/transformations/reduction_to_pole.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import pygmt
1414
import verde as vd
1515
import xarray as xr
16-
import xrft
1716

1817
import harmonica as hm
1918

@@ -22,15 +21,6 @@
2221
fname = ensaio.fetch_lightning_creek_magnetic(version=1)
2322
magnetic_grid = xr.load_dataarray(fname)
2423

25-
# Pad the grid to increase accuracy of the FFT filter
26-
pad_width = {
27-
"easting": magnetic_grid.easting.size // 3,
28-
"northing": magnetic_grid.northing.size // 3,
29-
}
30-
# drop the extra height coordinate
31-
magnetic_grid_no_height = magnetic_grid.drop_vars("height")
32-
magnetic_grid_padded = xrft.pad(magnetic_grid_no_height, pad_width)
33-
3424
# Define the inclination and declination of the region by the time of the data
3525
# acquisition (1990).
3626
inclination, declination = -52.98, 6.51
@@ -39,16 +29,11 @@
3929
# that the sources share the same inclination and declination as the
4030
# geomagnetic field.
4131
rtp_grid = hm.reduction_to_pole(
42-
magnetic_grid_padded, inclination=inclination, declination=declination
32+
magnetic_grid, inclination=inclination, declination=declination
4333
)
44-
45-
# Unpad the reduced to the pole grid
46-
rtp_grid = xrft.unpad(rtp_grid, pad_width)
47-
4834
# Show the reduced to the pole grid
4935
print("\nReduced to the pole magnetic grid:\n", rtp_grid)
5036

51-
5237
# Plot original magnetic anomaly and the reduced to the pole
5338
fig = pygmt.Figure()
5439
with fig.subplot(nrows=1, ncols=2, figsize=("28c", "15c"), sharey="l"):

doc/gallery_src/transformations/tga.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import pygmt
1414
import verde as vd
1515
import xarray as xr
16-
import xrft
1716

1817
import harmonica as hm
1918

@@ -22,21 +21,8 @@
2221
fname = ensaio.fetch_lightning_creek_magnetic(version=1)
2322
magnetic_grid = xr.load_dataarray(fname)
2423

25-
# Pad the grid to increase accuracy of the FFT filter
26-
pad_width = {
27-
"easting": magnetic_grid.easting.size // 3,
28-
"northing": magnetic_grid.northing.size // 3,
29-
}
30-
# drop the extra height coordinate
31-
magnetic_grid_no_height = magnetic_grid.drop_vars("height")
32-
magnetic_grid_padded = xrft.pad(magnetic_grid_no_height, pad_width)
33-
3424
# Compute the total gradient amplitude of the grid
35-
tga = hm.total_gradient_amplitude(magnetic_grid_padded)
36-
37-
# Unpad the total gradient amplitude grid
38-
tga = xrft.unpad(tga, pad_width)
39-
25+
tga = hm.total_gradient_amplitude(magnetic_grid)
4026
# Show the total gradient amplitude
4127
print("\nTotal Gradient Amplitude:\n", tga)
4228

doc/gallery_src/transformations/tilt.py

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import pygmt
1414
import verde as vd
1515
import xarray as xr
16-
import xrft
1716

1817
import harmonica as hm
1918

@@ -22,21 +21,8 @@
2221
fname = ensaio.fetch_lightning_creek_magnetic(version=1)
2322
magnetic_grid = xr.load_dataarray(fname)
2423

25-
# Pad the grid to increase accuracy of the FFT filter
26-
pad_width = {
27-
"easting": magnetic_grid.easting.size // 3,
28-
"northing": magnetic_grid.northing.size // 3,
29-
}
30-
# drop the extra height coordinate
31-
magnetic_grid_no_height = magnetic_grid.drop_vars("height")
32-
magnetic_grid_padded = xrft.pad(magnetic_grid_no_height, pad_width)
33-
3424
# Compute the tilt of the grid
35-
tilt_grid = hm.tilt_angle(magnetic_grid_padded)
36-
37-
# Unpad the tilt grid
38-
tilt_grid = xrft.unpad(tilt_grid, pad_width)
39-
25+
tilt_grid = hm.tilt_angle(magnetic_grid)
4026
# Show the tilt
4127
print("\nTilt:\n", tilt_grid)
4228

@@ -47,19 +33,12 @@
4733
# Apply a reduction to the pole over the magnetic anomaly grid. We will assume
4834
# that the sources share the same inclination and declination as the
4935
# geomagnetic field.
50-
rtp_grid_padded = hm.reduction_to_pole(
51-
magnetic_grid_padded, inclination=inclination, declination=declination
36+
rtp_grid = hm.reduction_to_pole(
37+
magnetic_grid, inclination=inclination, declination=declination
5238
)
5339

54-
# Unpad the reduced to the pole grid
55-
rtp_grid = xrft.unpad(rtp_grid_padded, pad_width)
56-
5740
# Compute the tilt of the padded rtp grid
58-
tilt_rtp_grid = hm.tilt_angle(rtp_grid_padded)
59-
60-
# Unpad the tilt grid
61-
tilt_rtp_grid = xrft.unpad(tilt_rtp_grid, pad_width)
62-
41+
tilt_rtp_grid = hm.tilt_angle(rtp_grid)
6342
# Show the tilt from RTP
6443
print("\nTilt from RTP:\n", tilt_rtp_grid)
6544

doc/gallery_src/transformations/upward_continuation.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import ensaio
1313
import pygmt
1414
import xarray as xr
15-
import xrft
1615

1716
import harmonica as hm
1817

@@ -21,22 +20,9 @@
2120
fname = ensaio.fetch_lightning_creek_magnetic(version=1)
2221
magnetic_grid = xr.load_dataarray(fname)
2322

24-
# Pad the grid to increase accuracy of the FFT filter
25-
pad_width = {
26-
"easting": magnetic_grid.easting.size // 3,
27-
"northing": magnetic_grid.northing.size // 3,
28-
}
29-
# drop the extra height coordinate
30-
magnetic_grid_no_height = magnetic_grid.drop_vars("height")
31-
magnetic_grid_padded = xrft.pad(magnetic_grid_no_height, pad_width)
32-
3323
# Upward continue the magnetic grid, from 500 m to 1000 m
3424
# (a height displacement of 500m)
35-
upward_continued = hm.upward_continuation(magnetic_grid_padded, height_displacement=500)
36-
37-
# Unpad the upward continued grid
38-
upward_continued = xrft.unpad(upward_continued, pad_width)
39-
25+
upward_continued = hm.upward_continuation(magnetic_grid, height_displacement=500)
4026
# Show the upward continued grid
4127
print("\nUpward continued magnetic grid:\n", upward_continued)
4228

doc/gallery_src/transformations/upward_derivative.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import pygmt
1414
import verde as vd
1515
import xarray as xr
16-
import xrft
1716

1817
import harmonica as hm
1918

@@ -22,21 +21,8 @@
2221
fname = ensaio.fetch_lightning_creek_magnetic(version=1)
2322
magnetic_grid = xr.load_dataarray(fname)
2423

25-
# Pad the grid to increase accuracy of the FFT filter
26-
pad_width = {
27-
"easting": magnetic_grid.easting.size // 3,
28-
"northing": magnetic_grid.northing.size // 3,
29-
}
30-
# drop the extra height coordinate
31-
magnetic_grid_no_height = magnetic_grid.drop_vars("height")
32-
magnetic_grid_padded = xrft.pad(magnetic_grid_no_height, pad_width)
33-
3424
# Compute the upward derivative of the grid
35-
deriv_upward = hm.derivative_upward(magnetic_grid_padded)
36-
37-
# Unpad the derivative grid
38-
deriv_upward = xrft.unpad(deriv_upward, pad_width)
39-
25+
deriv_upward = hm.derivative_upward(magnetic_grid)
4026
# Show the upward derivative
4127
print("\nUpward derivative:\n", deriv_upward)
4228

0 commit comments

Comments
 (0)