stac-utils / pystac

Python library for working with any SpatioTemporal Asset Catalog (STAC)

Home Page:https://pystac.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add "inheritence"

gadomski opened this issue · comments

In STAC 1.1, we are probably going to explicitly state that assets "inherit" attributes from items. E.g., for this (shortened) item:

{
  "properties": {"foo": "bar"},
  "assets": {"data": {"href": "example.tif"}}
}

pystac should behave like this:

assert item.assets["data"].foo == "bar"

This might require some strange __getattr__ magic, which might be really hard to do while preserving typing.

Related issues

Items don't have this kind of arbitrary get logic though right? So it might be that we add a bunch of new properties to the Asset class.

So it might be that we add a bunch of new properties to the Asset class.

Yup, agreed ... and, as I was thinking about it this morning, maybe Band as well -- I think the way the bands RFC works, an attribute could be defined on a band, on an asset, or on an item?