from pystac_client import Client
import stackstac
STAC_URL = 'https://cmr.earthdata.nasa.gov/stac'
catalog = Client.open(f"{STAC_URL}/LPCLOUD")
search = catalog.search(
    collections = ['HLSL30.v2.0', 'HLSS30.v2.0'],
    intersects = {'type': 'Polygon',
                  'coordinates': [[[-101.67271614074707, 41.04754380304359],
                                   [-101.65344715118408, 41.04754380304359],
                                   [-101.65344715118408, 41.06213891056728],
                                   [-101.67271614074707, 41.06213891056728],
                                   [-101.67271614074707, 41.04754380304359]]]},
    datetime = '2021-05/2021-08'
)               
search.matched()
ic = search.get_all_items()
il = list(search.get_items())
tic = [x for x in ic if 'T13TGF' in x.id]
import pystac
item_collection = pystac.ItemCollection(items=tic)
item_collection
il
data = stackstac.stack(item_collection, assets=['B04', 'B02'], epsg=32613, resolution=30)
data.sel(band='B04').isel(time=[0])
import stackstac
import pystac_client

URL = "https://earth-search.aws.element84.com/v0"
catalog = pystac_client.Client.open(URL)
catalog
stac_items = catalog.search(
    intersects=dict(type="Point", coordinates=[-105.78, 35.79]),
    collections=["sentinel-s2-l2a-cogs"],
    datetime="2020-04-01/2020-05-01"
).get_all_items()
stac_items
stack = stackstac.stack(stac_items)
stack