I recently had do something similar, convert rather large xyz files (up to 1.2GB) to rasters. Since the old script never really worked for me, i tried something with python/numpy. Making things a bit more complicated was the fact that in the xyz file records with no-data were simply omitted.
import numpy as np
import arcpy
# Inputs
xyzfile = "e:/file.xyz"
outname = "e:/raster.asc"
skiprows = 1
delimiter = ","
ncols = 5974
nrows = 5505
xllcorner = 682000
yllcorner = 205000
cellsize = 1.0
nodataval = -9999
zgrid = np.zeros((nrows,ncols), dtype=np.float32)
zgrid.fill(nodataval)
# process the xyz file
with open(xyzfile) as f:
# if header found in xyz file, skip line 1
if skiprows == 1:
next(f)
# put all available xyz values into correct positions on the zeros grid,
# all other positions keep the nodatavalue
for line in f:
item = line.rstrip().split(delimiter)
#print item
idx = (float(item[0])-xllcorner) / cellsize
idy = (float(item[1])-yllcorner) / cellsize
zgrid[idy,idx] = item[2]
# write the header and grid to an ascii file
with open(outname, "w") as outfile:
# write ascii raster header
outfile.write("ncols " + str(int(ncols))+ "\n")
outfile.write("nrows " + str(int(nrows))+ "\n")
outfile.write("xllcorner " + str(xllcorner) + "\n")
outfile.write("yllcorner " + str(yllcorner) + "\n")
outfile.write("cellsize " + str(cellsize) + "\n")
outfile.write("nodata " + str("%.2f" % float(nodataval)) + "\n" + "\n")
# write grid to outfile
np.savetxt(outfile,zgrid[::-1], fmt="%.2f", delimiter= " ")