PyHDF is a Python interface to the HDF4external library. It covers most functions of Scientific Data Sets (SD API), Vdatas (VS API), and Vgroups (V API). PyHDF is not merely a wrapper of HDF4 C API. PyHDF exploits Python features such as the OOP concept and exception handling to make it more convenient.
Questions tagged [pyhdf]
27 questions
0
votes
1 answer
How to read location coordinates of MODIS HDF file with Python GDAL?
I am trying to read a MODIS HDF file with Python. I have used GDAL and pyhdf libraries. However, I am unsure why GDAL is unable to read location coordinates whereas pyhdf can read the same easily.
Following is the simple python code.
from pyhdf…

Puneet Verma
- 19
- 2
0
votes
2 answers
Failing to build pyhdf
I have been trying to install pyhdf however I get this error message which I can't seem to find the solution to.
ERROR: Command errored out with exit status 1:
command: /project/InSAR/user1/venv/test/bin/python…

Linux Penguin
- 23
- 1
- 4
0
votes
1 answer
Install PyHDF on CentOS7
Please help,
I am having trouble to install pyhdf on CentOS7. I should say, I am a newbie to linux
Pyhdf needs HDF to be installed and so far I've tried the following:
first install HDF with ./configure, gmake && gmake check. However, check exit…

ermaure
- 196
- 3
- 6
0
votes
2 answers
Genrate grid information file from MODIS HDFEOS data
Is there a way to generate grid information (lat-lon) from the MODIS MCD19A2 files in python?.
The file is downloaded from
Link to the data file
.In MATLAB it can be done using the following block code
import matlab.io.hdf4.*
import…

Vinod Kumar
- 1,383
- 1
- 12
- 26
0
votes
1 answer
How to deal with the different type of np.array(list) in py2 and py3 when using pyhdf?
I want to save something as variable in hdf by pyhdf.
This is my code:
import numpy as np
from pyhdf.SD import *
var = 'PRESSURE_INDEPENDENT_SOURCE'
vartype = 4
hdf4 = SD('./a.hdf', 2 | 4)
dset = hdf4.create(var, vartype, (1,13))
a =…

zxdawn
- 825
- 1
- 9
- 19
0
votes
2 answers
NotADirectoryError: [WinError 267] The directory name is invalid: 'C:\\Users\\username\\MYD06_L2.A2008001.0000.006.2013341193524.hdf'
I am using Windows 10 and running the code in Jupyter Notebook (in Chrome).
This is my code:
if __name__ == '__main__':
import itertools
MOD03_path = r"C:\Users\saviosebastian\MYD03.A2008001.0000.006.2012066122450.hdf"
MOD06_path =…

Savio Kay
- 11
- 1
- 4
0
votes
1 answer
HDF4Error: SD (59): HDF Internal error
I am trying to download a hdf file and read it python as follows
from pyhdf import SD
file = open("temp.hdf", 'w')
ftp.retrbinary('RETR '+ filename, file.write)
file.close()
hdf=SD.SD('temp.hdf')
It works but soon after the I am getting the…

Abhijay Ghildyal
- 4,044
- 6
- 33
- 54
0
votes
0 answers
how to combine numpy ndarray?
I have MODIS atmospheric product. I used the code below to read the data.
%matplotlib inline
import numpy as np
from pyhdf import SD
import matplotlib.pyplot as plt
files = ['file1.hdf','file2.hdf','file3.hdf']
for n in files:
hdf=SD.SD(n)
…

bikuser
- 2,013
- 4
- 33
- 57
0
votes
0 answers
Spyder iPython console crashing in a long program
My program could possibly take up to four hours to run through all of the satellite data that I am trying to read. I have ensured that the code works correctly when I read in a full year of data and save only a few areas worth of data. However, when…

Jason
- 181
- 2
- 14
0
votes
1 answer
What's the correct way of using reduceByKey in Spark using Python
I'm new to apache spark and don't know if I'm misunderstanding reduceByKey or am encountering a bug. I'm using the spark-1.4.1-bin-hadoop1 build, due to
issues with the python Cassandra interface in spark-1.4.1-bin-hadoop2.
reduceByKey(lambda x,y:…

Peter
- 31
- 6
0
votes
1 answer
Read Specific Z Component slice of 3D HDF from Python
Does anyone know how to make the modification of the following code so that I can read the specific z component slice of 3D hdf data in Python? As you can see from the attached image, z value spans from 0 to 160 and I want to plot the '80' only. And…

Lawerance
- 131
- 6
0
votes
1 answer
Open file as a buffer in Python?
I have a compressed HDF file (HDF.Z) and would like to open it like that:
from subprocess import Popen, PIPE
f = Popen(['zcat', 'myfile.HDF.Z'], stdout=PIPE).stdout
In order to get the data I need to use pyhdf:
from pyhdf.SD import SD, SDC
mydata =…

HyperCube
- 3,870
- 9
- 41
- 53