AnsweredAssumed Answered

Python Ascii to Raster

Question asked by robs532 on Sep 3, 2015
Latest reply on Sep 4, 2015 by Dan_Patterson

Hi have around 100Asciis i need converting to rasters. I have this little script

# Import system modules 

import arcgisscripting, os, sys

 

# Create the Geoprocessor object 

gp = arcgisscripting.create(9.3) 

 

# Set local variables 

InAsciiFile = None 

inDir = r"E:\Hull Deliverables - Final\Defences Operating\DepthGrids\1d" 

OutRaster = r"E:\Hull Deliverables - Final\Analysis for Duty\allascii\rast"

 

for InAsciiFile in os.listdir(inDir): 

    if InAsciiFile.rsplit(".")[-1] == "asc": 

        print InAsciiFile 

             

# Process: ASCIIToRaster_conversion 

gp.ASCIIToRaster_conversion(os.path.join(inDir,InAsciiFile)), os.path.join((OutRaster,InAsciiFile.rsplit(".")[0][:9]), "FLOAT")

 

 

but for some reason i get the following error

 

):

  File "H:\Documents\python\asciitorast3.py", line 17, in <module>

    gp.ASCIIToRaster_conversion(os.path.join(inDir,InAsciiFile)), os.path.join((OutRaster,InAsciiFile.rsplit(".")[0][:9]), "FLOAT")

ExecuteError: Failed to execute. Parameters are not valid.

ERROR 000885: Input ASCII raster file: E:\Hull Deliverables - Final\Defences Operating\DepthGrids\1d\info's does not have a file extension.

ERROR 000859: The required parameter Output raster is empty, or is not the type of Raster Dataset.

Failed to execute (ASCIIToRaster).

 

 

any help would be appreciated

 

thanks

Outcomes