madanksuwal

ASCIIToRaster_conversion not working

Discussion created by madanksuwal on Mar 14, 2013
Latest reply on Mar 14, 2013 by lpinner
Dear all
here is my syntax
import arcpy
import os
dir_name = "J:/BIOCLIM_Data/a1b_scenario/csiro_mk3_0_sres_a1b_2020s_bio_30s_no_tile_asc"
for filename in os.listdir(dir_name):
    if not filename.endswith("%s.asc"): continue
    full_path = os.path.join(dir_name, filename)
    inASCII = '%s.asc' % (full_path,)
    outRaster = '%s.img' % (full_path,)
    rasterType = "FLOAT"
    arcpy.ASCIIToRaster_conversion(inASCII, outRaster, rasterType)

I don't know where it went wrong, but is not working
out put is

Traceback (most recent call last):
  File "C:\Documents and Settings\Madan K Suwal\Desktop\R to A.py", line 7, in <module>
    arcpy.ASCIIToRaster_conversion(inASCII, outRaster, rasterType)
  File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\conversion.py", line 1615, in ASCIIToRaster
    raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000865: Input ASCII raster file: bio_1.asc does not exist.
Failed to execute (ASCIIToRaster).

I am very new in python, actually just modified the syntax from online sources, so I don't know what wrong with it
I need to convert about 150 ASCII files to Raster and define projection WGS 1984 to them at the same time
I want to automate the process,
I am expecting this forum's support,
any kind help is appreciated
thanking you

Regards
madan k suwal

Outcomes