Metadata-Version: 2.3
Name: multigas
Version: 0.1.0
Summary: Python package for multigas sensor
Keywords: multigas,volcano,gas,sensor,monitoring
Author: Martanto
Author-email: Martanto <martanto@live.com>
License: MIT License
         
         Copyright (c) 2026 Martanto
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: joblib>=1.5.3
Requires-Dist: loguru>=0.7.3
Requires-Dist: numpy>=2.4.4
Requires-Dist: openpyxl>=3.1.5
Requires-Dist: pandas>=3.0.2
Requires-Dist: pandas-stubs~=3.0.2
Requires-Dist: python-dotenv>=1.2.2
Requires-Python: >=3.11
Project-URL: Homepage, https://github.com/martanto/multigas
Project-URL: Issues, https://github.com/martanto/multigas/issues
Description-Content-Type: text/markdown

# multigas

[![Python Version](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

**Python package for processing, analyzing, and visualizing multi-gas volcanic monitoring data.**

Developed through collaboration between CVGHM (Center for Volcanology and Geological Hazard Mitigation) and USGS for Campbell Scientific datalogger systems measuring volcanic gas emissions (CO2, SO2, H2S) and meteorological data.

---

## Installation

### Requirements

- Python 3.11 or higher
- Windows, macOS, or Linux

### Install with uv (recommended)

```bash
# Install uv package manager
pip install uv

# Clone repository
git clone https://github.com/martanto/multigas.git
cd multigas

# Install with all dependencies
uv sync
```

---

## Development

```bash
# Lint and auto-fix
uv run ruff check --fix src/

# Type check
uvx ty check src/

# Run all tests
uv run pytest tests/

# Run a single test file
uv run pytest tests/path/to/test_file.py

# Check for circular imports
uv run pytest tests/test_imports.py -v
```

---

## Package Structure

```
src/multigas/
├── __init__.py          # Version metadata
├── config/
│   └── logging.py       # Logging setup (console + optional file handler)
└── core/
    ├── exceptions.py    # Custom exception hierarchy
    └── types.py         # Shared type aliases, enums, and TypedDicts
```

### Core types (`multigas.core.types`)

| Name | Kind | Description |
|---|---|---|
| `DateLike` | type alias | `str \| datetime \| pd.Timestamp` |
| `ColumnName` | type alias | `str` |
| `DatasetType` | `StrEnum` | Dataset sampling intervals as pandas frequency aliases: `ONE_SECOND="1s"`, `TWO_SECONDS="2s"`, `ONE_MINUTE="1min"`, `SIX_HOURS="6h"`, plus categorical modes `ZERO="zero"`, `SPAN="span"`, `WX="wx"` |
| `DatasetMetadataDict` | `TypedDict` | Station metadata from datalogger files |
| `LogLevel` | `StrEnum` | `DEBUG`, `INFO`, `WARN`, `ERROR` |
| `FileFormat` | `StrEnum` | `CSV`, `EXCEL`, `PARQUET`, `JSON` |

### Exceptions (`multigas.core.exceptions`)

```
MultigasException
├── DatasetError
│   ├── FilterError
│   ├── ColumnError
│   └── DateRangeError
├── ValidationError
├── CacheError
├── LoaderError
├── MetadataError
├── PlotError
└── ConfigError
```

### Logging (`multigas.config.logging`)

```python
from multigas.config.logging import setup_logging, get_logger
from multigas.core.types import LogLevel

# Basic setup (console only)
logger = setup_logging(LogLevel.INFO)

# Enable file logging to logs/YYYY-MM-DD.log
logger = setup_logging(LogLevel.DEBUG, enable_file_log=True)

# Or set ENABLE_LOG=true in .env to enable file logging automatically
logger = setup_logging()

# Get a named child logger
logger = get_logger("multigas.reader")
```

---

## Dependencies

| Package | Purpose |
|---|---|
| `pandas` | DataFrame operations |
| `numpy` | Numerical computing |
| `openpyxl` | Excel file I/O |
| `loguru` | Structured logging |
| `python-dotenv` | Environment variable loading |

---

## License

[MIT](LICENSE) — Copyright (c) 2026, Martanto
