Metadata-Version: 2.4
Name: opensr-sr1m
Version: 0.1.1
Summary: Sentinel-2 10 m to 1 m RGB super-resolution for points and dates
Author: Eavheang
License-Expression: MIT
Project-URL: Homepage, https://github.com/Eavheang/openSR
Project-URL: Issues, https://github.com/Eavheang/openSR/issues
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: GIS
Classifier: Topic :: Scientific/Engineering :: Image Processing
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: pillow
Requires-Dist: torch
Requires-Dist: rasterio
Requires-Dist: shapely
Requires-Dist: planetary-computer
Requires-Dist: pystac-client
Requires-Dist: mlstac
Requires-Dist: sen2sr
Requires-Dist: opensr-srgan>=1.1.0
Dynamic: license-file

# opensr

Sentinel-2 L2A (Planetary Computer) 10 m to 1 m RGB super-resolution for any
set of locations and dates. The SEN2-SR model takes 10 m to 2.5 m; bicubic
resampling plus sharpening then puts it on a 1 m grid. Detail finer than
~2.5 m is not recovered, so treat 1 m as a pixel size, not true resolution.

Each (location, date) pair becomes a 5.12 km GeoTIFF (5120 x 5120 px at 1 m);
a run folder and a zip of it are written per call.

## Install

```bash
pip install opensr-sr1m
# or, from a local checkout
pip install -e .
```

## Use

```python
import opensr.inferutils

# one location, one date -> opensr_out/output_2026-11-08_Phnom_Penh/ (+ .zip)
opensr.inferutils.run((104.9160, 11.5564), "2026-11-08", location="Phnom Penh")

# many locations x many dates (every combination is processed)
# -> /content/s2dr3_out/output_2026-10-14_to_2026-11-08_Cambodia/
results = opensr.inferutils.run(
    [(105.392986, 14.121299), (104.9160, 11.5564)],
    ["2026-10-14", "2026-10-29", "2026-11-08"],
    out_dir="/content/s2dr3_out",
    location="Cambodia",
)

# CSV text or a CSV file path also work (lon first, lat second, header optional)
opensr.inferutils.run("points.csv", ["2026-11-08"])
```

Each call writes one folder (and a zip of it) named `output_<date>_<location>`.
If that name is already taken, the next run gets `(1)`, `(2)`, ...
(`output_2026-11-08_Phnom_Penh(1)`). Without `location` the folders are
`output_<date>_run_1`, `output_<date>_run_2`, ... Several dates in one call
give `output_<first>_to_<last>_<location>`.

`run` returns one `Result` per (location, date) with `path` (GeoTIFF),
`preview` (PIL image: 10 m input | 1 m output, centre 1 km) and `error`
(set when that job failed). In Jupyter or Colab, `run` also draws every
preview inline under the progress output; in a plain script it only returns
the results.

The model weights download once to `~/.cache/opensr/` on the first call.
A GPU is used when available; CPU works but is slow.
