Created
June 25, 2016 16:15
-
-
Save pasutisu/91687b297445dd105f1d3fc2cbbdfafd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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