HDF5 files can be read in Python using the netCDF4 package's Dataset object. For this particular file, the latitude data appears to be stored in the path "INS/Latitude"; similarly, the longitude data is stored in "INS/Longitude". I have written a small script (see the attachment) to demonstrate how to access the data and store it as a numpy.ndarray object. Let me know if you have any questions.
Dear Erick Edward Shepherd , Thanks for your kind reply and the efforts you have taken. I used your code to read the latitude, longitude and insolation values from the hdf file. Please refer the attached image.
My purpose is to find the insolation for a particular latitude and longitude.
Say for example latitude = 45.5, longitude = 105.3751, Insolation=??? . How do I do that?
I am looking for something similar to the one shown in below link, but that example code in below link doesn't seem to work for me. https://www.researchgate.net/deref/https%3A%2F%2Fgis.stackexchange.com%2Fquestions%2F261061%2Fextract-value-for-a-given-coordinate-from-hdf5-file
Dear Thieu Nguyen , Thank you very much for your reply and the links. I tried to modify the code in the example for my application, but I couldn't figure out what could be the problem. Refer attached image showing my output. I wanted to display the insolation data for that particular latitude and longitude but my output shows null value.
I am glad my earlier example was helpful! To address your follow-up question, the simplest solution for selecting an insolation value at a particular location is to use a mask.
A mask is a boolean array used to index another array. When indexing an array with a mask, a new array (or view of the array) is produced. The resulting array only contains those values of the original array where the mask was True. In numpy and related Python packages (such as pandas), you can produce a mask by performing a comparison operation on an array: usually the original array, or another related array of the same shape.
As an aside, I noticed that the data you are working with seems to be the same shape throughout. It may prove more convenient for you to integrate some pandas into the processing. I have attached demos of the data masking in both numpy and pandas.