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

ASCIIToRaster_conversion not working

$
0
0
Dear all
here is my syntax
Code:

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

Code:

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

Viewing all articles
Browse latest Browse all 2485

Trending Articles