cmr-stac icon indicating copy to clipboard operation
cmr-stac copied to clipboard

Question about asset identifiers

Open abarciauskas-bgse opened this issue 1 year ago • 1 comments

We are doing a little project that uses the STAC render extension to visualize NASA data via it's representation in CMR. We noticed that there is no way to associate data URLs with specific asset names (like band names) in CMR's UMM model but that in cmr-stac asset keys are present. We noticed that in cmr-stac there is an assumption that the asset identifier is always the second to last string in a URL (code here). We are curious if this is a safe assumption to make for our use case as well - in other words - how many collections in CMR adhere to this URL scheme?

abarciauskas-bgse avatar Feb 13 '24 17:02 abarciauskas-bgse

This assumption is definitely not safe, and results in inconsistent asset keys for STAC Items in the same collection. A couple examples:

  1. in MOD21A1D, you get the processing timestamp 2020037172712
  2. in ECO_L2T_LSTE_002 you get a long, arbitrary substring 002/ECOv002_L2T_LSTE_29757_001_15PWT_20231005T152054_0711_01/ECOv002_L2T_LSTE_29757_001_15PWT_20231005T152054_0711_01_LST

Shifting key-names breaks most libraries / access patterns. The item-assets component of the STAC Collection specification highlights how stable key names are surfaced to users searching a collection. This allows users to access assets in a direct fashion (O(1)), instead of filtering on keys and pattern matching on href (> O(N/2)).

ircwaves avatar Sep 23 '24 14:09 ircwaves

Drew Pesall responded:

The answer to your question is a bit complicated, because not all collections adhere to this schema. I can't really estimate how many collections adhere to this schema, so for some collections with relatedUrls it looks a bit goofy because the selected string to be used as the key is not particularly informative, but it still generates the key either way.

so I think this method sounds pretty unreliable.

william-valencia avatar Oct 09 '24 02:10 william-valencia