Skip to content
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
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.3.1
current_version = 1.3.2
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(-(?P<release>.*)-(?P<build>\d+))?
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,5 @@ ENV/

# mkdocs build dir
site/
audit.txt
.claude/settings.local.json
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [1.3.2] 2026-03-20

### Changed
Comment thread
voj marked this conversation as resolved.
- Pandas 3 is explicitly not supported yet
- upgraded a number of dependencies

## [1.3.1] 2026-01-20

### Changed
Expand Down
72 changes: 72 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

Solvis is a Python library for analysis of OpenSHA Modular Fault System Solution files, used for New Zealand National Seismic Hazard Model (NSHM) research. License: AGPL-3.0-or-later.

## Development Commands

### Setup
```
pyenv local 3.10
poetry env use 3.10
poetry sync --all-groups
```

### Testing
- `poetry run pytest` — run all tests
- `poetry run pytest test/<file>.py` — run a single test file
- `poetry run pytest -k <keyword>` — filter tests by name
- `poetry run tox` — full QA suite (tests across Python 3.10/3.11/3.12, lint, format)
- `poetry run tox -e py310` — tests with coverage for a specific Python version

### Code Quality
- `poetry run tox -e format` — apply formatting (black + isort)
- `poetry run tox -e lint` — lint and type checking (flake8 + mypy)
- `poetry run black solvis test` — format code (line-length 120, skip string normalization)
- `poetry run isort solvis test` — sort imports
- `poetry run mypy solvis test` — type checking (uses pandera plugin)

### Documentation
- `mkdocs serve` — preview docs locally

## Architecture

### Core Classes (solvis/solution/)
- **InversionSolution** (`inversion_solution/`) — interface to a single OpenSHA inversion solution archive (zip file). Loads ruptures, fault sections, rates as DataFrames.
- **FaultSystemSolution** (`fault_system_solution/`) — aggregates multiple InversionSolutions sharing the same rupture set.
- **CompositeSolution** (`composite_solution.py`) — container for a complete NSHM model and its logic tree.

All three are exported from `solvis/__init__.py`.

### Filters (solvis/filter/)
Chainable, set-like filter classes for selecting ruptures:
- `RuptureIdFilter` — filter by rupture ID
- `ParentFaultIdFilter` — filter by parent fault
- `SubsectionIdFilter` — filter by subsection
- All inherit from `ChainableSetBase` and support set operations (union, intersection, difference).

### Key Modules
- `solvis/solution/dataframe_models.py` — Pandera DataFrameModel schemas for runtime DataFrame validation
- `solvis/solution/solution_participation.py` — rupture participation rate calculations
- `solvis/solution/solution_surfaces_builder.py` — geometry building for fault surfaces
- `solvis/solution/typing.py` — Protocol definitions for interfaces
- `solvis/geometry.py` — geometric calculations (Shapely-based; optional pyvista for 3D)
- `solvis/utils.py` — utilities including MFD histogram generation and GeoJSON export
- `solvis/scripts/cli.py` — Click-based CLI

### Dependencies
Core: geopandas, pandas, pandera, pyproj, nzshm-common, nzshm-model. Optional: pyvista (vtk extra), shapely (demo extra).

## Code Conventions

- **Line length:** 120 characters
- **Docstrings:** Google style
- **Formatting:** black (skip-string-normalization) + isort
- **Linting:** flake8 (max-complexity 18) + mypy with pandera plugin
- **Test framework:** pytest with markers: `slow`, `performance`, `TODO_check_values`
- **Test fixtures:** test archives in `test/fixtures/`; fixtures defined in `test/conftest.py`
- **DataFrame validation:** Use Pandera DataFrameModel schemas for any new DataFrame structures
- **TYPE_CHECKING guards:** Used throughout for imports only needed by type checkers
1,278 changes: 696 additions & 582 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "solvis"
version = "1.3.1"
version = "1.3.2"
description = "Analysis of opensha modular solution files."
readme = "README.md"
license = "AGPL-3.0-or-later"
Expand All @@ -14,7 +14,7 @@ dependencies = [
"geopandas (>=1.0.1)",
"nzshm-common (>=0.8.1)",
"nzshm-model (>=0.13.5)",
"pandas (>=2.3.0)",
"pandas (>=2.3.0,<3)",
"pyproj (>=3.3)",
"python-dateutil (>=2.8.2)",
"pytz (>=2025.1)",
Expand Down
2 changes: 1 addition & 1 deletion solvis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
from . import utils
from .solution import CompositeSolution, FaultSystemSolution, InversionSolution

__version__ = '1.3.1'
__version__ = '1.3.2'
4 changes: 2 additions & 2 deletions test/geometry/test_geometry_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_calc_performance_to_a_crustal_fault_section(self):
)
/ 10
)
assert elapsed < 0.1 # 100msec
assert elapsed < 0.2 # 200msec

@pytest.mark.performance
def test_calc_peformance_to_a_subduction_fault_section(self):
Expand Down Expand Up @@ -77,4 +77,4 @@ def test_calc_peformance_to_a_subduction_fault_section(self):
)
/ 10
)
assert elapsed < 0.5 # 500msec
assert elapsed < 0.6 # 600msec
Loading