ASCIIToRaster_conversion not working

329
1
03-14-2013 02:35 AM
Madan_KrishnaSuwal
New Contributor
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
Tags (2)
0 Kudos
1 Reply
Luke_Pinner
MVP Regular Contributor
Can you edit your post and enclose your script in CODE tags. See this post if you're not sure how.
0 Kudos