Metadata-Version: 2.1
Name: stactools-sentinel2
Version: 0.5.0
Summary: Create STAC Items from Sentinel-2 metadata
Home-page: https://github.com/stactools-sentinel2/stactools-sentinel2
Author: stac-utils
Author-email: stac@radiant.earth
Project-URL: Issues, https://github.com/stactools-sentinel2s/stactools-sentinel2/issues
Keywords: stactools,pystac,catalog,STAC
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: antimeridian>=0.3.3
Requires-Dist: stactools>=0.5.2
Requires-Dist: pystac>=1.9.0

# stactools-sentinel2

stactools package for Sentinel-2 data.

## Examples

- [L1C item](./examples/sentinel2-l1c-example/S2A_MSIL1C_20200717T221941_R029_T01LAC_20200717T234135/S2A_MSIL1C_20200717T221941_R029_T01LAC_20200717T234135.json)
- [L2A item](./examples/sentinel2-l2a-example/S2A_MSIL2A_20190212T192651_R013_T07HFE_20201007T160857/S2A_MSIL2A_20190212T192651_R013_T07HFE_20201007T160857.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 .
```

Run the tests with:

```commandline
pytest -vvv
```

If you change the STAC metadata output, you will need to re-create the test files with the following command:

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