Question: a ) Load the data using input _ data = np . genfromtxt ( f ilename, delimiter = ' , ' ) with the appropriate

a) Load the data using input_data = np.genfromtxt(f ilename, delimiter=',') with the appropriate substitution for the string filename .
Note: The function will load an array with shape (1201,2). The data points for elevations (y-axis) of the topographic profile are stored in the first column of the
array and the longitudes (x-axis) are stored in the second column.
b) Extract the measured heights (elevations) from the first column into a new variable heights. Also extract the corresponding longitudes from the second column into a new
variable named lons.
Calculations:
c) Find the maximum and minimum heights in the profile and save them to variables h?max and h?min respectively. Also find the index position of the minimum and maximum
heights, saving those to h?max_idx and h?min_idx.
Use functions np.min to find the minimum and np.max to find the maximum. Use functions np .argmin to find index of the minimum and p.argmax to find
the index of the maximum.
d) Find the two longitudes that correspond to the hmax and h-min of the profile and save them to variables lon_h_max and lon_h_min respectively. Use a neatly formatted
string to print the longitude-height pair for both the minimum and maximum heights to two decimal precision.
e) Calculate the length of the small circle at =49.27 and assign the result to a variable L_small. Use R=6371km for the radius of the Earth.
Note: The function np.cos expects its input argument to be in radians and not degrees. Use the function np. deg 2 rad to do this conversion from degrees to
radians.
f) Calculate the total length of the profile in kilometres, saving your result to a variable L_profile.
Note: You might want to calculate an intermediate quantity which is the number of km per degree of longitude at =49.27(see the reading).
g) Using Vancouver's longitude of =-123.12, convert the longitudes in lons to distance (in km) from Vancouver and save to a new variable L-from_van .
h) Find the index position corresponding to Vancouver's location in the profile. Use the index to save the height at this point to a variable named h?van .
Note: the array lons does not contain the exact value of , so you will need to instead identify the next nearest longitude. This is similar to Part i) in Question 1.
Plotting:
i) Plot the profile in units of metres for elevations against the distance from Vancouver in units of kilometres with elevations in the y-axis.
j) Using the variables above, plot the maximum with a red circle, and the minimum with a blue circle. Also indicate the location of Vaincouver on the profile line using a green star
marker.
k) Add a horizontal dashed line at sea level (zero elevation) on vour plot.
a ) Load the data using input _ data = np .

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!