Created
January 16, 2013 14:33
-
-
Save seumasmorrison/4547483 to your computer and use it in GitHub Desktop.
Used for producing xyz bathymetry data from ArcGIS 10 ouputs, with the intention of importing into DHI Mike21.
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
# Initial data obtained from hdr file produced with flt file when running | |
# Raster to Float in ArcToolBox and numpy file ( npy ) from RasterToNumpyArray | |
# in ArcPy | |
import numpy as np | |
np.load('numpy_bathy.npy') | |
cell_size = 3 | |
no_of_columns = 18325 | |
no_of_rows = 13303 | |
lower_left_x = 607512 | |
lower_left_y = 6455598 | |
lower_right_x = lower_left_x + ( cell_size * no_of_columns ) | |
x_coordinates = np.arange(lower_left_x, lower_right_x, cell_size) | |
upper_left_y = lower_left_y + ( cell_size * no_of_rows ) | |
y_coordinates = np.arange(lower_left_y, upper_left_y, cell_size) | |
xyz_file = open('D:\\bathymetry_output.xyz','w') | |
for index,x in enumerate(x_coordinates): | |
print index | |
for index_y,y in enumerate(y_coordinates): | |
depth = bathy[index_y,index] | |
if depth > -1000.0 : | |
xyz_file.write(str(x) + ', ' + str(y) + ', ' + str(depth) + '\n') | |
xyz_file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment