Arindan Mandal
Arindan Mandal

Reputation: 79

Using stackstac, not able to mosaic all tiles/DataArray from the same date

I am trying to cloud access MODIS LST data through stackstac (code below). But, for my selected date range, in the output ds, I get lets say 5-6 different tiles (covering the entire bbox), which are as a DataArray within the ds. In the ds there are more than one DataArray which are from same date (photo below). I want to merge/mosaic (by spatially) all the same date tiles/DataArray into one timestamp, so that when I access/plot them, all same-day tiles can show in one timestamp.

I tried the stackstac.mosaic function (below example), but it basically merges all tiles/DataArray over time and output is only one timestamp.

So, what would be a good way to handle my problem, if anyone can suggest?

import pystac_client
import stackstac

catalog = pystac_client.Client.open(
    "https://planetarycomputer.microsoft.com/api/stac/v1",
    modifier=planetary_computer.sign_inplace,
)

time_range = "2000-02-18/2000-02-28"
bbox=[60, 30, 76, 35]
search = catalog.search(collections=["modis-11A2-061"], bbox=bbox, datetime=time_range)
items = search.get_all_items()

ds = stackstac.stack(items, epsg=4326, chunksize='auto', assets=["LST_Day_1km"])

Output (raw ds structure): enter image description here

Output (for same-day timestamps): enter image description here

This is the code I tried for mosaic-ing:

ds_new = stackstac.mosaic(ds)

Output: enter image description here

Upvotes: 0

Views: 68

Answers (0)

Related Questions