How to save a layer created from raster without using map document or ArcGISPro?

690
2
Jump to solution
08-16-2021 04:36 AM
RehanChaudhary
Occasional Contributor

I have created a multidimensional raster layer using the "MakeMultidimensionalRasterLayer" tool  from arcgispro using the tool's python scripting and without using ArcGISPro and a map document. I created the layer as following: 

 

 

p = arcpy.md.MakeMultidimensionalRasterLayer(in_multidimensional_raster=netCDF_in, out_multidimensional_raster_layer=temperature,variables=["tmin"])

 

Now i want to save this layer so that i can define a certain symbology to this layer file using the colorizer attribute within the file. I tried saving it using the following code but when i open the saved file in ArcGISPro, it crashes and the crash only happens because of the file otherwise its ok.

How can i achieve this? 

 

 

lyr="temperature.lyr"

k=arcpy.SaveToLayerFile_management(p,lyr)

 

0 Kudos
2 Solutions

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

you have to use the full path to the layer on disk.  That is 

"c:/temp/temperature.lyr"   for arcmap

"c:/temp/temperature.lyrx"   for arcgis pro


... sort of retired...

View solution in original post

DuncanHornby
MVP Frequent Contributor

Geoprocessing tools return result objects so what you are assigning to "p" is a results object not a raster. You need to obtain the actual output using getOutput() on the result object. Review the code samples in the help file .

View solution in original post

0 Kudos
2 Replies
DanPatterson
MVP Esteemed Contributor

you have to use the full path to the layer on disk.  That is 

"c:/temp/temperature.lyr"   for arcmap

"c:/temp/temperature.lyrx"   for arcgis pro


... sort of retired...
DuncanHornby
MVP Frequent Contributor

Geoprocessing tools return result objects so what you are assigning to "p" is a results object not a raster. You need to obtain the actual output using getOutput() on the result object. Review the code samples in the help file .

0 Kudos