Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix notebook example errors #114

Merged
merged 3 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/QuickOverview.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.9.1
# jupytext_version: 1.14.4
# kernelspec:
# display_name: Python 3
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
Expand Down Expand Up @@ -132,7 +132,7 @@
# To return data to SEG-Y after modification use the `segy_writer` function. `segy_writer` takes as argument a SEISNC dataset which
# requires certain attributes be set. You can also specify the byte locations to write header information.

# %%
# %% tags=[]
from segysak.segy import segy_writer

segy_writer(
Expand Down
6 changes: 3 additions & 3 deletions examples/example_amplitude_extraction_displays.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.9.1
# jupytext_version: 1.14.4
# kernelspec:
# display_name: Python 3
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
Expand Down Expand Up @@ -266,7 +266,7 @@
# To get the horizon window extraction for sum of amplitudes we now need to sum along the time axis. Or
# we can use the `np.apply_along_axis` function to apply a custom function to our masked cube.

# %%
# %% tags=[]
summed_amp = masked_data.sum(dim="twt")

f, ax = plt.subplots(figsize=(12, 4))
Expand Down
10 changes: 6 additions & 4 deletions examples/example_extract_arbitrary_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.1
# jupytext_version: 1.14.4
# kernelspec:
# display_name: Python 3
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
Expand Down Expand Up @@ -239,7 +239,7 @@
435050.21,
inplace=True,
)
f12_dev_pos.loc_to_tvdss(
f12_dev_pos.to_tvdss(
54.9,
inplace=True,
)
Expand Down Expand Up @@ -288,6 +288,8 @@
# %% [markdown]
# To extract the data along the well path we just need to interpolate using the additional `twt` DataArray.

# %%
# %% tags=[]
well_seismic = volve_3d.interp(**f12_dev_ilxl, twt=twt)
well_seismic.data.plot()

# %%
6 changes: 3 additions & 3 deletions examples/example_extract_data_on_a_horizon.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.9.1
# jupytext_version: 1.14.4
# kernelspec:
# display_name: Python 3
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
Expand Down Expand Up @@ -107,7 +107,7 @@
{"iline": top_hugin_ds.iline, "xline": top_hugin_ds.xline, "twt": top_hugin_ds.twt}
)

# %%
# %% tags=[]
#
fig = plt.figure(figsize=(15, 5))
top_hugin_amp.plot(cmap="bwr")
Expand Down
4 changes: 2 additions & 2 deletions examples/example_merge_surveys.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.1
# jupytext_version: 1.14.4
# kernelspec:
# display_name: Python 3
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
Expand Down
8 changes: 5 additions & 3 deletions examples/example_reading_and_writing_zgy.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.1
# jupytext_version: 1.14.4
# kernelspec:
# display_name: Python 3
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
Expand Down Expand Up @@ -71,7 +71,7 @@
# %% [markdown]
# Check that the global coordinates are the same.

# %%
# %% tags=[]
fig, axs = plt.subplots(ncols=2, figsize=(15, 6))

p1 = axs[0].pcolormesh(
Expand All @@ -97,3 +97,5 @@
)
plt.colorbar(p1, ax=axs[1], label="Seismic Amplitude")
axs[1].set_title("Loaded from ZGY")

# %%
6 changes: 3 additions & 3 deletions examples/example_segy_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.9.1
# jupytext_version: 1.14.4
# kernelspec:
# display_name: Python 3
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
Expand Down Expand Up @@ -87,7 +87,7 @@
# %% [markdown]
# We can also just plot up the geometry to check that everything looks ok, here the line numbering and coordinates seem to match up, great!

# %%
# %% tags=[]
fig, axs = plt.subplots(nrows=2, figsize=(12, 10), sharex=True, sharey=True)

scrape.plot(
Expand Down
7 changes: 4 additions & 3 deletions examples/example_segysak_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.9.1
# jupytext_version: 1.14.4
# kernelspec:
# display_name: Python 3
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---

# %%

# %% [markdown]
# # SEGY-SAK Basics
Expand Down Expand Up @@ -159,5 +160,5 @@
# %% [markdown]
# Sometimes we need to modify the dimensions because they were read wrong or to scale them. Modify your dimension from the seisnc and then put it back using `assign_coords`.

# %%
# %% tags=[]
new_seisnc.assign_coords(iline=new_seisnc.iline * 10, twt=new_seisnc.twt + 1500)
6 changes: 3 additions & 3 deletions examples/example_segysak_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.9.1
# jupytext_version: 1.14.4
# kernelspec:
# display_name: Python 3
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
Expand Down Expand Up @@ -98,7 +98,7 @@
#
# The lazy loading of data means we can plot what we want using `xarray` style slicing and `dask` will fetch only the data we need.

# %%
# %% tags=[]
fig, axs = plt.subplots(nrows=2, ncols=3, figsize=(20, 10))

iline = seisnc.sel(iline=10100).transpose("twt", "xline").data
Expand Down
9 changes: 5 additions & 4 deletions examples/example_segysak_segy_vectorisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.9.1
# jupytext_version: 1.14.4
# kernelspec:
# display_name: Python 3
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---

# %%

# %% [markdown] jupyter={"source_hidden": true}
# %% [markdown]
# # SEG-Y to Vector DataFrames and Back
#
# The connection of segysak to `xarray` greatly simplifies the process of vectorising segy 3D data and returning it to SEGY. To do this, one can use the close relationship between `pandas` and `xarray`.
Expand Down Expand Up @@ -80,5 +81,5 @@
# %% [markdown]
# Afterwards, use the `segy_writer` utility as normal to return to SEGY.

# %%
# %% tags=[]
segy_writer(volve_3d_ds, "test.segy")
11 changes: 8 additions & 3 deletions examples/example_working_with_3d_gathers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.1
# jupytext_version: 1.14.4
# kernelspec:
# display_name: Python 3
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
Expand Down Expand Up @@ -157,7 +157,7 @@
# %% [markdown]
# Stacking is the process of averaging the gathers for constant time to create a single trace per inline and crossline location.

# %%
# %% tags=[] jupyter={"outputs_hidden": true}
fig, axs = plt.subplots(ncols=3, figsize=(20, 10))

plot_kwargs = dict(vmax=5000, interpolation="bicubic", yincrease=False)
Expand All @@ -174,3 +174,8 @@
penobscot_3d_gath_muted.isel(iline=5).data.mean("offset").T.plot.imshow(
ax=axs[2], **plot_kwargs
)

# %% tags=[]
# !pip list

# %%
2 changes: 1 addition & 1 deletion segysak/segy/_segy_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
try:
has_ipywidgets = importlib.util.find_spec("ipywidgets") is not None
if has_ipywidgets:
from tqdm.autonotebook import tqdm
from tqdm.auto import tqdm
else:
from tqdm import tqdm as tqdm
except ModuleNotFoundError:
Expand Down
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ packages = find:
include_package_data = True
python_requires = >=3.7
install_requires =
numpy
numpy<1.24
pandas
matplotlib
segyio
xarray
dask
distributed
tqdm
scipy
scipy!=1.10.0 # version introduced bug with interp
click
pyzgy
h5netcdf
addict
more-itertools>=8.0
Expand Down