If condition in graph

Hi,
I need to write my final product on .tif file. Some of products are big and should be written in GeoTIFF-BigTIFF and some are small and can be written to GeoTIFF. In my graph, I put the output format to GeoTIFF-BigTIFF but it takes so much time even for small products. I am wondering is it possible to add if phrase for output format in the graph that checks output raw size and if it is more than 4G it puts GeoTIFF-BigTIFF and otherwise in GeoTIFF. It should be possible using snappy, though. But, I prefer using gpt since it is clearly faster than snappy in most of the operations.
this is my graph. Merge_graph.xml (1.8 KB)
Thanks in advance for your help

If you are looking at Python-based solution, I would recommend the snapista-wrapper. As the processing is done with gpt-calls there is no performance degradation as with snappy. In the near future we will provide snapista as an officially supported and maintained SNAP wrapper:

GitHub - snap-contrib/snapista: SNAP GPT thin layer for Python

SNAPISTA (snap-contrib.github.io)

2 Likes

Wow. Thank you so much.That seems very good. But, still my question persists. How I can add if condition to a graph expression. (using snapista or with manually on the text of graph). more specifically, How to check the output raw size in GB for that condition? is it possible at all?

In a graph no if condition can be used. There for you can use Python.
Also it not possible to get the outputsize.
But I think you could always use GeoTIFF-BigTIFF instead of GeoTiff. There should actually be no big difference in writing speed.

yeah I used python code. Actually, there is Product.getRawStorageSize() method in snappy. it seems it shows the raw data size. I am using it for the if condition in python code along with ProductIO.writeProduct. So, if , as you say, there are no method for getting outputsize, what is the getRawStorageSize() method showing?
Also I checked and it seems it is big difference in writing Geo and Geo-Big in time performance.

Maybe GeoTIFF is not suited to your use case. I find NetCDF4-CF has advantages over GeoTIFF for many purposes (due mainly to better metadata support, but also more compression options).

1 Like

I was referring to the capability to access the storage size in the Graph XML file.
Yes, this method can give you an estimate of the resulting file size but it doesn’t consider compression.
However, it might be sufficient for your case.

1 Like

Thanks so much