Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Raster save method using variable

$
0
0
Hi,

I'm trying to find out how to permanently save a raster using a workspace variable + Raster name with little success so far.
In the Help it only shows how to do it hard-coding the output.

Please see code below.

Code:

import arcpy
import string
from arcpy import env
arcpy.env.overwriteOutput=True
from arcpy.sa import *
arcpy.CheckOutExtension("Spatial")

# Variables

OutLocation = arcpy.GetParameterAsText(0)

Raster1 = arcpy.Raster(arcpy.GetParameterAsText(1))

Raster2 = arcpy.Raster(arcpy.GetParameterAsText(2))

# Calculation and save

CDF = Raster1 * Raster2

OutFile = "CDF"                       
FullOutFile = OutLocation + OutFile    # For example: r"Q:\LFP_GLOBAL\OUTPUT.gdb\CDF"
CDF.save(FullOutFile)


Any help would be greatly appreciated.

Many thanks

Viewing all articles
Browse latest Browse all 2485

Trending Articles