Creating a cropped GRD from SLC using gpt

Are you saying Band Maths may create the ground points section, making it identical to the orginal geotiff? (and making my current code be able to read, without any changes)

When I make a band math this will end up in the bands section…

no, you are right that any band maths result will end in the band section not under tie-point grids. I thought that you simply need one lat and lon coordinate for the geocoded output. I don’t know how this is solved best in the code, sorry.
Maybe there is an easier way to achieve your overall aim? I’m still not clear why you need the tie-point grids as such.

Thanks for your persistent help. We use our own extraction code that’s why it won’t work if ground control points are missing. There are other ways to solve this, but we still need to update our code to look for corner coordinates if the ground points are missing.

The gpt output’ed geotiff saves all metadata in to a custom geotiff tag by id 65000, which is the first of any custom tags. This segment is XML and 7MB of size in my case. We would need to add XML parser module to fetch this which is one solution.

Is there any other way you know of to manually add another geotiff tag from SNAP, saving the corner coordinates in a simple format which would enable us to easily extract these?

Or, we could use the Band Maths functionality and save for every pixel the corresponding lat/long coordinate. This is how I interpreted your earlier advice by using the X and Y data…

I lean toward the Band Maths if there isn’t any other easy way to store the corner lat/long coordinates, as we don’t need to rely on the XML which may change.

maybe @marpet has an idea here

Managed to gpt batch create a three band, cropped TC’d geotiff by adding three entries under the BandMaths targetBands section.

Didn’t not use the X and Y expression as it seems to store the pixel value, instead used LAT and LON to fetch the pixel position, right?

grd2geotiff.xml (4.6 KB)

The cropped image is a bit clipped at left side, not sure if this is expected or how I can fix it?

oh, right! X and Y are the pixel coordinates.

If you did the subset before terrain correction, it has maybe clipped too much because the image was not rotated yet. Please have a look at Marco’s explanation on this. S3-OLCI Subset Issues
I would slightly increase the subset area to go sure.