181k views
2 votes
Modify the flood map of NYC from Lab 4 to color the region of the map with elevation greater than 6 feet and less than or equal 20 feet above sea level the color grey (50% red, 50% green, and 50% blue). Your resulting map should look like:

User Dlewin
by
5.7k points

1 Answer

4 votes

Answer:

See explanation

Step-by-step explanation:

if elevation <= 0:

#Below sea level

Color the pixel blue

elif elevation <= 6:

#Below the storm surge of Hurricane Sandy (flooding likely)

Color the pixel red

else:

#Above the 6 foot storm surge and didn't flood

Color the pixel green

To give us complete control of the coloring, we will create a new array that will hold the colors for each pixel. Here's an outline of our program:

Import the libraries to manipulate and display arrays.

Read in the NYC data and store in the variable, elevations

Create a new array, floodMap, to hold our colors for the map.

For each element in elevations, make a pixel colored by the schema above.

Load our image into pyplot.

Display the image.

We'll use a very simple (but a bit garish) color scheme, with our "blue" being 0% red, 0% green, and 100% blue. And similarly, the "red" and the "green" we'll use will be 100% of each, 0% of the others, giving a map like:

Modify the flood map of NYC from Lab 4 to color the region of the map with elevation-example-1
User Javier Soto
by
5.2k points