Hi All,
I’m using Snap6 to do C2RCC processing on S3 L1 scenes and write to NetCDF4-BEAM or NetCDF4-CF format files.
Problem:
I need to add attributes to these nc files afterwards. This is usually quite easy in python-NetCDF4: Open Dataset in r+ mode, setncattr(), close(), done.
However this does not work on these C2RCC processed files from SNAP (and other S3 nc products from SNAP).
I can open the file in python, add global attributes, but when I do sync() or close() I get:
Traceback (most recent call last):
File “”, line 1, in
File “netCDF4.pyx”, line 1554, in netCDF4.Dataset.close (netCDF4.c:21176)
RuntimeError: NetCDF: Can’t open HDF5 attribute
the file is closed, but the changes are not written. Despite adding attributes does not work, I can do delncattr() in python and delete an attribute from the file! Strange.
I’m pretty stuck at this point. I tried it with various files (subsets, converted nc files), but always get the same error.
I also tried python HDF5 and pure command line with NCO’s ncatted, all with the same error.
Question:
Has anyone successfully added data or metadata to nc files created by SNAP? Or does anyone know another way than described above to give a try?
I also tried snappy to do the C2RCC processing, but instead of taking 15 minutes in SNAP I killed the job after it was not further than 60% after 20 hours (config already optimised)… But thats another problem (maybe someone has a solution for why snappy is so slow?)
I dont really want to copy the content in python and write a new file. Thats too much IO stuff for just adding a few attributes.
Any ideas welcome, many thanks!
cheers
Daniel