-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFldMap.py
More file actions
27 lines (22 loc) · 746 Bytes
/
Copy pathFldMap.py
File metadata and controls
27 lines (22 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#Name: Berkay Baltas
#Date: 10/04/18
#This program creates a flood map
import numpy as np
import matplotlib.pyplot as plt
elevations = np.loadtxt('elevationsNYC.txt')
mapShape = elevations.shape +(3,)
floodMap = np.zeros(mapShape)
for row in range(mapShape[0]):
for col in range(mapShape[1]):
if elevations[row,col] <= 0:
floodMap[row,col,2] = 1.0
elif elevations[row,col] <= 6:
floodMap[row,col,0] = 1.0
elif elevations[row,col] > 6 and elevations[row,col] <= 20:
floodMap[row,col,0] = 0.5
floodMap[row,col,1] = 0.5
floodMap[row,col,2] = 0.5
else:
floodMap[row,col,1] = 1.0
plt.imshow(floodMap)
plt.imsave('floodMap.png', floodMap)