easierdata / ipfs-stac

Python client utilized for interfacing with the Easier STAC Server
MIT License
3 stars 1 forks source link

Reconfigure Logic in Asset Class to store filename #48

Open SethDocherty opened 5 days ago

SethDocherty commented 5 days ago

getAssetFromItem comments:

After looking at the method(s) in more detail, we're going to have to tweak these methods a little. The idea I had was that we would grab the name of the file which would be a property in Asset class.

for example, json for the asset SAA:

"SAA": {
  "href": "https://landsatlook.usgs.gov/data/collection02/level-1/standard/oli-tirs/2022/017/039/LC09_L1GT_017039_20221029_20221029_02_T2/LC09_L1GT_017039_20221029_20221029_02_T2_SAA.TIF",
  "type": "image/vnd.stac.geotiff; cloud-optimized=true",
  "roles": [
    "sun-azimuth"
  ],
  "title": "Solar Azimuth Angle Band",
  "alternate": {
    "s3": {
      "href": "s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2022/017/039/LC09_L1GT_017039_20221029_20221029_02_T2/LC09_L1GT_017039_20221029_20221029_02_T2_SAA.TIF",
      "storage:platform": "AWS",
      "storage:requester_pays": true
    },
    "IPFS": {
      "href": "ipfs://bafybeicfu3xu6mxfoxr7pd24pmbiq3t4ti7ffjuimg3a4nhekoq3x4wahq"
    },
    "Filecoin": {
      "href": "ipfs://bafybeihhdnvfga74krt55whsyvbq7g2p2uc7c6vv24cszxylt3rckpm6dy",
      "storage:platform": "PiKNiK"
    }
  },
  "description": "Collection 2 Level-1 Solar Azimuth Angle Band"
},

I was hoping to grab the file name from the href property: LC09_L1GT_017039_20221029_20221029_02_T2_SAA.TIF

and for GEDI:

"assets": {
  "opendap": {
    "href": "https://opendap.earthdata.nasa.gov/collections/C2237824918-ORNL_CLOUD/granules/GEDI_L4A_AGB_Density_V2_1.GEDI04_A_2023075201011_O24115_02_T08796_02_003_01_V002.h5",
    "title": "OPeNDAP request URL (GET DATA : OPENDAP DATA)"
  },
  "metadata": {
    "href": "https://cmr.earthdata.nasa.gov/search/concepts/G2764298906-ORNL_CLOUD.xml",
    "type": "application/xml"
  },
  "SHA-256 file": {
    "href": "https://data.ornldaac.earthdata.nasa.gov/public/gedi/GEDI_L4A_AGB_Density_V2_1/data/GEDI04_A_2023075201011_O24115_02_T08796_02_003_01_V002.h5.sha256"
  },
  "gov/protected/gedi/GEDI_L4A_AGB_Density_V2_1/data/GEDI04_A_2023075201011_O24115_02_T08796_02_003_01_V002": {
    "href": "https://data.ornldaac.earthdata.nasa.gov/protected/gedi/GEDI_L4A_AGB_Density_V2_1/data/GEDI04_A_2023075201011_O24115_02_T08796_02_003_01_V002.h5",
    "type": "application/x-hdf5",
    "title": "Download GEDI04_A_2023075201011_O24115_02_T08796_02_003_01_V002.h5",
    "alternate": {
    }
  }
},

Filename from the href: GEDI_L4A_AGB_Density_V2_1/data/GEDI04_A_2023075201011_O24115_02_T08796_02_003_01_V002.h5

When a user does pin the content, we could pass the filename property into the name argument for pin/add. Doing so will be a nice quality of life update when the user runs the method pinned_list(name=True) as it will list out the link name along with the cid

SethDocherty commented 5 days ago

This comment is also related to this issue.