MODIS LAI STAC ('modis-15A2H-061') may have broken time metadata? #102
-
Hi, MSPC. I'm prototyping some work on the Hub, and I noticed that when I used the same basic code to load and peruse DataArrays from different collections I got null time data returned for the MODIS LAI dataset ('modis-15A2H-061'). I don't believe this would be expected given my code, especially given that identical code returns working data for other collections, so I took this as a sign that something is wrong with the STAC, but of course please let me know if I'm doing something dumb on my end! Sample code to reproduce: import pystac_client, planetary_computer
catalog = pystac_client.Client.open("https://planetarycomputer.microsoft.com/api/stac/v1")
bbox = [-79.21787, 37.25838, -79.20933, 37.26692] # ~8km ENE of Evington, VA
dt = "2018-01-01/2022-05-09"
search = catalog.search(
collections=['modis-15A2H-061'],
bbox=bbox,
datetime=dt,
)
items = search.get_all_items()
da = stackstac.stack(planetary_computer.sign(items),
bounds_latlon=bbox,
epsg=4326,
)
print(da.time) Screenshot of resulting problem: Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Thanks for the easily reproducible example. The MODIS items (I think all of the collections) use a The |
Beta Was this translation helpful? Give feedback.
Thanks for the easily reproducible example.
The MODIS items (I think all of the collections) use a
null
datetime since they are composites over some time period. If you checkitems[0].datetime
you'll see it's None, whileitems[0].properties["start_datetime"]
and end_datetime are valid.The
time
dimension returned bystackstac
is comes from thedatetime
. The properties likestart_datetime
should be available as coordinates, and you should be able to make them a dimension with something likeda.swap_dims({"time": "start_datetime"})