NASA-IMPACT / veda-data

2 stars 0 forks source link

Add thumbnail assets to production collections #143

Open anayeaye opened 3 weeks ago

anayeaye commented 3 weeks ago

What

We now have a bucket in MCP s3://veda-thumbnails that is publicly accessible via cloudfront https://thumbnails.openveda.cloud/. Update production collection metadata to include these thumbnails as assets to improve the browser experience.

Parent issues

124 #122

Notes

For a first pass at improving our browser experience we can use exactly the same thumbnails that are configured in the dashboard for our STAC collections. The thumbnails from veda-config/datasets have already been copied to the thumbnail bucket but the thumbnails in eic-config have not (there is a large amount of overlap, probably only the climdex-* thumbnails need to be copied to the thumbnail bucket.

For a collection in s3, you can identify the dataset name by searching the collection id in veda-config and using the data.mdx file to identify the appropriate thumbnail. Veda-config groups datasets so in this first pass some of our collections will have duplicate thumbnails.

Config mdx example

For the hls-events.ej.data.mdx configuration, the thumbnail hls-events-ej--dataset-cover.png is located in media attributes.

---
id: hls_events
name: 'Harmonized Landsat Sentinel-2 (Selected Events)'
description: '30-meter resolution harmonized Landsat 8/9 and Sentinel-2A/B data products'
usage:
  - url: "https://nasa-impact.github.io/veda-docs/notebooks/quickstarts/hls-visualization.html"
    label: View example notebook
    title: 'Multi-Band Visualization Preview for Harmonized Landsat Sentinel-2 (HLS)'
  - url: "https://nasa-veda.2i2c.cloud/hub/user-redirect/git-pull?repo=https://github.com/NASA-IMPACT/veda-docs&urlpath=lab/tree/veda-docs/notebooks/quickstarts/hls-visualization.ipynb&branch=main"
    label: Run example notebook
    title: 'Multi-Band Visualization Preview for Harmonized Landsat Sentinel-2 (HLS)'
media:
  src: ::file ./hls-events-ej--dataset-cover.png
  alt: 2017 harmonized Landsat 8 shortwave infrared (SWIR) false color composite image that provides enhanced contrast to detect flood extent.
  <SNIP>
layers:
  - id: hls-l30-002-ej
    stacCol: hls-l30-002-ej-reprocessed
    name: HLS Landsat SWIR
<SNIP>

STAC Collection metadata example

Thumbnail objects are added to the assets property of a collection with the key thumbnail. If a collection does not already have an assets. See https://test.openveda.cloud/api/stac/collections/hls-l30-002-ej-reprocessed for an example of a collection with a thumbnail asset.

"assets": {
    "thumbnail": {
        "title": "Thumbnail",
        "href": "https://thumbnails.openveda.cloud/<dataset-name>.png",
        "type": "image/png",
        "roles": ["thumbnail"]
    },
   "someotherasset": {
        "title": "Name of an asset",
        "href": "somewhere.com",
        "roles": ["datal"]
    }
}

veda-configs

AC

anayeaye commented 3 weeks ago

@j08lue I think the fastest way for us to add thumbnails to our catalog is to just use the mdx thumbnails which means we will have many duplicated tiles in our browser. It also means we don't have anything as a placeholder for the landsat lakes/glaciers collections but IIRC we had thumbnails for those at one point. Do you recall where those are (maybe git history?) and do you think the duplicates will be OK?

j08lue commented 3 weeks ago

Thumbnails from the Dashboard config are fine, @anayeaye.

I do not think we had thumbnails for the Landsat collections, so I created some. Sizes / aspect ratios are unfortunately not consistent.

Please crop and/or resample them, if need be. No worries if parts of the lakes or so get cut off.

landsat-c2l2-sr-antarctic-glaciers-thwaites

Screenshot from EO Dashboard

landsat-c2l2-sr-antarctic-glaciers-thwaites

landsat-c2l2-sr-antarctic-glaciers-pine-island

Screenshot from EO Dashboard

landsat-c2l2-sr-antarctic-glaciers-pine-island

landsat-c2l2-sr-lakes-vanern

Screenshot from EO Dashboard

landsat-c2l2-sr-lakes-vanern

landsat-c2l2-sr-lakes-lake-balaton

Screenshot from EO Dashboard

landsat-c2l2-sr-lakes-lake-balaton

landsat-c2l2-sr-lakes-aral-sea

Screenshot from Planetary Computer

landsat-c2l2-sr-lakes-aral-sea

landsat-c2l2-sr-lakes-tonle-sap

Screenshot from Planetary Computer

landsat-c2l2-sr-lakes-tonle-sap

landsat-c2l2-sr-lakes-lake-biwa

Screenshot from Planetary Computer

landsat-c2l2-sr-lakes-lake-biwa

PNG thumbnails named by collection, zipped

landsat-collection-thumbnails.zip

j08lue commented 3 weeks ago

Should we generally name the thumbnails after the collection ID?

anayeaye commented 2 weeks ago

stac-spec + thumbnail attribution

We haven't yet planned how to handle attribution for the thumbnails we are using. Veda-config handles attribution in the dataset mdx file (example). veda config

media:
  src: ::file ./caldor-fire--dataset-cover.jpg
  alt: Hillside engulfed by a wildfire.
  author:
    name: Marek Piwnicki
    url: https://unsplash.com/photos/WiZOyYqzUss

stac catalog In the stac-spec we have the provider object, but that feels odd to include the thumbnail producer alongside the data producers. Inside the asset object we have the description property where we could add author and the source url for the thumbnail. For reference we are adding assets to our collection metadata like this to make for a nicer stac-browser experience:

...,
    "assets": {
        "thumbnail": {
            "title": "Thumbnail",
            "description": "<???MAYBE thumb author here?>",
            "href": "https://thumbnails.openveda.cloud/caldor-fire--dataset-cover.jpg",
            "type": "image/jpeg",
            "roles": ["thumbnail"]
        }
    }
anayeaye commented 2 weeks ago

I've added thumbnails to all the production collection metadata in PR #145 and published to https://test.openveda.cloud/ 🚀