Metadata-Version: 2.4
Name: scet-toolkit
Version: 0.3.0
Summary: Shoreline Change Estimation Toolkit: extract shorelines from segmented imagery and compute change rates via OpenDSAS
Author: Boyuan Lu
License: Copyright (c) 2018 The Python Packaging Authority
        
        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.
Project-URL: Homepage, https://github.com/lubyant/ShorelineCalculator
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: GIS
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENCE.txt
Requires-Dist: numpy
Requires-Dist: opencv-python-headless
Requires-Dist: rasterio
Requires-Dist: geopandas
Requires-Dist: shapely
Requires-Dist: pyproj
Requires-Dist: pandas
Requires-Dist: scipy
Requires-Dist: scikit-learn
Requires-Dist: matplotlib
Requires-Dist: pillow
Requires-Dist: opendsas
Requires-Dist: torch>=2.0
Requires-Dist: tqdm
Requires-Dist: ftfy
Requires-Dist: regex
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Dynamic: license-file

# SCET (Shoreline Change Estimation Toolkit)

A pure-Python toolkit for extracting shorelines from segmented raster imagery
and computing shoreline change rates. Transect casting, shoreline/transect
intersection, and change-rate calculation are delegated to the
[OpenDSAS](https://github.com/lubyant/OpenDSAS) CLI (`dsas`), a fast,
cross-platform reimplementation of USGS DSAS.

## Installation

```bash
pip install scet-toolkit
```

This installs `scet-toolkit`'s dependencies including `opendsas`, which
provides the `dsas` CLI used for transect/intersection/rate calculations.

The deep-learning segmentation step (`scet.segmentation`, used by
`SCET.process_folder`/`process_image`) is included: the DeepLabV3+ network is
plain PyTorch, so there is no mmcv/mmsegmentation or GDAL to build and any
Python 3.9+ works. `torch` is CUDA-build-sensitive: if the default wheel isn't
right for your platform, install torch from https://pytorch.org first (matching
your CUDA version), then `pip install scet-toolkit`. Inference uses the GPU
when available and falls back to CPU.

## Usage

```python
from scet import SCET, Config

config = Config(checkpoint_file="path/to/checkpoint.pth")
scet = SCET(config)
scet.process_folder(input_naip_zipfiles_folder="...", output_folder="...")
```

Or drive the shoreline pipeline directly, given a folder of already-segmented,
dated raster images (filenames ending in a 4-digit year, e.g. `1_2001.tif`):

```python
from scet.options import Options
from scet.pipeline import generate_result_from_folder

generate_result_from_folder("images/", "output/", Options())
```

This writes `shoreline.shp`, `baseline.shp`, `transect.shp`, and
`intersection.shp` to the output folder.

## Development

```bash
conda create -n my_env python==3.12
conda activate my_env
bash build.sh  # pip install -e .
```

### Testing

```bash
pip install -e ".[test]"
pytest                 # full suite, including end-to-end pipeline tests
pytest -m "not e2e"    # unit tests only (skip anything that shells out to `dsas`)
```

The end-to-end tests build synthetic georeferenced rasters, run the full
`images -> shoreline/baseline -> dsas cast/cal` pipeline, and check the
output shapefiles. They need the `dsas` executable (installed with the
`opendsas` dependency) on `PATH` and self-skip if it is missing.
