Skip to main content

A package for satellite image AI data prep

Project description

SatChip

A package for satellite image AI data prep. This package "chips" data labels and satellite imagery into 264x264 image arrays following the TerraMind extension of the MajorTom specification.

Usage

SatChip relies on a two-step process; chip your label train data inputs, then create corresponding chips for different remote sensing data sources.

Step 1: Chip labels

The chiplabel CLI tool takes a GDAL-compatible image, a collection date, and an optional output directory as input using the following format:

chiplabel PATH/TO/LABELS.tif DATE(UTC FORMAT) --outdir OUTPUT_DIR

For example:

chiplabel LA_damage_20250113_v0.tif 2024-01-01T01:01:01 --outdir chips

This will produce an output zipped Zarr store label dataset with the name {LABELS}.zarr.zip in the specified output directory (--outdir). This file will be the input to the remote sensing data chipping step.

For more information on usage see chiplabel --help

Step 2: Chip remote sensing data

The chipdata CLI tool takes a label zipped Zarr store, a dataset name, and an optional output directory as input using the following format:

chipdata PATH/TO/LABELS.zarr.zip DATASET --outdir OUTPUT_DIR

For example:

chipdata LA_damage_20250113_v0.zarr.zip S2L2A --outdir chips

Similarly to step 1, this will produce an output zipped Zarr store that contains chipped data for your chosen dataset with the name {LABELS}_{DATASET}.zarr.zip.

Currently support datasets include:

Tiling Schema

This package chips images based on the TerraMesh grid system, which builds on the MajorTOM grid system.

The MajorTOM grid system provides a global set of fixed image grids that are 1068x1068 pixels in size. A MajorTOM grid can be defined for any tile size, but we fix the grid to 10x10 Km tiles. Tiles are named using the format:

ROW[U|D]_COL[L|R]

Where, ROW is indexed from the equator, with a suffix U (up) for tiles north of the equator and D (down) for tiles south of it, and COL is indexed from the prime meridian, with a suffix L (left) for tiles east of the prime meridian and R (right) for tiles west of it.

To support finer subdivisions, the TerraMesh grid system divides each MajorTOM grid into a 4x4 set of sub-tiles, each 264x264 pixels. The subgrid is centered within the parent tile, leaving a 6-pixel border around each sub-tile. Subgrid names extend the base format with two additional indices:

ROW[U|D]_COL[L|R]_SUBCOL_SUBROW

For instance, the bottom-left subgrid of MajorTOM tile 434U_876L is named 434U_876L_0_3. See the figure below for a visual description:

TerraMesh tiling schema

Viewing Chips

Assessing chips after their creation can be challenging due to the large number of small images created. To address this issue, SatChip includes a chipview CLI tool that uses Matplotlib to quickly visualize the data included within the created zipped Zarr stores:

chipview PATH/TO/CHIPS.zarr.zip BAND --idx IDX

Where PATH/TO/CHIPS.zarr.zip is the path to the chip file (labels or image data), BAND is the name of the band you would like to view, and IDX is an optional integer index of which dataset you would like to initially view.

License

SatChip is licensed under the BSD-3-Clause open source license. See the LICENSE file for more details.

Contributing

Contributions to the SatChip are welcome! If you would like to contribute, please submit a pull request on the GitHub repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

satchip-0.2.0.tar.gz (29.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

satchip-0.2.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file satchip-0.2.0.tar.gz.

File metadata

  • Download URL: satchip-0.2.0.tar.gz
  • Upload date:
  • Size: 29.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for satchip-0.2.0.tar.gz
Algorithm Hash digest
SHA256 de4ee5507f233a98b341c9b96020b4ece4f4e93f34faf8244fa82967c8e64861
MD5 03bd592a747f4dde365b4d354d4b6b1c
BLAKE2b-256 92c88c2cf6119dd2cdffb0083e6f7dd630eee64718b0e6c01eb04e252ee1cb2e

See more details on using hashes here.

File details

Details for the file satchip-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: satchip-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for satchip-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c14618a46ef43a46eced1aeb806d60f84dc2e6b38872db8d39959865fef9d02
MD5 744e2bec6b14ad77161b328f3201b131
BLAKE2b-256 247be5824216c6d6524ed221d6a145bd2a5364a73900eff440508b946ea525b7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page