MODIS Terra HDF4 EOS2 to GeoTIFF conversion problems with reprojection

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
vanyabrucker
Posts: 1
Joined: Thu Jul 20, 2023 7:16 am America/New_York
Answers: 0

MODIS Terra HDF4 EOS2 to GeoTIFF conversion problems with reprojection

by vanyabrucker » 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!
Attachments
Python plot
Python plot
Screenshot 2023-07-20 at 13.44.18.png (107.97 KiB) Not viewed yet
rioxarray HEG TIFF
rioxarray HEG TIFF
Screenshot 2023-07-20 at 13.14.33.png (123.46 KiB) Not viewed yet
JPG representation
JPG representation
BROWSE.MOD17A3HGF.A2022001.h21v05.061.2023035051527.1.jpg (29.89 KiB) Not viewed yet

Tags:

LP DAAC - dgolon
User Services
User Services
Posts: 296
Joined: Mon Sep 30, 2019 10:00 am America/New_York
Answers: 0
Has thanked: 18 times
Been thanked: 2 times
Contact:

Re: MODIS Terra HDF4 EOS2 to GeoTIFF conversion problems with reprojection

by LP DAAC - dgolon » Tue Jul 25, 2023 9:26 am America/New_York

Hi @vanyabrucker If you are simply looking to convert and reproject the data I recommend accessing that data via AppEEARS: https://appeears.earthdatacloud.nasa.gov/ It will convert the data to a GeoTiff for you and you can select from a variety of projections to reproject the data.
Subscribe to the LP DAAC listserv by sending a blank email to lpdaac-join@lists.nasa.gov.

Sign up for the Landsat listserv to receive the most up to date information about Landsat data: https://public.govdelivery.com/accounts/USDOIGS/subscriber/new#tab1.

Post Reply