Write NetCDF4-CF with GPT graph variables/parameters

I am calling a GPT graph
fuGraph_nc.xml (2.9 KB)
via cmd through a Python script
gpt_processing_cmd.py (1.8 KB)
to calculate Forel-Ule using Sentinel-3 data which I want to export as a NetCDF4-CF format. I have been struggling to determine the variable format for the output. It does not recognise the file output that I am passing it and it worked before. What form do I need to use, please? I am using SNAP 8 and I also tested these examples here fileTarget or target examples from here: SNAP - Guide for CWL in Earth Observation Any help is much appreciated!

I would suggest comparing a print statement of the “command” variable before running “subprocess” and then try running that in the CMD and see if it works. I’m guessing the string combination isn’t working the way you expect?

But you mention it worked before, what changed?


In your case you are missing parameter.
You are using ${out} variable in the writeop. This needs to be set.
Instead of -t targetpath use -Pout=targetPath.
The -t adds automatically at a new write operator at the end of a graph.

1 Like

Hi Marpet, thank you very much for your answer, this worked really well (including the CRS). I also wanted to ask, can I pass any parameter in the graph above so it only exports FU.img and FU.hdr. Below shows what I mean in the files:

You can add a subset operator before the write operator. There you can specify the bands you want. Sometimes it is not possible to limit the output to a single band, because other bands are needed for the geo-coding or the valid expression.
But in your case, it should work.