Strange results when running graph and writing to GeoTiff

Hello @marpet,

I am working on a project related to land cover classification. I use Support Vector Machine (SVM) as classification algorithm. In order to improve the results, i also incorporate texture analysis (GLCM) into my code. Due to the fact that texture analysis is so slow using python, i decided to take advance of GPT in SNAP for performance purposes. So, for automating the whole classification pipeline, i created bash script which calls the SVM python script and the GLCM-PCA graph i constructed using SNAP (first GLCM-PCA is calculated using the graph and the results of GLCM are fed into the classifier).

The problem is the following:
I need the final GLCM results to be in GeoTIFF format (so that it can be loaded into my python code) as i set up my algorithm to work with data of that format. So, in the graph shown bellow change the formatNameinto GeoTIFF format.

Once, i run the graph, it works fine and i get the following results.

We see that, i tried three different format outputs. All formats work fine apart from geotiff. When loading the final GLCM (geotif) file into SNAP i get the image shown on the far right. I do not know whether anyone has come across with a similar issue.

So, someone might ask, why do not you use any of the other two formats?

  • NETCDF: firstly, my code has been set up to use geotiff format where i am more familiar with (it’s not huge problem to switch to netcdf I guess)
  • Big GeoTIFF: big geotiff produce files of larger size compared to geotiff. I would like to keep the size of the files to the minimum.

thanks

That happened to me too! I just used GeoTIFF-BigTIFF

Right, I am just hopping that, there might be a solution to that. Otherwise, i will have to use Big GeoTIFF

Tiff is an uncompressed image file format that rapidly becomes big with large areas. In addition, Tiff files are limited to 4Gb maximum. Maybe that causes your issue?

Yes, tiff format is limited to 4GB as you mentioned.
When i do the whole process manually in SNAP and export the file in geotiff, the size of the raster is 500MB.
So, my raster size is not as big

I only get these weird results when using the graph to automate my pipeline and specify 'geotiff` format on the write operator

1 Like

This is really a strange result.

Actually the size should not in crease when switching to BIG-GeoTIFF, at least not much. And for Big-GeoTiff compression can be enabled.
If you want to try it, add

snap.dataio.bigtiff.compression.type=LZW

to the snap.properties file in the etc folder of the SNAP installation directory (You need admin rights).

Back to your GeoTiff problem:
Can you send me the input you use with your graph?
Then I can try to reproduce it.
I’ll send you a PM where you can upload it to.

I would like to report my experience in saving geotiff which produces a similar result of bad displaying in SNAP 7, which displays multiple repetitions of the real image.
I did some testings and to me this happens only when I save as GeoTIFF or GeoTIFF+XML an image with 9 bands (I tested from 5 to 10 bands). If I read the image with other software (e.g. QGIS or with gdal) it displays correctly, so it seems an error in SNAP reading the GeoTIFF.
However if I save in BigIFF format, the problem doesn’t occur (but it seems to be slower).