Dear All,
I have a .h5 file that I can correctly open with SNAP.
However when I try to open it with snappy using this code it doesn’t work:
import os
import snappy
from snappy import ProductIO
from snappy import GPF
from snappy import jpy
from snappy import ProductUtils
images_directory = “C:/…/SMAP/test”
for subdir, dirs, files in os.walk(images_directory):
for filename in files:
if filename.endswith(".h5"):
image_path = os.path.join(images_directory,filename)
SMAP_image = ProductIO.readProduct(image_path)
WKTReader = snappy.jpy.get_type('com.vividsolutions.jts.io.WKTReader')
wkt="POLYGON((-80 43, -87 43, -87 33, -80 33,-80 43 ))"
geom = WKTReader().read(wkt)
HashMap = jpy.get_type('java.util.HashMap')
GPF.getDefaultInstance().getOperatorSpiRegistry().loadOperatorSpis()
parameters = HashMap()
parameters.put('copyMetadata', True)
parameters.put('geoRegion', geom)
SMAP_image_subset = GPF.createProduct('Subset', parameters, SMAP_image)
ProductIO.writeProduct(SMAP_image_subset, image_path+'_florida', 'NETCDF4-BEAM')
This is the error message that i get:
95727 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 72 at filePos 21865640
95727 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 68 at filePos 21865641
95743 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 72 at filePos 21865640
95743 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 68 at filePos 21865641
95743 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 72 at filePos 21865640
95743 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 68 at filePos 21865641
95760 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 72 at filePos 21865640
95760 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 68 at filePos 21865641
95765 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 72 at filePos 21865640
95765 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 68 at filePos 21865641
95765 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 72 at filePos 21865640
95765 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 68 at filePos 21865641
95781 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 72 at filePos 21865640
95781 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 68 at filePos 21865641
95781 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 72 at filePos 21865640
95781 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 68 at filePos 21865641
95796 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 72 at filePos 21865640
95796 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 68 at filePos 21865641
95796 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 72 at filePos 21865640
95796 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 68 at filePos 21865641
95812 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 72 at filePos 21865640
95812 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 68 at filePos 21865641
95812 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 72 at filePos 21865640
95812 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 68 at filePos 21865641
95827 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 72 at filePos 21865640
95827 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 68 at filePos 21865641
95827 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 72 at filePos 21865640
95827 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 68 at filePos 21865641
95827 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 72 at filePos 21865640
95843 [main] ERROR ucar.nc2.iosp.hdf5.H5header - bad version 68 at filePos 21865641
WARNING: org.esa.snap.dataio.netcdf.util.MetadataUtils: Missing configuration property ‘snap.dataio.netcdf.metadataElementLimit’. Using default (100).
How can I solve this problem ?
Thank you
Fabiano