stactools-packages / threedep

stactools package for working with elevation data from the USGS 3DEP program (formerly known as NED)
Other
3 stars 4 forks source link

stac threedep create-catalog trying to generate 1/3 second item metadata for items that only exist in 1 second collection #14

Closed hrodmn closed 1 year ago

hrodmn commented 1 year ago

I recently tried generating the STAC metadata using stac threedep create-catalog /tmp/threedep_catalog but hit an error while generating the 1/3 arc-second items:

FileNotFoundError: https://prd-tnm.s3.amazonaws.com/StagedProducts/Elevation/13/TIFF/current/n15w093/USGS_13_n15w093.xml

After digging around a bit I found the root cause in commands.py: https://github.com/stactools-packages/threedep/blob/main/src/stactools/threedep/commands.py#L63-L69

If you don't provide any asset_ids to the cli script, asset_ids gets created by utils.fetch_ids(product) when running the 1 second collection (product = 1). Then when the loop cycles to product = 13, the asset_ids variable exists so we don't run utils.fetch_ids(product) again. Maybe this used to work but there are some IDs in the 1-second collection that are not present in the 1/3-second collection which causes the FileNotFoundERror.