Skip to content

Instantly share code, notes, and snippets.

@pasutisu
Created June 25, 2016 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pasutisu/91687b297445dd105f1d3fc2cbbdfafd to your computer and use it in GitHub Desktop.
Save pasutisu/91687b297445dd105f1d3fc2cbbdfafd to your computer and use it in GitHub Desktop.
import csv
filename = input("Filename: ")
out = open(filename, "w")
mori = csv.reader(open("mofumofu.asc"), delimiter=' ')
mofu = [ v for v in mori]
x = int(input("X: "))
x2 = int(input("X2: "))
y = int(input("Y: "))
y2 = int(input("Y2: "))
out.write("TerrMesh\nSPEC FALSE\nNBL {} {}\nTMS 180.00 180.00\nCBE 250.00 3000.00 28 117 16 130 120 100\n".format((x2-x)-1, (y2-y)-1))
for index, mofumofu in enumerate(mofu[y:y2]):
for tag, mogu in enumerate(mofumofu[x:x2]):
if mogu == "-9999":
out.write("BLO {:.2f}\n".format(0))
else:
out.write("BLO {:.2f} R 1 194 169 92 1 194 169 92\n".format(int(mogu)/2))
out.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment