XArrrayToRaster fails with projection error

354
2
03-15-2023 02:21 PM
DavidAnderson_1701
Occasional Contributor

I'm using ArcGIS Pro 3.0.3.

I'm doing some raster processing where I need functionality that the Arcgis tools don't provide.   The data is a multidimensional raster.   I thought XArray would be a good way to handle this.  The conversion from raster to xarray worked fine. The xarray processing produced the desired results.   The conversion back to raster is failing with a message about projection.  To test things out I tried a simple in and out on the same data which failed.

 

import arcpy
temp_max_file = r"D:\r3_analyst_work\Climate_Change_Modeling\climate_envelope\GridMetData_2020\tmmx_2020.nc"
test_rast = arcpy.Raster(temp_max_file,True)
test_rast_xr = arcpy.ia.RasterToXarray(test_rast)
out_rast = arcpy.ia.XarrayToRaster(test_rast_xr)

 

This produces the following message:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
In  [144]:
Line 1:     out_rast = arcpy.ia.XarrayToRaster(test_rast_xr)

File C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\ia\RasterToXarray.py, in XarrayToRaster:
Line 377:   arcpy.DefineProjection_management(myraster, srs_stand)

File C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py, in DefineProjection:
Line 13701: raise e

File C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py, in DefineProjection:
Line 13698: retval = convertArcObjectToPythonObject(gp.DefineProjection_management(*gp_fixargs((in_dataset, coor_system), True)))

File C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py, in <lambda>:
Line 512:   return lambda *args: val(*gp_fixargs(args, True))

RuntimeError: Unspecified error 
---------------------------------------------------------------------------
0 Kudos
2 Replies
ShaunWalbridge
Esri Regular Contributor

We can reproduce this issue, and have logged an issue to address it in the next release. 

0 Kudos
ShaunWalbridge
Esri Regular Contributor

The issue has been addressed, and will be fixed in the upcoming Pro release.

0 Kudos