Generating OLCI PNG images with definite lat/lon center


I am generating Sentinel-3 OLCI True Color images. My question is if it is possible to generate resulting RGB image with definite lat/lon center using SnapPy. Let me explain:

On SHMI (Slovak Hydrometeorological Institute) we produce satellite RGB images in Albers Equal Area projection with definite center latitude / longitude. Every product is projected into predefined area and then we place transparent borders and shorelines on top of it. Here is an example of True Color image from Suomi-NPP.

What I want to do:

  • generate RGB image with defined center latitude / longitude area using SnapPy
  • place the resulting image into predefined area (like in an example above), while cutting out parts of image not overlapping with our predefined area

What have I tried ?

I generated images using Albers Equal Area with reproject, while setting parallels . After saving image as PNG, I always get to save the whole, reprojected scene. As I mentioned above, that is not what I wanted to do. I need an RGB image’s size always to be generated with definite lat/lon center so the data would ,move" depending on it’s latitude and longitude.

Ask me a question if something is uncertain.

You should save the RGB as GeoTiff. A png has no knowledge about geo-location and no means to store it. You could manually create a world file. This is not written by SNAP but the necessary information to create it can be retrieved with SNAP.

Thanks for advice. Actually, I don’t need resulting image to have a geolocation information. I just want the resulting image to look like this:

So I am looking for a solution, where I would have set up the center lat/lon of resulting image. Maybe there is a view region export implemented in Snappy ?

So while working with the data I came into conclusion. When I reproject data manually in SNAP GUI, the reprojected image will have EASTING/NORTHING stored in metadata. With this information, I can create new array with definite size (lets say 3000x4000 px) and copy my image to new, larger array. Using easting/northing, I can ,move" the image and set the X/Y offset of the beggining of coordinate system. So my problem could be potentially solved.

However, when I reproject the data with snappy (not manually with GUI) I will get to a point when there is no information about easting/northing in metadata.

My code for reproject:

def reprojection():
    for file in glob.glob("*.dim"):
        product = ProductIO.readProduct(file)
        name = product.getName()
        band_names = product.getBandNames()
        cas = product.getStartTime()
        casParsnuty = datetime.strptime(str(cas),'%d-%b-%Y %H:%M:%S.%f')
        wktFilee = '/home/lubomir/Desktop/albers.wkt'
        print ("Starting reprojection...")
        parameters = HashMap()
        parameters.put('crs', wktFilee)
        parameters.put('orientation', 0)
        parameters.put('pixelSizeX', 2000.0)
        parameters.put('pixelSizeY', 2000.0)
        parameters.put('noDataValue', NaN)
        result = GPF.createProduct('Reproject', parameters, product)
        print ("Reprojecting data ...")
        ProductIO.writeProduct(result, '/home/lubomir/Desktop/Sentinel3_OLCI/reprojected/reproj_' + 
        casParsnuty.strftime("%Y%m%d_%H%M"), 'BEAM-DIMAP')
        print ("Done.")

When I write code like this, snappy only works with WKT file. It doesn’t account pixelSizeX/Y nor any other parameter.

Is it somehow possible to set Preserve resolution to be “False” in snappy ? Is it somehow possible to chose the reference pixel to be at scene center in snappy ? These functions are available in SNAP GUI but seem to be missing in snappy. Maybe I can manage to set these parameters in WKT file ?

These are my settings while reprojecting with SNAP.