TransWikia.com

Error Projecting Raster (.hdf) Using ArcPy

Geographic Information Systems Asked by lsr729 on December 23, 2020

I want to project HDF files (MODIS images) to another coordinate system using ArcPy. The following is the code I wrote:

input_ras="N:mod16a2MOD16A2.A2001001.h24v05.006.2017068142418.hdf"

out_ras= "test.tif"

# the coordinate system which is required
out_co="G:Rathorevic_auto7shape_proj.prj"

arcpy.ProjectRaster_management(in_raster=input_raster,out_raster=out_ras,out_coor_system=out_co)

This script produces the following error:

ExecuteError                              Traceback (most recent call last)
<ipython-input-95-0d17576ef2fe> in <module>()
 arcpy.ProjectRaster_management(in_raster=input_ras,out_raster="out_ras,out_coor_system=out_co)

C:Program Files (x86)ArcGISDesktop10.5ArcPyarcpymanagement.py in ProjectRaster(in_raster, out_raster, out_coor_system, resampling_type, cell_size, geographic_transform, Registration_Point, in_coor_system)
   9700         return retval
   9701     except Exception as e:
-> 9702         raise e
   9703 
   9704 @gptooldoc('RegisterRaster_management', None)

ExecuteError: Failed to execute. Parameters are not valid.
Undefined coordinate system for input dataset.
Failed to execute (ProjectRaster).

I checked the projection of input file and it is:

"PROJCS['Unknown_datum_based_upon_the_custom_spheroid_Sinusoidal',GEOGCS['GCS_Unknown_datum_based_upon_the_custom_spheroid',DATUM['D_Not_specified_based_on_custom_spheroid',SPHEROID['Custom_spheroid',6371007.181,0.0]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Sinusoidal'],PARAMETER['false_easting',0.0],PARAMETER['false_northing',0.0],PARAMETER['central_meridian',0.0],UNIT['Meter',1.0]]")

One Answer

not sure if this is for GISN08 but I hit the same error on one of this module. The way to resolve this is to put in the full projection of the coordinate system for input dataset as an argument to ProjectRaster_management:

arcpy.ProjectRaster_management (ifpn, ofpn, "4326", "NEAREST", "#", "#", "#", "PROJCS['Unknown_datum_based_upon_the_custom_spheroid_Sinusoidal',GEOGCS['GCS_Unknown_datum_based_upon_the_custom_spheroid',DATUM['D_Not_specified_based_on_custom_spheroid',SPHEROID['Custom_spheroid',6371007.181,0.0]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Sinusoidal'],PARAMETER['false_easting',0.0],PARAMETER['false_northing',0.0],PARAMETER['central_meridian',0.0],UNIT['Meter',1.0]]")

ifpn and ofpn are my input and output rasters respectively. If these are already assigned your variables (as you did with input_ras and out_ras), you don't need to reassign them within the function.

Answered by user19425 on December 23, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP