S1 Product Unique Identifier Calculation

Hello, I would like to better understand how the Product Unique Identifier is calculated for Sentinel-1 SLC products. According to the Sentinel-1 Product Specification, this identifier is calculated by computing the CRC16 checksum of the manifest.safe file as a hexidecimal. I have tried to re-compute the checksum for a Sentinel-1 product that I know is unaltered, but I get a very different identifier than the one specified for the product.

Here is the python code I am using:

import zipfile
from binascii import crc_hqx

import asf_search


granule = 'S1A_IW_SLC__1SDV_20240330T170607_20240330T170634_053214_0672CD_80A9'
results = asf_search.granule_search(f'{granule}-SLC')
results.download(path='.')

with zipfile.ZipFile(f'{granule}.zip', 'r') as zip_ref:
    with zip_ref.open(f'{granule}.SAFE/manifest.safe', 'r') as f:
        data = f.read()

crc_dec = crc_hqx(data, 0)
crc_hex = format(crc_dec, '04X')
print(f"Calculated CRC16 checksum ({crc_hex}), does not match product ({granule.split('_')[-1]}).")

Can anyone give me guidance one how to correctly calculate the Product Unique Identifier? Thanks!

Try this:

crc = crc_hqx(data, 0xffff)
p_id = '{:04X}'.format(crc & 0xffff)
print(p_id == granule[-4:])

Thank you @johntruckenbrodt, with your modifications I can now correctly compute the identifiers!

1 Like