1. Filtering data in 1D#
[ ]:
%load_ext autoreload
%autoreload 2
import pandas as pd
import plotly.io as pio
import airbornegeo
pio.renderers.default = "notebook"
/home/airbornegeo/airbornegeo/src/airbornegeo/levelling.py:21: TqdmExperimentalWarning: Using `tqdm.autonotebook.tqdm` in notebook mode. Use `tqdm.tqdm` instead to force console mode (e.g. in jupyter console)
from tqdm.autonotebook import tqdm
[2]:
data_df = pd.read_csv("../data/AGAP_gravity_survey.csv")
data_df = data_df[["easting", "northing", "line", "unixtime", "Free_air"]]
data_df = data_df.sort_values(["line", "unixtime"]).reset_index(drop=True)
# we need to filter based on horizontal distance along the flight line, so first we need to calculate the
# distance along each line
data_df["distance_along_line"] = airbornegeo.along_track_distance(
data_df,
groupby_column="line",
)
data_df.head()
[2]:
| easting | northing | line | unixtime | Free_air | distance_along_line | |
|---|---|---|---|---|---|---|
| 0 | 1.000024e+06 | 226237.330771 | 1 | 1.229507e+09 | 1186.4 | 0.000000 |
| 1 | 1.000083e+06 | 226246.631269 | 1 | 1.229507e+09 | 342.1 | 59.842447 |
| 2 | 1.000142e+06 | 226255.809132 | 1 | 1.229507e+09 | -1965.9 | 119.693401 |
| 3 | 1.000201e+06 | 226264.969079 | 1 | 1.229507e+09 | 820.0 | 179.545645 |
| 4 | 1.000260e+06 | 226274.156809 | 1 | 1.229507e+09 | 3198.0 | 239.285174 |
1.1. Filter a line#
[3]:
# extract a single line from the survey
line_df = data_df[data_df.line == 4]
line_df.head()
[3]:
| easting | northing | line | unixtime | Free_air | distance_along_line | |
|---|---|---|---|---|---|---|
| 8591 | 1.316050e+06 | 392090.546753 | 4 | 1.230570e+09 | 1971.6 | 0.000000 |
| 8592 | 1.315990e+06 | 392078.637888 | 4 | 1.230570e+09 | 1878.6 | 61.614338 |
| 8593 | 1.315929e+06 | 392066.728534 | 4 | 1.230570e+09 | -602.0 | 123.228587 |
| 8594 | 1.315869e+06 | 392054.833235 | 4 | 1.230570e+09 | -2875.9 | 184.956734 |
| 8595 | 1.315808e+06 | 392042.937442 | 4 | 1.230570e+09 | 39.0 | 246.684793 |
1.1.1. Spatial filtering#
We can perform 1D filtering based on the distance along the flight line.
[4]:
line_df["Free_air_filtered_spatial"] = airbornegeo.filter1d(
line_df,
filter_type="g19000+l", # 19 km low pass gaussian filter
data_column="Free_air",
filter_by_column="distance_along_line",
pad_width_percentage=10,
)
[5]:
airbornegeo.plotly_profiles(
line_df,
x="distance_along_line",
y=["Free_air", "Free_air_filtered_spatial"],
y_lims=airbornegeo.get_min_max(line_df.Free_air, robust=True),
)
[6]:
line_df = line_df.sort_values("unixtime")
line_df["Free_air_filtered_temporal"] = airbornegeo.filter1d(
line_df,
filter_type="g400+l", # 400 sec low pass gaussian filter
data_column="Free_air",
filter_by_column="unixtime",
pad_width_percentage=10,
)
[7]:
airbornegeo.plotly_profiles(
line_df,
x="unixtime",
y=["Free_air", "Free_air_filtered_temporal"],
y_lims=airbornegeo.get_min_max(line_df.Free_air, robust=True),
)
[8]:
airbornegeo.plotly_profiles(
line_df,
x="distance_along_line",
y=["Free_air_filtered_spatial", "Free_air_filtered_temporal"],
marker_sizes=[3, 1],
)
1.2. Filter all lines in a survey#
1.2.1. Spatial filtering#
[ ]:
# plot the unfiltered free-air gravity anoamly data
airbornegeo.plotly_points(
data_df[::10],
color_col="Free_air",
robust=True,
size=3,
)
[10]:
data_df["Free_air_filtered_spatial"] = airbornegeo.filter1d(
data_df,
filter_type="g19000+l", # 19 km low pass gaussian filter
data_column="Free_air",
filter_by_column="distance_along_line",
groupby_column="line",
pad_width_percentage=10,
)
[ ]:
# plot the filtered free-air gravity anomaly data
airbornegeo.plotly_points(
data_df[::10],
color_col="Free_air_filtered_spatial",
robust=True,
size=3,
)
1.2.2. Temporal filtering#
[12]:
data_df["Free_air_filtered_temporal"] = airbornegeo.filter1d(
data_df,
filter_type="g500+l", # 500 sec low pass gaussian filter
data_column="Free_air",
filter_by_column="unixtime",
groupby_column="line",
pad_width_percentage=10,
)
[ ]:
# plot the filtered free-air gravity anomaly data
airbornegeo.plotly_points(
data_df[::10],
color_col="Free_air_filtered_temporal",
robust=True,
size=3,
)