HDF to TIF - error in rendering out the layer

162
3
07-15-2021 02:40 AM
nabsabt
New Contributor

Hi! I struggled a lot to convert a HDF file to TIF, so I can visualize it in ArcMap. Here is the code I used:https://www.programmersought.com/article/11974240079/  (the black-background code snip). When I ran the scriptin ArcMap python module, no error was thrown, and a new layer was added after, but incorrectly, I assume. All I can see is a black, vertical stripe, and the values are: "High: 3,40281e+038, Low: 0,500641". The HDF was downloaded from nsidc.org/data/ATL08. My goal (with forced due date) is to have a vegetation (canopy) height data model of my country. What did I do wrong? Maybe it's not georeferenced? 

0 Kudos
3 Replies
DavidPike
MVP Frequent Contributor

what about using the tool directly?

https://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/extract-subdataset.htm

or as per link example:

##Extract 3-band subdataset from HDF
arcpy.ExtractSubDataset_management("MHDF.hdf", "subds.tif", "5;6;7")
0 Kudos
nabsabt
New Contributor

If I just pull the .h5 file into ArcMap, and try this command in arcpy, it just throws a runtime error:

Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\management.py", line 14129, in ExtractSubDataset raise e ExecuteError: ERROR 999999: Error executing function. Failed to execute (ExtractSubDataset).

If I try to call in the file from library (by url), it throws server error:

Background server threw an exception.

 

0 Kudos
JayantaPoddar
MVP Esteemed Contributor

Keeping the Background Processing disabled, are you able to run the Extract Subdataset tool?

Navigate to Geoprocessing > Geoprocessing Options > Background Processing. Uncheck "Enable".

JayantaPoddar_0-1626357758094.png

________________________________________________________________________________________________

You could also install ArcGIS Desktop Background Geoprocessing (64-bit), to work on a 64-bit python environment.



Think Location
0 Kudos