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 matlab.io.hdfeos.*
% Open the HDF-EOS2 Grid file.
FILE_NAME='MCD19A2.A2010010.h25v06.006.2018047103710.hdf';
file_id = gd.open(FILE_NAME, 'rdonly');
% Read data from a data field.
GRID_NAME='grid1km';
grid_id = gd.attach(file_id, GRID_NAME);
DATAFIELD_NAME='Optical_Depth_055';
[data, lat, lon] = gd.readField(grid_id, DATAFIELD_NAME, [], [], []);
In short, I am looking for a pyhdf/python equivalent for gd.readField of MATLAB package
HDF-EOS Tools and Information Center Help was so nice to provide a script to deal with grid definition. This can be found here. In case the link is not working, here is the code: