For our flight, we can check terrain in the departure and arrival airports areas by reviewing the airport terminal procedure charts. However, it would also be useful to have a terrain check along the flight path from the departure waypoint to the arrival waypoint. The main thing we want to check is that our climb and descent trajectories do not conflict with any terrain. Since we already have this path defined in our trajectory dataframe, it shouldn't be too difficult to perform this additional check.
For this task we will use a library called SRTM.py, created by Tomo Krajina. We can use this library to get an elevation value for a given pair of coordinates. The term SRTM refers to Shuttle Radar Topography Mission, where Shuttle is referring to the Space Shuttle. In February 2000, Space Shuttle Endeavour embarked on mission STS-99 carrying a special radar instrument payload to map the Earth's terrain contours. The dataset is publicly available now, and there are many Python libraries available that make the dataset more accessible to work with.
The SRTM terrain coverage is almost global, covering about 80% of the Earth's surface. Coverage gaps are mostly near the north and south poles. Since the last part of our sample flight path is north of 60°N, we may not have full coverage for the route.
The coding is fairly straightforward:
In the inspection printout, we included value counts for the new terrain column:
value counts for terrain_elev_ft:Notice that there are 139 points for which no terrain data could be obtained, and 190 points that have a value of 0. Value 0 usually means the coordinates are on a body of water at sea level.
For further inspection we can look at the top 10 rows:
The first four points are 0; inspecting the flight path we can see that the first four points are over sea level water:
It would be helpful to visualize the terrain against expected altitude on a single plot. To do this we can add an additional column to our trajectory and navlog dataframes called dist_from_origin_km, which, as the name suggests, gives the distance from the origin airport in kilometers. We will use this value for our x-axis, and then plot the altitude and terrain on the y-axis.
To plot from multiple dataframes, I find it easier to use plotly go instead of plotly express:
Here is the plot:
In the resulting plot we can observe:
at the departure waypoint there is no terrain conflict
there are two coverage gaps; one at 300km from the origin, and another near the arrival airport
due to the arrival coverage gap it's not possible to confirm if the descent will conflict with terrain, so we will have to resort to other charts to confirm clearance
In this section we used a Python library to get terrain elevation values from the SRTM dataset to check the terrain for our route. In Chapter 7 we provide more terrain examples by showing three additional example flight plans.
In the next section we will add weather functionality into our flight planning process, in order to approximate any upper level winds that will be encountered in flight.