Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please check what's wrong Modify the map-mapking program from Lab 4 to create a map that outlines the coastline. Your program should create a new
Please check what's wrong
Modify the map-mapking program from Lab 4 to create a map that outlines the coastline. Your program should create a new image, called coast.png with the pixels colored as follows: o If the elevation is less than or equal to 0, color the pixel 50% blue (and 0% red and 0% green). o If the elevation is exactly 1, color the pixel 75% red, 75% green, and 75% blue. Otherwise, the pixel should be colored 50% red, 50% green, and 50% blue. Your resulting map should look like: and be saved to a file called coast.png Note: before submitting your program for grading, remove the commands that show the image (i.e. the ones that pop up the graphics window with the image). The program is graded on a server on the cloud and does not have a graphics window, so, the plt.show() commands will give an error. Instead, the files your program produces are compared pixel-by-pixel to the answer to check for correctness. import numpy as np import matplotlib.pyplot as plt elevationsnp.loadtxt( elevationsNYC.txt' mapShape- elevations.shape + (3,) coast- np.zeros (mapShape) for row in range(mapShape [0]: for col in range(mapShape [1]: if elevations[row, col] coast[row,col,0] - 0 coast[row,col,1] -0 coast[row,col,21 0.5Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started