Converting multiple S3 bands to GeoTIFF

Hi,

What is the best way to convert S3 bands to multiple GeoTIFF files via GPT? If I save as GeoTIFF I get one file with multiple bands in it. This is OK, except that they are just named “Band_1, Band_2”, etc. I’d like to have one band per file and have the filename be descriptive (e.g. Oa01.tif, Oa02.tif, etc.)

It seems like I need to reproject first, but then I’m not sure what to do… I can’t use the “Stack-Split” operator unless I first create a Stack. I’m not sure how to use CreateStack. If I have:

  <masterBands>Oa01_reflectance</masterBands>
  <sourceBands>Oa04_reflectance,Oa06_reflectance</sourceBands>

I get an error:

Please select at least two source products
 done.
Error: [NodeId: CreateStack] Please select at least two source products

I could generate a large XML file with multiple WRITE nodes, but that does not seem efficient. Still, is that the best way to do this?

Thanks,

-k.

I have had some success outside of GPT. I produce a multi-band GeoTIFF from GPT and then use

gdal_translate -b 3 -co "COMPRESS=DEFLATE" all.tif b3.tif

To extract, for example, band 3. It would be nice to do this in a way where I was certain that the GeoTIFF Band_3 corresponded band X in the original input. That info appears somewhat lost.

A new problem arises - I want SZA, which is not a “band” but instead some meta-data. The Reprojector operator produces an SZA with the same size, pixels, etc. as the bands if I <includeTiePointGrids>true</includeTiePointGrids>. However, the TIF files is now > 4GB and GPT crashes when it tries to write it to disk.

I can <includeTiePointGrids>true</includeTiePointGrids> and write a NetCDF, but I am not able to convert the NetCDF to GeoTIFF while keeping the reprojected EPSG information.

Is there any way to get the Sentinel 3 Bands + SZA + OZA, reprojected, into GeoTIFF format, in a standard GeoTIFF that includes the projection information?

I’ve put together a graph which reprojects the source and writes out single GeoTIFF files.
S3ToSingleTiffs.xml (1.6 KB)
In the header of the file, I’ve added an example gpt command.

In the example, only two bands are written, but you can duplicate and adapt the BandSelect and Write operator for each band you would like to have as output.
As reprojection CRS I’ve used an automatic polar stereographic projection (AUTO:97002). This one works only in the SNAP6 preview. If you define a different CRS it should also work in SNAP 5. SNAP6, in general, supports some more CRS.

1 Like

Hi Marco,

Thanks for the GPT XML file. I was worried that this was what needed to happen, but it isn’t very problematic. Just a bit awkward for 21 bands. I have achieved the same result several other ways, using stacked GeoTIFFs and then separating bands in a loop with GDAL, or NetCDF -> GeoTIFF, etc.

But I can’t get the SZA data on the GeoTIFF grids. BandSelect doesn’t work with SZA, because it isn’t a “band”. Is there some way to write out an SZA GeoTIFF?

Thanks,

-k.

After reprojection and including the tie-points it should be a band.
This graph works.
S3ToSingleTiffs.xml (2.0 KB)

Without reprojection you could use BandMaths in order to convert the tie-point grid into a band
band name: sun_zenith
expression: SZA

1 Like

Hi Marco,

I’m not sure why I was unable to extract the SZA band before. Maybe I was doing it before the Reproject and therefore it wasn’t a real band? Not sure. Anyway, this works now. Thank you! I’ll post the current workflow in the GPT workflow forum.

2 Likes

Yes, reproject converts virtual bands to real ones.