-1

OSError: Unable to open file (file signature not found) My code

I feel that the problem is .hdf file as I don't have .h5 or .hdf5 file. So how to I open .hdf in python?

Aniket
  • 9
  • 1
  • Please do not include images of code. Paste the code directly instead! https://idownvotedbecau.se/imageofcode – Raphael Jun 01 '22 at 11:41

1 Answers1

2

You can check if the file is HDF4 format with this program:
https://www.hdfgroup.org/downloads/hdfview/

HDF4 files can be opened in python according to this tutorial:
https://hdfeos.org/software/pyhdf.php

from pyhdf.SD import SD, SDC

file_name = 'thefilename.hdf'
file = SD(file_name, SDC.READ)

print file.info()
Raphael
  • 810
  • 6
  • 18