fhs / pyhdf

Python wrapper around the NCSA HDF version 4 library

Home Page:https://pypi.org/project/pyhdf/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Raster image API is not implemented

jefflapierre6 opened this issue · comments

TRMM_LIS_SC.04.3_2015.001.zip
I will start by saying that this is my first github post, so I apologize for my naivety, especially if this is not the right place for this post.

I am writing to see if anyone can possibly provide some insight on a problem I am having with loading some HDF4 data using python. I thought I had installed the python-hdf4 library as well as all the dependencies correctly (I didn’t get any errors). I followed the install instruction on the python-hdf4 page, namely:

apt-get install python-dev python-numpy libhdf4-dev -y
pip install python-hdf4

Seemed fairly straightforward. However, when I load in the data, using

from pyhdf.SD import SD, SDC
Hdf = SD(FileName, SDC.READ)

, the dataset is empty. I have checked in Matlab that there is actually data in the files.

I assume it has something to do with the dependencies, but since I am not getting any errors, it may be difficult to diagnose. I have tried uninstalling and reinstalling all of the above libraries. I hope I am missing something.

I have attached an example file so that you can test it yourself.

Thank you in advance for your help.

The file contains a raster image, not scientific data (SD). It doesn't look like pyhdf provides the raster image API from the C library. See https://support.hdfgroup.org/release4/examples/ug-examples.html#gr

$ unzip TRMM_LIS_SC.04.3_2015.001.zip 
Archive:  TRMM_LIS_SC.04.3_2015.001.zip
  inflating: TRMM_LIS_SC.04.3_2015.001.97563  
$ file TRMM_LIS_SC.04.3_2015.001.97563
TRMM_LIS_SC.04.3_2015.001.97563: Hierarchical Data Format (version 4) data
$ hdp dumpsds -h TRMM_LIS_SC.04.3_2015.001.97563
File name: TRMM_LIS_SC.04.3_2015.001.97563 
$ hdp dumpgr -h TRMM_LIS_SC.04.3_2015.001.97563
File name: TRMM_LIS_SC.04.3_2015.001.97563 

	 Image  Name = Raster Image #0
	 Index = 0
	 Type= 8-bit unsigned char
	 width=720; height=500
	 Ref. = 509
	 ncomps = 1
	 Interlace mode= PIXEL
	 Palette: 3 components; 256 entries
	 Compression method = RLE
	 Number of attributes = 0
$