MODIS Terra HDF4 EOS2 to GeoTIFF conversion problems with reprojection
Posted: Thu Jul 20, 2023 7:54 am America/New_York
I've tried various methods, including Java HEG, to convert the HDF4 to GeoTIFF, but unfortunately, all attempts have been unsuccessful. I'd greatly appreciate any assistance.
Specifically, I'm working with the MODIS/Terra Net Primary Production Gap-Filled Yearly L4 Global 500 m SIN Grid data, which I downloaded from EARTHDATA SEARCH: [https://search.earthdata.nasa.gov/search/granules?p=C2565791034-LPCLOUD&pg[0][v]=f&pg[0][gsk]=-start_date&g=G2618460187-LPCLOUD&q=MODIS/Terra%20Net%20Primary%20Production&tl=1688633846!3!!&lat=34.488093407526456&long=36.1845703125&zoom=5].
Using this file as an example: MOD17A3HGF.A2022001.h21v05.061.2023035051527. I attached the JPG representation as "JPG representation".
For example, using the Java HEG application with default settings, the resulting GeoTIFF ("rioxarray HEG TIFF") appears incorrect and does not accurately represent the data.
I also attempted a Python approach, and you can find my code in this Google Colab notebook: [https://colab.research.google.com/drive/1blh5JI5YE0TdsP09x8GKzv4qmjXVFaFz?usp=sharing]. The code involves reading the HDF file with pyhdf, extracting bounding coordinates, cleaning no data values, generating a coordinate mesh, and then trying to reproject and plot the data.
However, I cannot fit the data to a map (see "Python plot") and (I believe) this originates from either adding coordinates, re-projecting, plotting, or a combination thereof.
If anyone can provide assistance or insights, it would be greatly appreciated. Thank you very much in advance!
Specifically, I'm working with the MODIS/Terra Net Primary Production Gap-Filled Yearly L4 Global 500 m SIN Grid data, which I downloaded from EARTHDATA SEARCH: [https://search.earthdata.nasa.gov/search/granules?p=C2565791034-LPCLOUD&pg[0][v]=f&pg[0][gsk]=-start_date&g=G2618460187-LPCLOUD&q=MODIS/Terra%20Net%20Primary%20Production&tl=1688633846!3!!&lat=34.488093407526456&long=36.1845703125&zoom=5].
Using this file as an example: MOD17A3HGF.A2022001.h21v05.061.2023035051527. I attached the JPG representation as "JPG representation".
For example, using the Java HEG application with default settings, the resulting GeoTIFF ("rioxarray HEG TIFF") appears incorrect and does not accurately represent the data.
I also attempted a Python approach, and you can find my code in this Google Colab notebook: [https://colab.research.google.com/drive/1blh5JI5YE0TdsP09x8GKzv4qmjXVFaFz?usp=sharing]. The code involves reading the HDF file with pyhdf, extracting bounding coordinates, cleaning no data values, generating a coordinate mesh, and then trying to reproject and plot the data.
However, I cannot fit the data to a map (see "Python plot") and (I believe) this originates from either adding coordinates, re-projecting, plotting, or a combination thereof.
If anyone can provide assistance or insights, it would be greatly appreciated. Thank you very much in advance!