This five-day course introduces Python programming and develops practical skills for working with scientific and geophysical datasets. Participants progress from programming fundamentals to importing, cleaning, processing, analyzing, visualizing, and exporting data using NumPy, Pandas, Matplotlib, and selected SciPy tools.
The course also covers file handling, package and environment management, debugging, interpreting error messages, understanding unfamiliar code, and using Python documentation. Exercises use scientific or geophysical datasets, such as seismic event catalogs, station observations, and sampled sensor signals. A final capstone project brings these skills together in a complete, reproducible data analysis workflow.
The scope develops beginner-to-intermediate skills for common scientific analysis tasks. Advanced geophysical modeling and specialized seismic processing are outside this introductory course.
Duration 5 Days – 35 hrs.
Objectives
- Write Python programs using variables, data types, collections, conditions, loops, and functions.
- Set up a Python working environment and install, manage, and record required packages.
- Import and export scientific data using common text, CSV, JSON, and NumPy file formats.
- Identify and address missing values, duplicates, inconsistent data types, and questionable observations.
- Use NumPy arrays to perform efficient numerical calculations.
- Use Pandas to organize, combine, summarize, and analyze scientific datasets.
- Create clearly labeled scientific plots using Matplotlib.
- Apply selected SciPy tools for interpolation, curve fitting, and basic signal processing.
- Interpret common Python errors and debug data analysis code.
- Read unfamiliar Python scripts and trace how data moves through an analysis.
- Use official Python and library documentation to understand functions, parameters, and examples.
- Complete and document a scientific or geophysical workflow from raw data to exported results.
Target Audience
- Geophysicists, geologists, and other geoscience professionals.
- Scientists and researchers who work with observational or experimental data.
- Engineers and technical personnel who analyze sensor or instrument measurements.
- Data analysts transitioning from spreadsheets to Python.
- Students and research assistants in scientific and engineering disciplines.
- Beginners seeking a practical foundation in scientific Python.
Prerequisites
- Basic computer skills, including managing files and folders.
- Familiarity with spreadsheets and tabular datasets.
- Basic understanding of algebra, descriptive statistics, and scientific measurements.
- Awareness of units, timestamps, and sampling intervals.
- General familiarity with scientific or geophysical data is helpful but not required.
- No prior Python programming experience is required.
- Access to a computer with Python, JupyterLab, and the required scientific libraries installed, or permission to install the supplied course environment.
Course Outline
Day 1: Python Foundations and the Scientific Working Environment
Module 1: Python Setup, Environments, and Documentation
- Python’s role in scientific and geophysical analysis.
- Working with Jupyter notebooks and Python scripts.
- Creating and activating a virtual environment.
- Installing packages with pip and recording dependencies.
- Understanding the relationship between environments, interpreters, and notebook kernels.
- Finding official documentation and using help() to explore functions.
Module 2: Core Python Programming
- Variables, numbers, strings, Boolean values, and type conversion.
- Arithmetic, comparison, and logical operations.
- Lists, tuples, dictionaries, and sets.
- Indexing, slicing, and basic collection operations.
- Conditional statements and loops.
- Writing reusable functions with parameters and return values.
Module 3: Files, Errors, and Reading Code
- Managing file paths with pathlib.
- Reading and writing text files safely.
- Understanding syntax errors, runtime errors, and incorrect results.
- Reading tracebacks and locating the source of an error.
- Tracing an unfamiliar script through inputs, operations, and outputs.
- Writing meaningful names, comments, and function descriptions.
Practical Exercise: Scientific Measurement Summary
- Read a supplied text file containing station measurements.
- Convert values to numeric types and apply a unit conversion.
- Use functions and loops to calculate summary values.
- Diagnose a supplied faulty script and export a corrected summary.
Day 2: Numerical Computing with NumPy
Module 4: NumPy Arrays and Numerical Operations
- Creating arrays and understanding shape, dimensions, and data types.
- Indexing, slicing, reshaping, and Boolean masking.
- Vectorized calculations and broadcasting.
- Computing statistics along array axes.
- Recognizing missing and nonfinite values.
Module 5: Processing Scientific Measurements
- Applying calibration factors and unit conversions.
- Calculating anomalies, differences, and normalized values.
- Understanding sampling intervals and constructing time arrays.
- Performing basic numerical integration.
- Preserving the relationship between measurements, coordinates, and units.
Module 6: Numerical Files and Debugging Array Operations
- Loading and saving numerical text and CSV data.
- Storing arrays in NumPy formats.
- Interpreting shape mismatch, indexing, and data type errors.
- Checking intermediate results and identifying unintended broadcasting.
- Using documentation to confirm function behavior.
Practical Exercise: Geophysical Sensor Data Processing
- Import a sampled sensor dataset with supplied calibration information.
- Identify invalid values and convert raw readings into physical units.
- Calculate baseline statistics and measurement anomalies.
- Export processed measurements and a numerical summary.
Day 3: Data Cleaning and Analysis with Pandas
Module 7: Working with Scientific Tables
- Understanding Series and DataFrames.
- Importing CSV and JSON records.
- Inspecting columns, data types, and dataset structure.
- Selecting, filtering, sorting, and creating columns.
- Parsing dates and handling timestamps consistently.
Module 8: Data Quality and Dataset Integration
- Handling missing values and duplicate records.
- Converting malformed numeric and date fields.
- Standardizing column names and units.
- Flagging unusual observations without automatically discarding valid events.
- Combining files and joining observations with station metadata.
- Checking join keys and avoiding unintended duplicate rows.
Module 9: Summaries and Time-Based Analysis
- Grouping and aggregating observations.
- Producing descriptive statistics and summary tables.
- Resampling time series and calculating rolling statistics.
- Identifying gaps and uneven temporal coverage.
- Exporting cleaned data and documenting cleaning decisions.
Practical Exercise: Seismic Event Catalog Analysis
- Import a supplied earthquake catalog containing missing and inconsistent records.
- Clean event times, coordinates, depths, and magnitudes.
- Summarize events by depth range, magnitude range, and time period.
- Export a cleaned catalog and summary tables.
Day 4: Scientific Visualization and Introduction to SciPy
Module 10: Scientific Plotting with Matplotlib
- Creating figures, axes, and multi-panel plots.
- Drawing line plots, scatter plots, histograms, and heatmaps.
- Adding titles, units, legends, annotations, and color bars.
- Selecting appropriate scales and color ranges.
- Plotting missing data and avoiding misleading visual connections.
- Saving figures for reports and presentations.
Module 11: Selected SciPy Tools
- Locating SciPy functionality and reading its documentation.
- Interpolating observations within appropriate data ranges.
- Fitting a simple scientific relationship and inspecting residuals.
- Removing trends and applying basic signal filters.
- Understanding sampling frequency, filter cutoff, and edge effects.
- Recognizing the limitations of interpolation, fitting, and filtering.
Module 12: Understanding and Improving an Existing Analysis
- Following imports, functions, and processing steps in unfamiliar code.
- Checking parameter meanings, defaults, and expected units.
- Investigating warnings and numerical errors.
- Comparing raw and processed data.
- Organizing reusable processing and plotting functions.
Practical Exercise: Scientific Time-Series Exploration
- Import and inspect a supplied regularly sampled geophysical signal.
- Examine gaps and confirm the sampling interval.
- Apply detrending and a suitable basic filter.
- Compare original and processed signals using labeled plots.
- Export the processed series and figures.
Day 5: Integrated Workflow and Capstone Project
Module 13: Building a Reproducible Analysis Workflow
- Organizing raw data, processing code, and generated outputs.
- Separating data loading, cleaning, analysis, and visualization.
- Using functions and explicit processing parameters.
- Adding useful error messages and basic data validation.
- Recording dependencies, units, assumptions, and processing decisions.
- Running the complete workflow from a clean session.
Module 14: Capstone — Geophysical Monitoring Station Analysis
Participants work with an instructor-supplied dataset containing timestamped geophysical station measurements and a separate station metadata file. The data includes missing readings, duplicate records, inconsistent fields, and quality flags.
The project covers the complete workflow:
- Import measurement files and station metadata.
- Inspect data structure, units, timestamps, and quality indicators.
- Clean records and document how questionable observations are handled.
- Join measurements with station metadata.
- Apply supplied calibration factors and calculate station-level anomalies.
- Produce descriptive statistics, daily summaries, and rolling trends.
- Apply a suitable SciPy operation to a selected series, checking its assumptions.
- Visualize station comparisons, data coverage, and raw versus processed measurements.
- Interpret notable patterns and distinguish observations from unsupported geophysical conclusions.
- Export cleaned data, derived results, summary tables, and figures.
Module 15: Final Project Outputs and Documentation
- A runnable notebook or Python script covering the full workflow.
- Cleaned and processed datasets with clearly identified units.
- Summary tables and labeled scientific figures.
- A dependency file describing the required packages.
- A short README explaining how to run the analysis.
- A concise findings summary describing results, data limitations, and processing assumptions.

