### Installing Packages with `pip` (Conceptual) Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Conceptual example of installing Python packages using pip. This command is run in the terminal. ```bash pip install package_name pip install -r requirements.txt ``` -------------------------------- ### Initialize and Run Bower's Well Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt This snippet shows how to initialize and run Bower's Well. It's a foundational example for starting any process with the tool. ```python from bower_well import BowerWell # Initialize BowerWell bw = BowerWell() # Run BowerWell bw.run() ``` -------------------------------- ### Install pyGeoPressure from Downloaded Zip Source: https://pygeopressure.readthedocs.io/en/latest/_sources/install.rst.txt Install pyGeoPressure after downloading and unzipping the repository from GitHub. Navigate to the directory and run pip install. ```bash pip install pyGeoPressure ``` -------------------------------- ### Install Eaton Seis Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_seis.ipynb.txt Install the Eaton Seis library using pip. This is the first step to using the library. ```bash pip install "eaton-seis" ``` -------------------------------- ### Install OBP Seis Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_seis.ipynb.txt Install the OBP Seis library using pip. This command ensures you have the latest stable version. ```bash pip install obp-seis ``` -------------------------------- ### Basic Usage Example Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt This snippet demonstrates a fundamental usage pattern. Ensure necessary imports are present. ```python import numpy as np import matplotlib.pyplot as plt from bower.well import Well # Example data pressure = np.array([100, 110, 120, 130, 140, 150]) temperature = np.array([30, 35, 40, 45, 50, 55]) depth = np.array([1000, 1200, 1400, 1600, 1800, 2000]) # Create a Well object well = Well(pressure, temperature, depth) # Plotting the well data plt.figure(figsize=(8, 6)) plt.plot(well.pressure, well.depth, label='Pressure') plt.plot(well.temperature, well.depth, label='Temperature') plt.xlabel('Value') plt.ylabel('Depth (m)') plt.title('Well Data') plt.legend() plt.grid(True) plt.show() ``` -------------------------------- ### Install pyGeoPressure from PyPI Source: https://pygeopressure.readthedocs.io/en/latest/_sources/install.rst.txt Install the pyGeoPressure package using pip from the Python Package Index. ```bash pip install pygeopressure ``` -------------------------------- ### Creating a Simple DataFrame Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Demonstrates the creation of a Pandas DataFrame from a dictionary. Ensure Pandas is installed. ```python import pandas as pd data = { 'Name': ['Alice', 'Bob', 'Charlie'], 'Age': [25, 30, 35], 'City': ['New York', 'Los Angeles', 'Chicago'] } df = pd.DataFrame(data) print(df) ``` -------------------------------- ### Install Bowers Seis Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_seis.ipynb.txt Install the Bowers Seis library using pip. This is the first step before using any of its functionalities. ```bash pip install bowers-seis ``` -------------------------------- ### Basic Plotting with Matplotlib Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Provides a simple example of creating a scatter plot using Matplotlib. Requires 'matplotlib' to be installed. ```python import matplotlib.pyplot as plt plt.scatter(df['x_axis'], df['y_axis']) plt.xlabel('X-axis Label') plt.ylabel('Y-axis Label') plt.title('Scatter Plot Example') plt.show() ``` -------------------------------- ### Log.start Source: https://pygeopressure.readthedocs.io/en/latest/explanation/data_types.html Retrieves the start depth of available property data. ```APIDOC ## Log.start ### Description Returns the start depth of available property data. ### Method Call ``` -------------------------------- ### Basic Data Manipulation (Example) Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_seis.ipynb.txt Provides a simple example of manipulating seismic data, such as scaling. Ensure the data object is suitable for the operation. ```python from bowers_seis.segy import read # Read seismic data data = read("path/to/your/seismic_data.sgy") # Example: Scale the amplitude of all traces by a factor of 2 scaled_data = data * 2 # Save the scaled data write("path/to/your/scaled_data.sgy", scaled_data) ``` -------------------------------- ### Log.start_idx Source: https://pygeopressure.readthedocs.io/en/latest/explanation/data_types.html Retrieves the start index of available property data. ```APIDOC ## Log.start_idx ### Description Returns the start index of available property data. ### Method Call ``` -------------------------------- ### Well Initializer Source: https://pygeopressure.readthedocs.io/en/latest/_modules/pygeopressure/basic/well.html Demonstrates how to initialize a Well object. This is the starting point for working with well data. ```python from pygeopressure.basic.well import Well # Initialize a Well object well = Well(name='Well_A', x=1000, y=2000, z=0, md=0, tvd=0, elevation=0) ``` -------------------------------- ### Calculate Pressure Gradients Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt This example calculates pressure gradients for wells. It requires the well data to be loaded first. ```python from pygeopressure.well import EatonWell well = EatonWell("path/to/your/eaton_well_data.csv") well.calculate_pressure_gradients() print(well.pressure_gradients.head()) ``` -------------------------------- ### Import Warnings and System Path Setup Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Configures warning filters and adjusts the system path to include a parent directory for module imports. This is a common setup step for Python scripts that rely on specific project structures. ```python import warnings warnings.filterwarnings(action='ignore') # for python 2 and 3 compatibility # from builtins import str # try: # from pathlib import Path # except: # from pathlib2 import Path #-------------------------------------------- import sys ppath = "../.." if ppath not in sys.path: sys.path.append(ppath) #-------------------------------------------- ``` -------------------------------- ### Install pyGeoPressure from GitHub Develop Branch Source: https://pygeopressure.readthedocs.io/en/latest/_sources/install.rst.txt Install the latest development version of pyGeoPressure directly from its GitHub repository using pip. ```bash pip install -e git://github.com/whimian/pyGeoPressure.git@develop ``` -------------------------------- ### Pressure Prediction Example Source: https://pygeopressure.readthedocs.io/en/latest/_modules/pygeopressure/basic/well.html Provides an example of how to perform pressure prediction using a Well object. This typically involves using other modules like pygeopressure.pressure. ```python # This is a placeholder. Actual pressure prediction requires # adding relevant log curves (e.g., velocity, density) and then # using specific pressure prediction modules. # Example: # from pygeopressure.pressure import eaton # pore_pressure = eaton.predict(well, n=1.2) print("Pressure prediction functionality is available via other modules.") ``` -------------------------------- ### Eaton Well with Specific Parameters Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt This example initializes EatonWell with specific parameters, demonstrating direct parameter passing during instantiation. ```python from epyt.well import EatonWell well = EatonWell(param1="value1", param2=123) ``` -------------------------------- ### Install pyGeoPressure from GitHub (Editable) Source: https://pygeopressure.readthedocs.io/en/latest/install.html Install the latest development branch of pyGeoPressure directly from its GitHub repository in editable mode. This is useful for developers. ```bash pip install -e git://github.com/whimian/pyGeoPressure.git@develop ``` -------------------------------- ### Basic Data Visualization with Matplotlib Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Demonstrates how to create a basic plot using Matplotlib. Ensure Matplotlib is installed. ```python import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, 10, 100) y = np.sin(x) plt.figure(figsize=(8, 6)) plt.plot(x, y, label='sin(x)') plt.title('Basic Sine Wave Plot') plt.xlabel('X-axis') plt.ylabel('Y-axis') plt.legend() plt.grid(True) plt.show() ``` -------------------------------- ### Load and Prepare Data for Multivariate Analysis Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/multivariate.ipynb.txt This snippet shows how to load a dataset using pandas and prepare it for multivariate analysis by handling missing values and selecting relevant columns. Ensure you have pandas installed (`pip install pandas`). ```python import pandas as pd # Load the dataset df = pd.read_csv('your_dataset.csv') # Handle missing values (e.g., fill with mean) df.fillna(df.mean(), inplace=True) # Select relevant columns for analysis selected_columns = ['col1', 'col2', 'col3'] X = df[selected_columns] ``` -------------------------------- ### Basic NumPy Array Operations Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Illustrates fundamental operations with NumPy arrays. NumPy needs to be installed. ```python import numpy as np arr1 = np.array([1, 2, 3]) arr2 = np.array([4, 5, 6]) print('Array 1:', arr1) print('Array 2:', arr2) # Element-wise addition print('Sum:', arr1 + arr2) # Element-wise multiplication print('Product:', arr1 * arr2) ``` -------------------------------- ### Running a Python Script Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Conceptual example of how to run a Python script from the terminal. Assumes the script is named `script.py`. ```bash python script.py python script.py arg1 arg2 ``` -------------------------------- ### Example of Data Simulation and OLS Regression Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/multivariate.ipynb.txt Demonstrates simulating data and fitting an Ordinary Least Squares (OLS) regression model. This is a fundamental example for understanding regression analysis. ```python np.random.seed(0) X1 = np.random.rand(100) X2 = np.random.rand(100) y = 2 * X1 + 3 * X2 + np.random.randn(100) df_sim = pd.DataFrame({'X1': X1, 'X2': X2, 'y': y}) model_sim = ols('y ~ X1 + X2', data=df_sim).fit() print(model_sim.summary()) ``` -------------------------------- ### Load OBP Well Data Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_well.ipynb.txt Demonstrates how to load well data from OBP. Ensure you have the necessary libraries installed. ```python from pygeopressure.obp import OBP # Load well data well_data = OBP.load_well_data() ``` -------------------------------- ### Get Trace Start Time Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_seis.ipynb.txt Retrieves the start time of a seismic trace. This is typically 0.0 if the data starts at time zero. ```python # Get trace start time trace_start_time = seis.get_trace_start_time() print(f"Trace start time: {trace_start_time} s") ``` -------------------------------- ### Get Start Index of Available Data Source: https://pygeopressure.readthedocs.io/en/latest/_modules/pygeopressure/basic/well_log.html Calculates and returns the starting index of the first valid (non-NaN) property data point. Caches the result. ```python start_index = log.start_idx ``` -------------------------------- ### Creating a NumPy Array with Ones Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Demonstrates creating a NumPy array filled with ones. NumPy must be installed. ```python import numpy as np # Create a 2x3 array of ones ones_array = np.ones((2, 3)) print(ones_array) ``` -------------------------------- ### Basic Data Loading and Preparation Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/multivariate.ipynb.txt Demonstrates how to load a dataset and prepare it for multivariate analysis. Ensure necessary libraries are imported. ```python import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn.preprocessing import StandardScaler from sklearn.decomposition import PCA from sklearn.impute import SimpleImputer from sklearn.pipeline import Pipeline from sklearn.compose import ColumnTransformer from sklearn.manifold import TSNE from sklearn.cluster import KMeans from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import OneHotEncoder from sklearn.model_selection import train_test_split from sklearn.metrics import silhouette_score # Load the dataset df = pd.read_csv('data.csv') # Display the first few rows and basic info print(df.head()) print(df.info()) print(df.describe()) # Handle missing values (example: imputation with mean) # Identify numerical and categorical columns num_cols = df.select_dtypes(include=np.number).columns.tolist() categorical_cols = df.select_dtypes(include='object').columns.tolist() # Create imputation pipelines for numerical and categorical features num_pipeline = Pipeline([ ('imputer', SimpleImputer(strategy='mean')) ]) categorical_pipeline = Pipeline([ ('imputer', SimpleImputer(strategy='most_frequent')), ('onehot', OneHotEncoder(handle_unknown='ignore')) ]) # Use ColumnTransformer to apply different transformations to different columns preprocessor = ColumnTransformer([ ('num', num_pipeline, num_cols), ('cat', categorical_pipeline, categorical_cols) ]) # Apply transformations X = preprocessor.fit_transform(df) # Get feature names after one-hot encoding cat_feature_names = preprocessor.named_transformers_['cat']['onehot'].get_feature_names_out(categorical_cols) feature_names = num_cols + list(cat_feature_names) X_processed = pd.DataFrame(X, columns=feature_names) print("\nProcessed Data Head:") print(X_processed.head()) print("\nProcessed Data Info:") X_processed.info() ``` -------------------------------- ### Get Start Depth of Available Data Source: https://pygeopressure.readthedocs.io/en/latest/_modules/pygeopressure/basic/well_log.html Calculates and returns the starting depth where valid (non-NaN) property data is available. Caches the result for efficiency. ```python start_depth = log.start ``` -------------------------------- ### Generating Random Numbers with NumPy Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Shows how to generate random numbers using NumPy. NumPy must be installed. ```python import numpy as np # Generate a random number between 0 and 1 random_num = np.random.rand() print('Random number:', random_num) # Generate a random integer between 1 and 10 (inclusive) random_int = np.random.randint(1, 11) print('Random integer:', random_int) ``` -------------------------------- ### Perform Factor Analysis Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/multivariate.ipynb.txt Conducts factor analysis to identify underlying latent factors. This example uses the 'factor_analyzer' library. Ensure it is installed (`pip install factor_analyzer`). ```python import pandas as pd from factor_analyzer import FactorAnalyzer df = pd.read_csv("data.csv") # Initialize FactorAnalyzer fa = FactorAnalyzer(n_factors=2, rotation='varimax') # Fit the model fa.fit(df) # Get the factor loadings loadings = fa.loadings_ print(loadings) # Get the variance explained by each factor variance_explained = fa.get_factor_variance() print(f"Variance explained: {variance_explained}") ``` -------------------------------- ### Basic File Reading Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Shows how to read the content of a text file line by line. The file 'example.txt' must exist. ```python try: with open('example.txt', 'r') as f: for line in f: print(line.strip()) except FileNotFoundError: print('Error: example.txt not found.') ``` -------------------------------- ### Data Manipulation with Pandas Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Illustrates basic data manipulation using Pandas DataFrames. Pandas must be installed. ```python import pandas as pd data = {'col1': [1, 2, 3, 4], 'col2': [4, 3, 2, 1]} df = pd.DataFrame(data) print('Original DataFrame:') print(df) print('\nDataFrame after adding a new column:') df['col3'] = df['col1'] * 2 print(df) ``` -------------------------------- ### Get Trace Information Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_seis.ipynb.txt Retrieves information about individual seismic traces, such as their start time and sample interval. ```python from pygeopressure.seismic import Seismic seismic_data = Seismic.load("path/to/your/seismic_data.segy") trace_info = seismic_data.get_trace_info(0) # Get info for the first trace print(trace_info) ``` -------------------------------- ### Set Simulation Parameters Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt This example illustrates how to set specific parameters for the simulation. These parameters control various aspects of the simulation's behavior and output. ```python from pygeopressure.well import EatonWell # Initialize the EatonWell object well = EatonWell() # Set simulation parameters well.set_params(params=dict(a=1, b=2, c=3)) ``` -------------------------------- ### Basic Git Commit Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Conceptual example of adding changes and committing them in Git. These commands are run in the terminal. ```bash git add . git commit -m "Your commit message here" ``` -------------------------------- ### Creating a NumPy Array with Zeros Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Demonstrates creating a NumPy array filled with zeros. NumPy must be installed. ```python import numpy as np # Create a 3x4 array of zeros zeros_array = np.zeros((3, 4)) print(zeros_array) ``` -------------------------------- ### Basic Plotting of Seismic Data Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_seis.ipynb.txt Provides a simple example of plotting the seismic data. This requires matplotlib to be installed. ```python import matplotlib.pyplot as plt data.plot() ``` -------------------------------- ### Eaton Well Configuration Example Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt Shows how to configure the EatonWell object with specific parameters. Configuration should be done before loading or processing data. ```python from epyt.well import EatonWell config = { "param1": "value1", "param2": 123 } well = EatonWell(config=config) ``` -------------------------------- ### Example: Basic Seismic Inversion Workflow Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_seis.ipynb.txt A complete workflow demonstrating the basic steps of seismic inversion using Bowers Seis, from loading data to saving results. ```python import numpy as np import pandas as pd from bowers_seis import SeismicData, seismic_inversion df = pd.read_csv('seismic_data.csv') seismic_data = SeismicData(df) result = seismic_inversion(seismic_data) print(result) result.to_csv('inversion_results.csv') ``` -------------------------------- ### Get Trace End Time Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_seis.ipynb.txt Calculates the end time of a seismic trace. This is the start time plus the trace length. ```python # Get trace end time trace_end_time = seis.get_trace_end_time() print(f"Trace end time: {trace_end_time} s") ``` -------------------------------- ### Log.from_scratch Source: https://pygeopressure.readthedocs.io/en/latest/explanation/data_types.html Alternative initializer for creating a Log object from scratch with depth and data. ```APIDOC ## Log.from_scratch ### Description Alternative initializer to create a Log object from scratch. ### Method Call ### Parameters * **depth** - Depth data. * **data** - Property data. * **name** (optional) - Log name. * **units** (optional) - Log units. * **descr** (optional) - Log description. * **prop_type** (optional) - Property type. ``` -------------------------------- ### Get Default Parameters Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt This snippet shows how to retrieve the default parameters used by the EatonWell simulation. These defaults can be a starting point for customization. ```python from pygeopressure.well import EatonWell # Initialize the EatonWell object well = EatonWell() # Get default parameters default_params = well.get_params() ``` -------------------------------- ### Applying Boundary Conditions Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_seis.ipynb.txt Demonstrates how to implement absorbing boundary conditions to prevent wave reflections in a simulation. This is crucial for realistic modeling. ```python # Inside the time-stepping loop, after updating u: # Absorbing boundary conditions (simple example) u[0] = u[1] u[-1] = u[-2] # More sophisticated absorbing boundary conditions (e.g., PML) would be implemented here. ``` -------------------------------- ### Initialize and Configure Eaton Well Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt Demonstrates basic initialization and configuration of the Eaton Well object. This is a starting point for most operations. ```python from pygeopressure.well import EatonWell # Initialize with default parameters eaton_well = EatonWell() # Initialize with custom parameters (example) eaton_well_custom = EatonWell(pressure_unit='Pa', depth_unit='m') ``` -------------------------------- ### Initialize Eaton Seis with Custom Parameters Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_seis.ipynb.txt Demonstrates initializing Eaton Seis with specific parameters for custom behavior. Adjust these values based on your data and analysis needs. ```python from pygeopressure.seis import EatonSeis # Initialize EatonSeis with custom parameters seis = EatonSeis(n=100, m=100, k=10, l=10, p=10, q=10, r=10, s=10, t=10, u=10, v=10, w=10, x=10, y=10, z=10, a=10, b=10, c=10, d=10, e=10, f=10, g=10, h=10, i=10, j=10, o=10, alpha=10, beta=10, gamma=10, delta=10, epsilon=10, zeta=10, eta=10, theta=10, iota=10, kappa=10, lambda_=10, mu=10, nu=10, xi=10, omicron=10, pi=10, rho=10, sigma=10, tau=10, upsilon=10, phi=10, chi=10, psi=10, omega=10, n_jobs=1, verbose=1) ``` -------------------------------- ### Creating a Seismic Dataset Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_seis.ipynb.txt Demonstrates how to create a new seismic dataset from scratch using `bowers_seis.create_dataset`. This is useful for generating synthetic data or preparing data for writing. ```python from bowers_seis import create_dataset import numpy as np # Example: Create a dataset with 10 traces, each with 100 samples num_traces = 10 samples_per_trace = 100 data = create_dataset(num_traces, samples_per_trace) # Fill with some synthetic data (e.g., random noise) data.traces = np.random.rand(num_traces, samples_per_trace) ``` -------------------------------- ### Basic Data Loading and Processing Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Demonstrates loading and initial processing of data. This snippet is useful for setting up the data pipeline. ```python from pygeopressure.well import Well # Load well data from a file well = Well.from_file("path/to/your/well_data.csv") # Perform basic data processing well.process_data() ``` -------------------------------- ### Basic Data Loading and Display Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Demonstrates how to load data from a CSV file and display the first few rows. Ensure the 'pandas' library is installed. ```python import pandas as pd df = pd.read_csv("data.csv") print(df.head()) ``` -------------------------------- ### Advanced Filtering Example Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_seis.ipynb.txt An example of applying a more advanced filtering technique, such as a median filter, to seismic data. Ensure correct parameters are used. ```python from obp_seis.seis import Seis from obp_seis.processing import median_filter seis_data = Seis.load("path/to/your/seismic_data.segy") # Apply a median filter median_filtered_data = median_filter(seis_data, window_size=5) ``` -------------------------------- ### Getting Trace Statistics Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_seis.ipynb.txt Demonstrates how to retrieve basic statistics for a seismic trace, such as the number of points and sampling rate. ```python stats = data[0].stats print(stats) ``` -------------------------------- ### Initialize Log from Scratch Source: https://pygeopressure.readthedocs.io/en/latest/_modules/pygeopressure/basic/well_log.html Creates a new Log object with specified depth and data arrays. Useful for manually constructing log data. ```python log = cls.from_scratch(depth, data, name=None, units=None, descr=None, prop_type=None) ``` -------------------------------- ### Creating a Simple Class Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Illustrates how to define and instantiate a simple class in Python. This is a standard Python feature. ```python class Dog: def __init__(self, name): self.name = name def bark(self): return f'{self.name} says Woof!' my_dog = Dog('Buddy') print(my_dog.bark()) ``` -------------------------------- ### Get Data Info Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_seis.ipynb.txt Shows how to get information about the seismic data, such as the number of samples, sample rate, and data type, using the `info` method. ```python import obp_seis # Load seismic data data = obp_seis.load("path/to/your/seismic_data.segy") # Get data information data.info() ``` -------------------------------- ### Setup Development Environment with Conda (Test Env 3) Source: https://pygeopressure.readthedocs.io/en/latest/_sources/install.rst.txt Create a conda development environment using the 'test_env_3.yml' file. ```bash conda env create --file test/test_env_3.yml ``` -------------------------------- ### Log.__init__ Source: https://pygeopressure.readthedocs.io/en/latest/explanation/data_types.html Initializes a Log object with a file name and log name. ```APIDOC ## Log.__init__ ### Description Initializes a Log object. ### Method Call ### Parameters * **file_name** (str) - Pseudo LAS file path. * **log_name** (str) - Log name to create. ``` -------------------------------- ### Get Data Description Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_seis.ipynb.txt Illustrates how to get descriptive statistics of the seismic data, such as count, mean, std, min, max, and quartiles, using the `describe` method. ```python import obp_seis # Load seismic data data = obp_seis.load("path/to/your/seismic_data.segy") # Get data description descriptive_stats = data.describe() # Display the descriptive statistics print(descriptive_stats) ``` -------------------------------- ### Get Lithostatic Pressure Source: https://pygeopressure.readthedocs.io/en/latest/_modules/pygeopressure/basic/well.html Property to retrieve the lithostatic (overburden) pressure. It attempts to get the 'Overburden_Pressure' log and returns its data. Handles KeyError if the log is not found. ```python try: temp_log = self.get_log('Overburden_Pressure') return np.array(temp_log.data) except KeyError: print("No 'Overburden_Pressure' log found.") ``` -------------------------------- ### Load and Prepare Data for Multivariate Analysis Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/multivariate.ipynb.txt Demonstrates loading a dataset and performing initial data preparation steps, such as handling missing values and scaling features. Ensure your data is clean and appropriately formatted before proceeding with multivariate analysis. ```python import pandas as pd from sklearn.preprocessing import StandardScaler # Load the dataset df = pd.read_csv('your_dataset.csv') # Handle missing values (e.g., fill with mean) df.fillna(df.mean(), inplace=True) # Scale numerical features scaler = StandardScaler() numerical_cols = df.select_dtypes(include=['float64', 'int64']).columns df[numerical_cols] = scaler.fit_transform(df[numerical_cols]) print(df.head()) ``` -------------------------------- ### Generating Sample Data for Multivariate Analysis (Specific Example) Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/multivariate.ipynb.txt Creates a specific sample dataset for demonstrating multivariate analysis techniques. This includes generating random data and defining a binary target variable. ```python np.random.seed(1) X_specific = np.random.rand(50, 3) * 5 y_specific = (X_specific[:, 0] + X_specific[:, 1] > 5).astype(int) ``` -------------------------------- ### Basic Plotting with Matplotlib Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_seis.ipynb.txt Shows how to create a basic plot of seismic data using Matplotlib. Requires Matplotlib to be installed. ```python import matplotlib.pyplot as plt plt.plot(df["time"], df["amplitude"]) plt.xlabel("Time (s)") plt.ylabel("Amplitude") plt.title("Seismic Waveform") plt.show() ``` -------------------------------- ### Setup Development Environment with Conda (Test Env 2) Source: https://pygeopressure.readthedocs.io/en/latest/_sources/install.rst.txt Create a conda development environment using the 'test_env_2.yml' file. ```bash conda env create --file test/test_env_2.yml ``` -------------------------------- ### Multivariate Plotting Setup Source: https://pygeopressure.readthedocs.io/en/latest/_modules/pygeopressure/basic/plots.html Initializes axes and plots velocity, porosity, and shale volume logs against depth. Sets axis labels and limits for the velocity plot. ```python axes[0].plot(np.array(vel_log.data)/1000, vel_log.depth, linewidth=0.5, color='gray') axes[0].set(xlabel='Vp (km/s)', ylabel='Depth (m)', ylim=[lower, upper]) axes[1].plot(por_log.data, por_log.depth, linewidth=0.5, color='gray') axes[1].set(xlabel='$\phi$') axes[2].plot(vsh_log.data, vsh_log.depth, linewidth=0.5, color='gray') axes[2].set(xlabel='$V_{sh}$') depth = well.depth hydrostatic = well.hydrostatic obp = well.lithostatic ``` -------------------------------- ### Get Well Metadata Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_well.ipynb.txt Retrieves metadata associated with the OBP Well. ```python metadata = well.get_well_metadata() ``` -------------------------------- ### Get Trace Headers Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_seis.ipynb.txt Retrieves the header information for each seismic trace. ```python trace_headers = seismic_data.get_trace_headers() ``` -------------------------------- ### Get Well Status Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_well.ipynb.txt Retrieves the current status of the well. Useful for monitoring. ```python status = well.get_well_status() ``` -------------------------------- ### K-Means Clustering Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/multivariate.ipynb.txt Demonstrates the implementation of K-Means clustering algorithm. Ensure data is scaled appropriately before applying. ```python from sklearn.cluster import KMeans # Assuming 'data_scaled' is your preprocessed data k = 3 # Number of clusters kmeans = KMeans(n_clusters=k, random_state=0, n_init=10) kmeans.fit(data_scaled) labels = kmeans.labels_ centroids = kmeans.cluster_centers_ ``` -------------------------------- ### Get Well Depth Data Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_well.ipynb.txt Retrieves and prints the depth data for the well. ```python print(well.depth_data) ``` -------------------------------- ### Get Well Properties Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_well.ipynb.txt Retrieves a list of available properties for the OBP Well. ```python properties = well.get_well_properties() ``` -------------------------------- ### Save Simulation Results Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt This example shows how to save the simulation results to a file. Saving results allows for later retrieval and analysis without re-running the simulation. ```python from pygeopressure.well import EatonWell # Initialize the EatonWell object well = EatonWell() # Run the simulation well.run() # Save the results well.save("path/to/save/results.csv") ``` -------------------------------- ### Applying a Velocity Model Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_seis.ipynb.txt Demonstrates how to apply a velocity model for tasks like migration or velocity analysis. This requires a velocity model file. ```python from obp_seis.seis import Seis from obp_seis.processing import apply_velocity_model seis_data = Seis.load("path/to/your/seismic_data.segy") velocity_model = Seis.load_velocity_model("path/to/your/velocity_model.csv") # Apply the velocity model processed_data = apply_velocity_model(seis_data, velocity_model) ``` -------------------------------- ### Get Velocity Log Source: https://pygeopressure.readthedocs.io/en/latest/tutorial/bowers_well.html Extracts the 'Velocity' log data from the specified well. ```python vel_log = well_cug1.get_log("Velocity") ``` -------------------------------- ### Load Configuration Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_well.ipynb.txt Loads configuration settings for the OBP Well. This is essential for customizing behavior. ```python well.load_config(config_path) ``` -------------------------------- ### Get Bowers Coefficients Source: https://pygeopressure.readthedocs.io/en/latest/tutorial/bowers_seis.html Extracts the Bowers coefficients 'A' and 'B' for the specified well. ```python a = well_cug1.params['bowers']["A"] b = well_cug1.params['bowers']['B'] ``` -------------------------------- ### Plot a Seismic Trace Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_seis.ipynb.txt Plots the extracted seismic trace. Requires matplotlib to be installed. ```python trace.plot() ``` -------------------------------- ### Create a Dummy Trace Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_seis.ipynb.txt Creates a dummy seismic trace for testing or demonstration purposes. This is useful when you don't have actual data available. ```python from obspy.core.trace import Trace from obspy.core.util import AttribDict import numpy as np # Create a dummy trace trace_data = np.require(np.arange(1000), dtype=np.int32) trace = Trace(data=trace_data) trace.stats.station = "TESTST" trace.stats.channel = "BHZ" trace.stats.npts = 1000 trace.stats.sampling_rate = 100 trace.stats.delta = 1.0 / trace.stats.sampling_rate trace.stats.mseed = AttribDict() trace.stats.mseed.dataquality = "BEST" trace.stats.mseed.encoding = "INT32" trace.stats.mseed.byteorder = "BIG" ``` -------------------------------- ### Get Well Data Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_well.ipynb.txt Retrieves all data stored within the OBP Well object. ```python well_data = well.get_well_data() ``` -------------------------------- ### Eaton Well Initialization with Configuration Dictionary Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt Shows initializing EatonWell using a configuration dictionary. This is useful for managing complex configurations. ```python from epyt.well import EatonWell config = { "param1": "value1", "param2": 123, "flag": True } well = EatonWell(config=config) ``` -------------------------------- ### Getting Custom Parameters Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_well.ipynb.txt Retrieves the currently set custom parameters for the OBPWell object. ```python params = well.get_params() ``` -------------------------------- ### Initialize Eaton Well with Custom Parameters Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt Demonstrates initializing an Eaton Well instance with specific geological and fluid parameters. Use this when you have predefined values for your simulation. ```python from pygeopressure.well import EatonWell params = { "phi": 0.2, "rhob": 2.5, "rhoc": 2.7, "mu": 0.02, "cp": 1e-9, "rhof": 1.0, "mu_f": 0.001, "cp_f": 1e-9, } well = EatonWell(params=params) print(well.params) ``` -------------------------------- ### Get Bottom Depth of Log Source: https://pygeopressure.readthedocs.io/en/latest/_modules/pygeopressure/basic/well_log.html Returns the depth of the last data point in the log. ```python bottom_depth = log.bottom ``` -------------------------------- ### Get Top Depth of Log Source: https://pygeopressure.readthedocs.io/en/latest/_modules/pygeopressure/basic/well_log.html Returns the depth of the first data point in the log. ```python top_depth = log.top ``` -------------------------------- ### Plot Well Curves Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_well.ipynb.txt Generates a plot of specified well curves. This requires matplotlib to be installed. ```python import matplotlib.pyplot as plt well.plot(['GR', 'RHOB']) plt.show() ``` -------------------------------- ### Plot Well Data Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Plots the specified curves for the well. This function requires matplotlib to be installed. ```python well.plot(["GR", "DEN", "NPHI"]) ``` -------------------------------- ### Import Libraries and Configure Environment Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/multivariate.ipynb.txt Imports necessary libraries and configures the Python environment for pygeopressure. Includes warnings filter and path setup. ```python import warnings warnings.filterwarnings(action='ignore') # for python 2 and 3 compatibility # from builtins import str # try: # from pathlib import Path # except: # from pathlib2 import Path #-------------------------------------------- import sys ppath = "../.." if ppath not in sys.path: sys.path.append(ppath) #-------------------------------------------- ``` -------------------------------- ### Get Trace Information Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_seis.ipynb.txt Retrieves specific trace information, such as header values or data samples. ```python # Get the first trace first_trace = seismic_data.get_trace(0) # Get header information for the first trace header_info = first_trace.header # Get the data samples for the first trace data_samples = first_trace.data ``` -------------------------------- ### Initialize and Run Simulation Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt This snippet demonstrates how to initialize and run a simulation using the Eaton Well project. It sets up the necessary parameters and executes the simulation process. ```python from pygeopressure.well import EatonWell # Initialize the EatonWell object well = EatonWell() # Run the simulation well.run() ``` -------------------------------- ### Get Geometry Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_seis.ipynb.txt Retrieves the geometry information for the seismic survey, including source and receiver locations. ```python geometry = seismic_data.get_geometry() ``` -------------------------------- ### Loading Data from Different Sources Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Shows how to load well data from various file formats. Ensure your data is in a compatible format before loading. ```python from pygeopressure.well import Well # Load data from a different file type (e.g., LAS) well_las = Well.from_las("path/to/your/well_data.las") # Load data from a dictionary well_dict = Well.from_dict(your_data_dictionary) ``` -------------------------------- ### Process Seismic Data (Example) Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_seis.ipynb.txt Applies a basic processing step to seismic data. This is a placeholder and should be replaced with specific processing functions. ```python from obp_seis.processing import Process # Assuming 'data' is loaded seismic data processor = Process(data) processed_data = processor.apply_filter("bandpass", freq_low=10, freq_high=50) ``` -------------------------------- ### Get Survey Headers Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_seis.ipynb.txt Retrieves the survey headers, which contain metadata for the entire seismic survey. ```python survey_headers = seismic_data.get_survey_headers() ``` -------------------------------- ### Get Well Information Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_well.ipynb.txt Retrieves and prints basic information about the loaded well, such as its name and depth. ```python print(well.name) print(well.depth) ``` -------------------------------- ### Load Data from File Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt This code shows how to load simulation data from a specified file. Ensure the file path is correct and the file format is compatible with the project's data loading mechanism. ```python from pygeopressure.well import EatonWell # Initialize the EatonWell object well = EatonWell() # Load data from a file well.load("path/to/your/data.csv") ``` -------------------------------- ### Get All Headers Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_seis.ipynb.txt Fetches all header information for all traces in the seismic data. This can be memory-intensive for large datasets. ```python # Get all headers all_headers = seis.get_all_headers() print(len(all_headers)) ``` -------------------------------- ### Eaton Well Data Loading with Configuration Dictionary Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt Demonstrates loading data into EatonWell using a configuration dictionary. This allows for consistent configuration across different operations. ```python from epyt.well import EatonWell config = { "param_load": "value_load", "flag_load": True } well = EatonWell() well.load_data(data, config=config) ``` -------------------------------- ### Getting the Shape of a DataFrame Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Demonstrates how to retrieve the dimensions (number of rows and columns) of a DataFrame as a tuple. ```python rows, columns = df.shape print(f'DataFrame shape: {rows} rows, {columns} columns') ``` -------------------------------- ### Visualize Seismic Data Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_seis.ipynb.txt Visualizes seismic data using a plotting function. Requires matplotlib to be installed. ```python from obp_seis.plotting import plot_seismic # Assuming 'data' is loaded seismic data plot_seismic(data) ``` -------------------------------- ### Initialize and Load Well Data Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt This snippet shows how to create a Well object and load data from a specified path. Ensure the data file exists at the given location. ```python from pygeopressure.well import Well well = Well.from_file("/websites/pygeopressure_readthedocs_io_en/source/tutorial/eaton_well.ipynb.md") ``` -------------------------------- ### Initialize SurveySetting Source: https://pygeopressure.readthedocs.io/en/latest/_modules/pygeopressure/basic/survey_setting.html Instantiates the SurveySetting class with three reference points to define the survey grid. This process automatically computes basic survey properties and coordinate conversion parameters. ```python from pygeopressure.basic.survey_setting import SurveySetting # Assuming 'threepoints' is an object with the necessary attributes # like startInline, endInline, stepInline, etc. # survey_setting = SurveySetting(threepoints) ``` -------------------------------- ### Data Visualization - Pressure Over Time Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt Creates a line plot of pressure over time. Requires matplotlib to be installed. ```python import matplotlib.pyplot as plt plt.figure(figsize=(12, 6)) plt.plot(filtered_df['date'], filtered_df['pressure']) plt.title('Pressure Over Time') plt.xlabel('Date') plt.ylabel('Pressure') plt.grid(True) plt.show() ``` -------------------------------- ### Plotting Well Log Data Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt Generates a plot of 'GR' and 'NPHI' against depth. Ensure matplotlib is installed. ```python import matplotlib.pyplot as plt plt.figure(figsize=(8, 12)) plt.plot(df['GR'], df.index, label='GR') plt.plot(df['NPHI'], df.index, label='NPHI') plt.gca().invert_yaxis() plt.legend() plt.show() ``` -------------------------------- ### Calculate Pressure using Gateway Method Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt This example calculates pore pressure using the Gateway method. This method might be preferred in specific geological settings or when certain data is available. ```python from pygeopressure.well import EatonWell well = EatonWell() pressure = well.gateway() print(pressure) ``` -------------------------------- ### Apply Thresholding (Simple) Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_seis.ipynb.txt Shows how to apply simple thresholding to the seismic data. Pixels above or below a threshold are set to a specific value. ```python threshold_value = 0.5 seis_thresholded = seis.thresholding(threshold_value=threshold_value) ``` -------------------------------- ### Perform Seismic Data Analysis Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_seis.ipynb.txt This example demonstrates performing a specific analysis on the seismic data. Replace `analyze` with the actual analysis method you intend to use. ```python from pygeopressure.seis import EatonSeis seis = EatonSeis() seis.load("path/to/your/seismic/data.segy") seis.process() # Perform analysis (replace with actual analysis method) results = seis.analyze() ``` -------------------------------- ### Advanced Filtering Example Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_seis.ipynb.txt Demonstrates a more advanced filtering technique, such as a median filter. This can help remove noise. ```python import seis data = seis.load("path/to/your/seismic_data.segy") # Apply a median filter data = seis.median_filter(data, size=5) ``` -------------------------------- ### OBP Well Initialization Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_well.ipynb.txt Initializes the OBP Well with specific parameters. Ensure necessary libraries are imported. ```python from pygeopressure.well import OBPWell well = OBPWell(path="/path/to/your/well/data") ``` -------------------------------- ### Save Seismic Data Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_seis.ipynb.txt Shows how to save processed seismic data to a file, for example, in SEG-Y format. ```python seis.save("processed_seismic_data.segy") ``` -------------------------------- ### Filtering Seismic Data Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_seis.ipynb.txt An example of applying a low-pass filter to seismic data. This requires the SciPy library. ```python from scipy.signal import butter, filtfilt def butter_lowpass(cutoff, fs, order=5): nyq = 0.5 * fs normal_cutoff = cutoff / nyq b, a = butter(order, normal_cutoff, btype='low', analog=False) return b, a def lowpass_filter(data, cutoff, fs, order=5): b, a = butter_lowpass(cutoff, fs, order=order) y = filtfilt(b, a, data) return y fs = 100.0 # Sample rate cutoff = 10.0 # Cutoff frequency filtered_data = lowpass_filter(df["amplitude"], cutoff, fs) plt.plot(df["time"], filtered_data) plt.xlabel("Time (s)") plt.ylabel("Filtered Amplitude") plt.title("Low-pass Filtered Seismic Waveform") plt.show() ``` -------------------------------- ### Eaton Well Initialization with Multiple Parameters Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt Shows initializing EatonWell with multiple configuration parameters. This allows for fine-tuning the library's behavior from the start. ```python from epyt.well import EatonWell well = EatonWell(param1="value1", param2=123, flag=True) ``` -------------------------------- ### Get Sample Interval Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_seis.ipynb.txt Returns the sample interval (in seconds) of the seismic data. This is the inverse of the sample rate. ```python # Get sample interval sample_interval = seis.get_sample_interval() print(f"Sample interval: {sample_interval} s") ``` -------------------------------- ### Basic Data Visualization Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/multivariate.ipynb.txt Demonstrates how to create basic plots for visualizing multivariate data. Ensure necessary libraries are imported. ```python import matplotlib.pyplot as plt import numpy as np # Sample data x = np.random.rand(50) y = np.random.rand(50) colors = np.random.rand(50) areas = 500 * np.random.rand(50) plt.scatter(x, y, s=areas, c=colors, alpha=0.5) plt.xlabel("X-axis") plt.ylabel("Y-axis") plt.title("Scatter Plot of Random Data") plt.show() ``` -------------------------------- ### Get Header by Inline and Crossline Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_seis.ipynb.txt Retrieves the header information for a trace specified by its inline and crossline coordinates. ```python # Get header by inline and crossline header_by_coords = seis.get_header_by_inline_crossline(inline=100, crossline=50) print(header_by_coords) ``` -------------------------------- ### Get Trace Shape Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_seis.ipynb.txt Determines the shape of an individual seismic trace. This indicates the number of samples in the trace. ```python print(f"Shape of trace {trace_index}: {selected_trace.shape}") ``` -------------------------------- ### Event Detection Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_seis.ipynb.txt Shows a basic example of event detection using the `trigger` method. This is a simplified approach and may require tuning. ```python from seis import read data = read("path/to/your/seismic/data.sac") # Detect events using the trigger method events = data.trigger(threshold=3, window=10) print(events) ``` -------------------------------- ### Get Well Summary Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Generates and prints a summary of the well data, including basic statistics for each curve. ```python print(well.summary()) ``` -------------------------------- ### Survey Folder Structure Example Source: https://pygeopressure.readthedocs.io/en/latest/_sources/howtos/survey.rst.txt Illustrates the standard directory structure for a pyGeoPressure survey, including sub-folders for Seismics, Surfaces, and Wellinfo, along with the root .survey definition file. ```text +---EXAMPLE_SURVEY | .survey | | | +---Seismics | | velocity.seis | | density.seis | | pressure.seis | | | +---Surfaces | | T20.hor | | T16.hor | | | \---Wellinfo | .CUG1 | .CUG2 | well_data.h5 | ``` -------------------------------- ### Get Curve Data Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Retrieves and prints the data for a specific curve (e.g., 'GR') from the Well object. ```python print(well.get_curve("GR")) ``` -------------------------------- ### Get Measured Depth Data Source: https://pygeopressure.readthedocs.io/en/latest/_modules/pygeopressure/basic/well.html Demonstrates how to retrieve data associated with measured depth from a Well object. ```python # Assuming 'GR' log curve has been added md_data = well.get_md_data('GR') print(f"Retrieved {len(md_data)} data points for GR at measured depth.") ``` -------------------------------- ### Create Development Environment (Python 2.7) Source: https://pygeopressure.readthedocs.io/en/latest/install.html Set up a development environment for pyGeoPressure using a conda environment file for Python 2.7. This ensures all necessary dependencies for testing are installed. ```bash conda env create --file test/test_env_2.yml ``` -------------------------------- ### Get Well Data Source: https://pygeopressure.readthedocs.io/en/latest/_modules/pygeopressure/basic/well_storage.html Retrieves the data for a specific well by its name. Raises a KeyError if the well is not found. ```python well_data = storage.get_well_data('well_name_1') ``` -------------------------------- ### Loading Pressure-Volume Data Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_well.ipynb.txt Demonstrates how to load pressure-volume data from a CSV file using the `load_pv_data` utility function. This is a crucial first step for any analysis. ```python pv_data = load_pv_data("path/to/your/pv_data.csv") print(pv_data.head()) ``` -------------------------------- ### Initialize Bowers Seis Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/bowers_seis.ipynb.txt Initializes the Bowers Seis object. No specific setup or imports are mentioned as required. ```python from pygeopressure.bowers_seis import BowersSeis bowers = BowersSeis() ``` -------------------------------- ### Apply Morphological Operations (Opening) Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_seis.ipynb.txt Demonstrates applying morphological opening to the seismic data. Opening is erosion followed by dilation, used to remove small objects. ```python nseis_opened = seis.morphological_opening() ``` -------------------------------- ### Fetch Eaton Well Data Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/eaton_well.ipynb.txt Retrieves historical data from the Eaton Well. Ensure you have the necessary libraries installed. ```python from pygeopressure.well import EatonWell well = EatonWell("Eaton_Well_1") data = well.fetch_data() data.head() ``` -------------------------------- ### Basic Data Visualization Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_seis.ipynb.txt Shows how to create a basic visualization of the loaded seismic data. This is useful for initial data inspection. ```python import obp_seis import matplotlib.pyplot as plt # Assuming seismic_data is already loaded (e.g., from the previous step) # seismic_data = obp_seis.load_seismic('path/to/your/seismic_data.segy') # Plot the seismic data plt.figure(figsize=(10, 6)) plt.imshow(seismic_data, aspect='auto', cmap='seismic') plt.title('Seismic Data Visualization') plt.xlabel('Trace Number') plt.ylabel('Sample Number') plt.colorbar(label='Amplitude') plt.show() ``` -------------------------------- ### Fetch OBP Well Data Source: https://pygeopressure.readthedocs.io/en/latest/_sources/tutorial/obp_well.ipynb.txt Retrieves well data from the OBP API. Ensure you have the 'requests' library installed. ```python import requests url = "https://api.openbusinesspressure.org/wells/" params = { "format": "json", "limit": 1000 } response = requests.get(url, params=params) wells_data = response.json() print(f"Retrieved {len(wells_data)} wells.") ```