Select to view content in your preferred language

Using Make Layer works in Pro but not in a GP tool

92
0
4 weeks ago
DougBrowning
MVP Esteemed Contributor

Been testing an infinite number of combinations the last few days and still cannot get it.  This all works great in Pro/PyScripter, and it does publish, but when running as a GP tool I get the message  ERROR 003401: Invalid or unsupported input raster. Failed to execute (MakeRasterLayer).

Pro 3.1 and Server 11.3

RAPTrendRaster = arcpy.ia.GenerateTrendRaster("yearsRaster", "StdTime", runIndicators, "MANN-KENDALL", None, "DATA", None, "", "RMSE", "NO_R2", "NO_SLOPEPVALUE", "")

oneIndLayer = arcpy.md.MakeMultidimensionalRasterLayer(RAPTrendRaster, "oneInd", indToMap)[0]
arcpy.AddMessage(oneIndLayer)   # nothing prints here on the server but in Pro I get <MappingLayerObject object at 0x0000021636EA4D20>


pvalLayer = arcpy.management.MakeRasterLayer(oneIndLayer, "RAPTrendRaster_pval", band_index=[2])[0]

The last line fails with: Invalid or unsupported input raster.  

I run it all in PyScripter. There I can do

pvalLayer = arcpy.management.MakeRasterLayer(oneIndLayer, "RAPTrendRaster_pval", band_index=[2])[0]

or

pvalLayer = arcpy.management.MakeRasterLayer("oneInd", "RAPTrendRaster_pval", band_index=[2])[0]

And it works just fine.

My guess is its either not storing the layer file at all or it is not pathing right.  Of course its remapping some of my vars but its just repalcing ESRI_Var and then that gets oneIndLayer

I guess my question is how do I use layer files in a GeoProcessing tool?  Cannot find anything about it.

thanks a lot

0 Kudos
0 Replies