Skip to content
Draft
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
136 changes: 136 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# Data files
*.hdf5
*.h5
*.sac
*.mseed
*.seed
85 changes: 85 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,87 @@
# ESS563-2025
Advanced Seismology

This repository contains the Python environment setup and utilities for the ESS563 Advanced Seismology course.

## Environment Setup

### Prerequisites

- [Anaconda](https://www.anaconda.com/products/distribution) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html) installed on your system

### Installation

1. Clone this repository:
```bash
git clone https://github.com/UW-geophysics-edu/ESS563-2025.git
cd ESS563-2025
```

2. Create the conda environment:
```bash
conda env create -f environment.yml
```

3. Activate the environment:
```bash
conda activate ess563
```

### Alternative Installation (pip only)

If you prefer to use pip instead of conda:

```bash
pip install -r requirements.txt
```

## Testing the Environment

To verify that all packages are installed correctly, run the test script:

```bash
python examples/test_environment.py
```

This will check that all required packages are installed and functioning properly.

## Included Packages

This environment includes the following key packages for seismological analysis:

- **obspy**: Seismic data processing and analysis
- **matplotlib**: Plotting and visualization
- **scipy**: Scientific computing
- **numpy**: Numerical computing
- **pandas**: Data manipulation and analysis
- **h5py**: HDF5 file format support

## Usage

After activating the environment, you can start using any of the included packages in your Python scripts or Jupyter notebooks.

Example:
```python
import obspy
from obspy import read
import matplotlib.pyplot as plt
import numpy as np

# Your seismological analysis code here...
```

## Directory Structure

```
ESS563-2025/
├── environment.yml # Conda environment specification
├── requirements.txt # Pip requirements file
├── ess563/ # Main package directory
│ └── __init__.py # Package initialization
└── examples/ # Example scripts and tests
└── test_environment.py # Environment verification script
```

## Contributing

This repository is for educational purposes as part of the ESS563 Advanced Seismology course.
14 changes: 14 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: ess563
channels:
- conda-forge
- defaults
dependencies:
- python=3.11
- pip
- pip:
- obspy
- matplotlib
- scipy
- numpy
- pandas
- h5py
9 changes: 9 additions & 0 deletions ess563/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""
ESS563 - Advanced Seismology Package

This package provides utilities and examples for the ESS563 Advanced Seismology course.
"""

__version__ = "0.1.0"
__author__ = "ESS563 Course"
__description__ = "Advanced Seismology utilities and examples"
114 changes: 114 additions & 0 deletions examples/test_environment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#!/usr/bin/env python
"""
Test script to verify that all required packages are installed and working.

This script imports all the main packages used in ESS563 and performs
basic operations to ensure they're functioning correctly.
"""

import sys
import matplotlib
matplotlib.use('Agg') # Use non-interactive backend for testing

def test_imports():
"""Test that all required packages can be imported."""
print("Testing package imports...")

try:
import numpy as np
print(f"✓ numpy {np.__version__}")
except ImportError as e:
print(f"✗ numpy: {e}")
return False

try:
import scipy
print(f"✓ scipy {scipy.__version__}")
except ImportError as e:
print(f"✗ scipy: {e}")
return False

try:
import pandas as pd
print(f"✓ pandas {pd.__version__}")
except ImportError as e:
print(f"✗ pandas: {e}")
return False

try:
import matplotlib.pyplot as plt
print(f"✓ matplotlib {matplotlib.__version__}")
except ImportError as e:
print(f"✗ matplotlib: {e}")
return False

try:
import h5py
print(f"✓ h5py {h5py.__version__}")
except ImportError as e:
print(f"✗ h5py: {e}")
return False

try:
import obspy
print(f"✓ obspy {obspy.__version__}")
except ImportError as e:
print(f"✗ obspy: {e}")
return False

return True

def test_basic_functionality():
"""Test basic functionality of key packages."""
print("\nTesting basic functionality...")

try:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import h5py
from obspy import UTCDateTime

# Test numpy
arr = np.array([1, 2, 3, 4, 5])
print(f"✓ numpy array created: {arr}")

# Test pandas
df = pd.DataFrame({'x': [1, 2, 3], 'y': [4, 5, 6]})
print(f"✓ pandas DataFrame created with shape: {df.shape}")

# Test matplotlib
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [1, 4, 2])
plt.close(fig)
print("✓ matplotlib plot created and closed")

# Test obspy UTCDateTime
t = UTCDateTime()
print(f"✓ obspy UTCDateTime created: {t}")

return True

except Exception as e:
print(f"✗ Basic functionality test failed: {e}")
return False

def main():
"""Main test function."""
print("ESS563 Environment Test")
print("=" * 30)

# Test imports
if not test_imports():
print("\n❌ Import tests failed!")
sys.exit(1)

# Test basic functionality
if not test_basic_functionality():
print("\n❌ Functionality tests failed!")
sys.exit(1)

print("\n✅ All tests passed! Environment is ready for ESS563.")

if __name__ == "__main__":
main()
6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
obspy
matplotlib
scipy
numpy
pandas
h5py
Loading