Skip to main content

Planetary Computer SDK for Python

Project description

Planetary Computer SDK for Python

Python library for interacting with the Microsoft Planetary Computer.

Installation

pip install planetarycomputer

If you have an API subscription key, you may provide it to the library by using the included configuration CLI:

planetarycomputer configure

Alternatively, a subscription key may be provided by specifying it in the PC_SDK_SUBSCRIPTION_KEY environment variable. A subcription key is not required for interacting with the service, however having one in place allows for less restricted rate limiting.

Development

The following steps may be followed in order to develop locally:

## Create and activate venv
python3 -m venv env
source env/bin/activate

## Install requirements
python3 -m pip install -r requirements.txt
python3 -m pip install -r requirements-dev.txt

## Install locally
pip install -e .

## Format code
./scripts/format

## Run tests
./scripts/test

Usage

This library currently assists with signing Azure Blob Storage URLs, both within PySTAC assets, and by providing raw URLs. The following examples demonstrate both of these use cases:

import pystac
import planetary_computer as pc

raw_item: pystac.Item = ...
item: pystac.Item = pc.sign_assets(raw_item)

# Now use the item however you want. All appropriate assets are signed for read access.
import planetary_computer as pc
import pystac

item: pystac.Item = ...  # Landsat item

b4_href = pc.sign(item.assets['SR_B4'].href)

with rasterio.open(b4_href) as ds:
   ...

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

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

planetary-computer-0.1.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

planetary_computer-0.1.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file planetary-computer-0.1.0.tar.gz.

File metadata

  • Download URL: planetary-computer-0.1.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for planetary-computer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a451b9dfd266d077e7a64a164b73d761f6a1d8bc5b63f413f8ceb35b33507a71
MD5 4767f6a9be6bd058898fa8a1f2f8a6c6
BLAKE2b-256 da6ad7b0be78fe798aa0cc525ab6cf5cbb73da06efabc37067ec4d8144681124

See more details on using hashes here.

File details

Details for the file planetary_computer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: planetary_computer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for planetary_computer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c208d40072eaea9b8f10f1e34a189984d074e8d120465046b8e01e4c0bde7c02
MD5 75b5b2de3d77afeeb6f53e3c365d32bc
BLAKE2b-256 3ca7f303e2f45614bb4b3883b6eae665ce3bd645b89bbcb5e3be92a3f835a452

See more details on using hashes here.

Supported by

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