Skip to main content
# stactools-sentinel2

stactools package for Sentinel-2 data.

## Examples

- [L1C item](./examples/sentinel2-l1c-example/S2A_T01LAC_20200717T221944_L1C/S2A_T01LAC_20200717T221944_L1C.json)
- [L2A item](./examples/sentinel2-l2a-example/S2A_T07HFE_20190212T192646_L2A/S2A_T07HFE_20190212T192646_L2A.json)

## Running

```shell
pip install stactools-sentinel2
```

SAFE archive:

```shell
stac sentinel2 create-item tests/data-files/S2A_MSIL2A_20190212T192651_N0212_R013_T07HFE_20201007T160857.SAFE output/
```

AWS Open Data bucket `sentinel-s2-l2a`:

```shell
stac sentinel2 create-item tests/data-files/S2A_OPER_MSI_L2A_TL_SGS__20181231T210250_A018414_T10SDG output/
```

Sentinel Hub metadata:

```shell
stac sentinel2 create-item --asset-href-prefix s3://sentinel-s2-l2a/tiles/34/L/BP/2022/4/1/0/ \
https://roda.sentinel-hub.com/sentinel-s2-l2a/tiles/34/L/BP/2022/4/1/0/ output
```

**Note:** this does not currently work with S3 buckets using requester-pays.

The flag `--tolerance` can be set to a decimal value to define the simplification tolerance of the Item geometry.
This is a pass-through to the [Shapely simplify method](https://shapely.readthedocs.io/en/stable/manual.html#object.simplify).

## Development

Install pre-commit hooks with:

```commandline
pre-commit install
```

Run these pre-commit hooks with:

```commandline
pre-commit run --all-files
```

Install the code in the local python env so your IDE can see it:

```commandline
pip install -e ".[dev]"
```

### Testing

Run the tests with:

```commandline
pytest -vvv
```


Most tests fixture expectations can be updated by running:

```shell
pytest --update-expectations
```

If the expectation file is missing for any test in `test_commands` it will be
generated, and the test will fail. This failure is to ensure fixture updates
don't happen silently.

Alternatively, tests can be updated by using the following command:

```shell
python scripts/create_expected.py
```

Metadata

Release files for stactools-sentinel2 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stactools-sentinel2 0.8.0
File Size Uploaded
stactools_sentinel2-0.8.0.tar.gz 26.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stactools-sentinel2 0.8.0
File Interpreter ABI Platform
stactools_sentinel2-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 52.2 kB

Release files / stactools_sentinel2-0.8.0.tar.gz

Download URL stactools_sentinel2-0.8.0.tar.gz
Size 26.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cedcfc65b33aa29a43aebad255583e64c92a93c759e8cbe688b562bc7ff17bc2
BLAKE2b-256 checksum
How to use checksums
1f45c14281376a1f0cbb74e86349d292a9888517c17b30e4f39efbe48c3b2731
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.4

Release files / stactools_sentinel2-0.8.0-py3-none-any.whl

Download URL stactools_sentinel2-0.8.0-py3-none-any.whl
Size 25.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3bd6e5d605e95d556f096fc3fad42bfe8f945d7800fea56e62938dcb69f8e996
BLAKE2b-256 checksum
How to use checksums
26ff803b48e1eaa38bad6904620de8356254c242dc35273c46cbc53fe6c16dfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.4
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page