Planetary Computer (MPC)
Description:
- Planetary scale Earth Observation platform
Resources:
- https://planetarycomputer.microsoft.com/
- https://planetarycomputer.microsoft.com/catalog
- https://github.com/Microsoft/planetary-computer-apis
- https://github.com/microsoft/planetary-computer-apis/blob/main/docs/collection-config.md
- https://planetarycomputer.microsoft.com/explore
- https://planetarycomputer.microsoft.com/explore?c=30.0586%2C29.9930&z=2.00&v=2&d=landsat-c2-l2&s=false%3A%3A100%3A%3Atrue&ae=0&sr=desc&m=Most+recent+%28low+cloud%29&r=Natural+color
Example 1
Section titled “Example 1”Work with datasets in MPC and create stac complient assets
import pystacimport planetary_computerimport rioxarray as rxr
item_url = "https://planetarycomputer.microsoft.com/api/stac/v1/collections/landsat-c2-l2/items/LC09_L2SP_217066_20231126_02_T1"
# Load the individual item metadata and sign the assetsitem = pystac.Item.from_file(item_url)signed_item = planetary_computer.sign(item)
# Open one of the data assets (other asset keys to use: 'red', 'blue', 'drad', 'emis', 'emsd', 'trad', 'urad', 'atran', 'cdist', 'green', 'nir08', 'lwir11', 'swir16', 'swir22', 'coastal', 'qa_pixel', 'qa_radsat', 'qa_aerosol')asset_href = signed_item.assets["qa"].hrefds = rxr.open_rasterio(asset_href)dsExample 2
Section titled “Example 2”Search the MPC catalog and open the dataset
from pystac_client import Clientimport planetary_computer as pcimport rioxarray as rxr
# Search against the Planetary Computer STAC APIcatalog = Client.open( "https://planetarycomputer.microsoft.com/api/stac/v1")
# Define your area of interestaoi = { "type": "Polygon", "coordinates": [ [ [-56.60156250000078, -39.97712009843911], [116.71875000000045, -39.97712009843911], [116.71875000000045, 72.31578530526212], [-56.60156250000078, 72.31578530526212], [-56.60156250000078, -39.97712009843911] ] ]}
# Define your search with CQL2 syntaxsearch = catalog.search(filter_lang="cql2-json", filter={ "op": "and", "args": [ {"op": "s_intersects", "args": [{"property": "geometry"}, aoi]}, {"op": "=", "args": [{"property": "collection"}, "landsat-c2-l2"]}, {"op": "<=", "args": [{"property": "eo:cloud_cover"}, 10]} ]})
# Grab the first item from the search results and sign the assetsfirst_item = next(search.items())signed_item = pc.sign_item(first_item).assets
asset_href = signed_item["coastal"].hrefds = rxr.open_rasterio(asset_href)dsganymede is made by Eugo