Write a TiePointGrid to a S3 product


TL;DR: how do I build a TiePointGrid in snappy?

Hi all,

I’m struggling a little with the SNAP API.

I am trying to modify a TiePointGrid (SZA) in a Sentinel 3 OLCI scene for some testing purposes. I need it to be a TiePointGrid because the operator I use in the next step reads in the TiePointGrid. Therefore I cannot follow the easy path of converting it to a band.

Until now I have managed to open the Product and read in the TiePointGrid as a numpy array on which I can do as such:

 sza = prod.getRasterDataNode("SZA")
 height = prod.getSceneRasterHeight()  # Product band height
 width = prod.getSceneRasterWidth()  # Product band width

# Create array of zeros
array = np.zeros((height, width), dtype=np.float32)

# Read values into the array
szaraster = sza.readPixels(0, 0, width, height, array)

I use prod.getRasterDataNode, because I cannot access the array if I use prod.getTiePointGrid (see my comment in this post).

From what I read on this forum, I believe it’s better to create a new product and write to that one. I am able to do this with bands, however I can’t figure out how to create a TiePointGrid to add to the product.

I would like to create a new raster by performing operations on the szaraster variable shown above. Then write the raster to a TiePointGrid, that I would add to the new Product. How do I build this?

All the best!