Metadata-Version: 2.4
Name: solarops
Version: 0.1.0
Summary: Offline quality checks, preprocessing, metrics and reports for solar PV power time series
Maintainer-email: Junaid Bashir <junaidbashir392@gmail.com>
License-Expression: MIT
Project-URL: Repository, https://github.com/Junaid-Bashir/solarops
Project-URL: Documentation, https://github.com/Junaid-Bashir/solarops/tree/main/docs
Project-URL: Issues, https://github.com/Junaid-Bashir/solarops/issues
Keywords: solar,photovoltaic,time-series,data-quality,energy
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas<4,>=2.2
Requires-Dist: tzdata>=2024.1; platform_system == "Windows"
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Provides-Extra: visualization
Requires-Dist: matplotlib<4,>=3.8; extra == "visualization"
Dynamic: license-file

# SolarOps

SolarOps is an open-source Python library for validating and analyzing one site's
historical solar photovoltaic power data. It works offline without AI, weather
services or an account.

## What it does

- Load CSV files and pandas DataFrames with explicitly declared units, timezone and cadence.
- Report malformed timestamps, DST ambiguity, duplicates, missing intervals and unavailable values.
- Measure timestamp presence and usable-value coverage over explicit periods.
- Explicitly sort, resolve duplicates, convert units/timezones, regularize and downsample data.
- Identify neutral flatline and configured-range observations, with evidence.
- Calculate coverage-aware period/daily energy and recorded peak interval-average power.
- Create structured JSON and standalone HTML reports, with optional Matplotlib plots.

Original datasets remain unchanged; transformations return new datasets with
history and provenance. Missing production is never silently counted as zero.
Patterns are observations to investigate, not confirmed equipment faults.

## Install from source

Python 3.10+ is required. From a downloaded source tree or repository checkout:

```console
python -m venv .venv
# Windows: .venv\Scripts\Activate.ps1
# Linux/macOS: source .venv/bin/activate
python -m pip install .
# Optional plots:
python -m pip install ".[visualization]"
# Contributors:
python -m pip install -e ".[dev,visualization]"
```

The distribution name and import name are both `solarops`, version **0.1.0**.
The candidate is being prepared for first publication; the source installation
above is usable before PyPI publication is complete. Runtime dependencies are
pandas and, on Windows, tzdata. Matplotlib is optional; pytest is a development extra.

## Quick start

This self-contained example uses **synthetic** measurements:

```python
import pandas as pd
from solarops import SolarDataset
from solarops.metrics import calculate_energy
from solarops.reporting import create_report

site = SolarDataset.from_dataframe(
    pd.DataFrame({
        "timestamp": pd.date_range("2026-06-01 10:00", periods=4, freq="15min"),
        "power_kw": [4.0, 4.0, 4.0, 4.0],
    }),
    timestamp_col="timestamp", power_col="power_kw",
    timezone="Europe/Brussels", interval="15min", unit="kW",
)
period = dict(start="2026-06-01 10:00", end="2026-06-01 11:00")
energy = calculate_energy(site, **period)
assert energy.values["accepted_energy_kwh"] == 4.0
print(energy.summary())

report = create_report(site, **period)
report.to_json("solar_report.json")
report.to_html("solar_report.html")
```

Exports refuse existing files unless `overwrite=True`. Flatline/range detection
is opt-in and requires explicit caller parameters; reports never infer thresholds.

## Data contract and limitations

Only **interval-average power**, declared as W or kW, is supported. Timestamps
mark interval starts; analysis periods are `[start, end)`. The fixed sampling
interval and IANA site timezone are required. Naive times are localized strictly;
ambiguous/nonexistent DST times are never guessed. Aware times preserve their
represented instants. Daily metrics use actual local calendar-day durations.

Energy is observed over usable covered durations. A relaxed acceptance threshold
does not recover unknown production or convert partial energy into a complete total.
Peaks are maxima of recorded interval averages, not instantaneous maxima. Do not
load instantaneous samples, interval energy, cumulative meters or household net
import/export as if they were PV interval-average production. No forecasting,
automatic repairs or equipment-fault diagnosis is provided. The initial alpha API
may evolve. The current release has been tested locally on Windows/Python 3.12;
the included CI matrix expands verification after the repository is published.

## Documentation and examples

- [Detailed user guide](docs/user_guide.md)
- [Preprocessing and provenance](docs/preprocessing.md)
- [Detection](docs/detection.md)
- [Coverage-aware metrics](docs/metrics.md)
- [Visualization](docs/visualization.md)
- [Reporting and export privacy](docs/reporting.md)
- [Real-data evaluation and attribution](docs/real_data_evaluation.md)
- [Contributing](CONTRIBUTING.md) and [changelog](CHANGELOG.md)

From a source checkout, run:

```console
python -m pytest
python examples/validate_synthetic.py
python examples/preprocess_synthetic.py
python examples/detect_synthetic.py
python examples/metrics_synthetic.py
python examples/report_synthetic.py --output-dir examples/generated_reports --overwrite
python examples/visualize_synthetic.py --output-dir examples/generated_plots
```

Examples ship in the source distribution/repository. Generated files, downloaded
real datasets, local environments and personal assets are excluded from publication.
Real-data evaluation downloads are separate and documented; automated tests are offline.

## Licence and acknowledgement

MIT licensed; see [LICENSE](LICENSE). SolarOps is an independent project inspired
by the general problem space of Solar Data Tools. It does not copy that project's
source, is not affiliated with it, and does not imply endorsement. Solar Data Tools
already offers established PV data-quality analysis and diagnostics; see the
[comparison and attribution](docs/real_data_evaluation.md). Third-party evaluation
data retains its own licence and attribution, separate from the SolarOps MIT licence.
