how do I create output raster files in arcpy?

292
0
12-22-2010 11:04 AM
EvaPantaleoni
New Contributor
Ok, call me names, but I need help!

I am learning python and arcpy because i need to create loops that select variables and create kriging files.

After an incredible number of hours and headackes, I created a script that "works" BUT either it never stops if i specify the overwrite.output or gives me an error saying that I can not overwrite. My point is: how do I tell python that I want to generate a new file (kriging raster file) every time an iteration is finished?

For example, if I run the kriging for the year 101, I need an output file 101; for year 102 an output file 102, and so on.

I know for most of you this question is idiotic, but I really cant figure it out!

This is my code


# ---------------------------------------------------------------------------
# provahalf.py
# Created on: 2010-12-22 13:53:23.00000
#   (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy

# Check out any necessary licenses
arcpy.CheckOutExtension("spatial")

#arcpy.geoprocessing.OverWriteOutput = True

arcpy.env.overwriteOutput = True

# Script arguments... define workspace & where the  files are found
Input = "C:/Eva/Kennedy/Athmospheric/WIND_DATA_27Jan10/OneWeekData/PuffModel/new analysis/"
arcpy.env.workspace = Input


# Local variables:
provissima__2_ = "provissima"
provissima = "provissima"
final = "C:\\Eva\\Kennedy\\Athmospheric\\WIND_DATA_27Jan10\\OneWeekData\\PuffModel\\new analysis\\final"
Output_variance_of_prediction_raster = ""



yrmdda=0
while yrmdda<103:

# Process: Select Layer By Attribute
arcpy.SelectLayerByAttribute_management(provissima__2_, "NEW_SELECTION", "\"yrmdda\" = 101")

# Process: Kriging
arcpy.gp.Kriging_sa(provissima, "WindSp", final, "Spherical 0.031460", "0.03146", "VARIABLE 12", Output_variance_of_prediction_raster)

yrmdda=yrmdda+1
Tags (2)
0 Kudos
0 Replies