Convert to geotiff using command line (SLSTR product)

Hi
I am new to this forum and don’t know much about the data. I want to convert SLSTR data to geotiff file band wise( 1 image for each band). i want to use the command line tool to achieve this. Can anyone please let know the process/commands to perform this operation.

Thanks
Ashish

What i am trying to achieve is , … i have a region of interest( with 4 corner lat/long) i just want to grab data from that region using command line.

you could create an xml file which defines these steps (using the graph builder) and then call it from the command line naming the source and target product:

command to call:
gpt s3_GeoTiff.xml -Psource=C:\temp\S3\S3A_SL_1_RBT____20170411T100524_20170411T100824_20170609T204436_0179_016_236_2160_LN2_O_NT_002.SEN3\xfdumanifest.xml -Ptarget=C:\temp\S3\output.tif

or abstract:
gpt graph-file.xml -Psource=infile -Ptarget=outfile

It is important that the folder of the S3 file stays the same.

s3_GeoTiff.xml (1.9 KB)

1 Like

I once explained it for Sentinel-2


It is pretty similar to your use case. Just add the subset step.

This can be opened as another thread but here is the problem while converting to geotiff.

So first i tried to convert whole s7_bt_in image to bigtiff (successful). Then I opened the converted image in envi, compared the latlong with original image opened in snap. For the same place, envi shows different latlong to snap.myGraph.xml (1.3 KB)

Hello,

I would like to export a .dim file as GeoTiff. I created an XML but it just doesn’t work. Could anyone help me fix it?

Best wishes,
Julioexport_test_help.xml (711 Bytes)

the xml structure was somehow faulty, the indention with tabs didn’t work.
Please try this one: dim2tif.xml (709 Bytes)

In case you didn’t know: You can create workflows in the graph builder and then save them as a xml file

Dear Andreas,

Thank you for your reply. I created the xml in the graph builder and it worked fine. Then I used the same xml to run it from CMD and I got the error message:
Error: [NodeId: Read] Operator 'ReadOp': Unknown element 'sourceProduct'
I do not understand why it would work on SNAP but then it would not work on CMD. Please see the xml attached: dim_to_tif_test_02.xml (837 Bytes)

Any advice to correct it the xml is welcome.

Best wishes,
Julio

Edit:
What I did on CMD was simply gpt G:\project\gpt_xml_templates\dim_to_tif_test_02.xml

If you specify the source product in the XML, the graph should work without any additional parameters. @marpet Can you tell what is wrong with the suggested XML?

If you leave the input product as a paceholder, you will have to tell the GPT command which one is your input product.
It is nicely documented here: https://senbox.atlassian.net/wiki/spaces/SNAP/pages/70503590/Creating+a+GPF+Graph

Have a look at this introduction: https://seadas.gsfc.nasa.gov/docs/gpt_introduction.pdf

Dear Andreas,

Thank you for your prompt response. I understand the placeholder approach, it is intuitive and easy to implement in CMD. However, that has given me additional issues, I would prefer to have a working XML template then I produce it in loop in another programming language.

Regards,
Julio

I understand.

I once used scripts like this to automate gpt tasks by looping through different input files and operators. This should be also possible with a predefined XML.

Python_gpt.py (593 Bytes)

Dear @marpet,

Have you spot what can be improved from the XML?

Best wishes,
Julio

What was missing was the following section in the WriteOp

<sources>
   <source>Read</source>
</sources>

dim_to_tif_test_03.xml (627 Bytes)

Just for converting you don’t need a graph
This call should work too:

gpt Write -t G:\project\dim_to_tif_test_01.tif -f GeoTIFF G:\project\data\s3_gpt_binning_output\S3_L3_30dd_20160501_20160531_1km.dim

Only if you want to read some SLSTR data you should add a read operator and specify the format. As recently discussed here: