Export NetCDF to GeoTIFF SNAP 8 and snappy don't create working files

I downloaded an Atmosphere product and i tried to export it into a GeoTiff-BigTiff /GDAL-GeoTiff/GeoTiff through snappy and SNAP 8 and in both ways the resulted product has problems:

SNAP 8
The file Exported or Reprojected in GeoTiff (File > Export > GDAL > GeoTiff or File > Export > GeoTiff/GeoTiff-BigTiff or File > Raster > Geometric > Reprojection) format lose geolocation and part of the data in the various bands

snappy code
I used this code to export:

parameters_export = snappy.HashMap()

parameters_export.put('clearCacheAfterRowWrite','false')

parameters_export.put('deleteOutputOnFailure','true')

parameters_export.put('file', output_name_file_noformat)

parameters_export.put('formatName','GeoTIFF-BigTIFF') # NetCDF4-CF BEAM-DIMAP GeoTIFF-BigTIFF

parameters_export.put('writeEntireTileRows','false')

export_product = snappy.GPF.createProduct('Write', parameters_export, file_nc)

If i write GeoTiff-BigTiff the output has 0k dimention and can’t be open both in SNAP or QGIS, if I try to export in BEAM-DIMAP file it can be open the product in SNAP but the bands can’t be open in image view.

What am I doing wrong?

My env in anaconda:
snap.yaml (4.7 KB)

Thanks

You should mention your platform and SNAP8 update status.

What is the source of the NetCDF files? Many NetCDF files work well with recent QGIS and ArcGIS versions. GeoTiFF omits some metadata that can be preserved using NetCDF so I prefer NetCDF. I have seen problems with NetCDF files that don’t follow the CF conventions (e.g., pixel+line dimensions where longitude and latitude are expected) or use internal compression methods that are not universally supported. There are tools (CDO and NCO) that can be used to repair such files (renaming coordinates, changing compress method, etc.) efficiently. You can examine the NetCDF file metadata in SNAP or using ncdump -h <filename>, HDFview, Panoply, and other tools.

From your snap.yaml you appear to be using python 3.6 and similarly outdated qgis, etc. Many things that used to require snappy can now be done more efficiently and reliably with gpt. You may find that your NetCDF files are acceptable to a current QGIS version.

2 Likes

Thanks for your fast answer! I’m working on Windows 11 and SNAP 8.0.9 (JRE: OpenJDK Runtime Env 1.8.0_242-b20). The nc file source is Copernicus Atmosphere ( CAMS European air quality forecasts (copernicus.eu) and it follow NetCDF-BEAM standard. Snappy require python 3.6 for compatibility and consequentially i have to use outdate packages… about gpt, isn’t it a part of snappy?

However i followed your suggestion and I installed the newest version of QGIS and it handle easly the export of .nc, even with NetCDF-BEAM standard, in GeoTIFF!! Thanks so much!

Glad you got QGIS to handle the NetCDF files.

I wouldn’t expect people who have snappy working with Python-3.6 to notice, but
the Configure Python to use the SNAP-Python (snappy) interface page has been updated to include:

I removed Python 3.6 from my systems after configuring snappy to use Python-3.8, but have not been using snappy for anything beyond basic checks. I do, however, think enough people are using Python 3.8 from the above link that it can’t have many problems.

As you found, the remote sensing ecosystem is changeable, so there are often conflicts between older workflows and new or updated products and security fixes.

1 Like