Topography with RocketPy#
Along this jupyter notebook we will show how RocketPy interacts with Earth Topography. We mainly will use data provided by the NASADEM Merged DEM Global 1 arc second nc.
NASADEM is a digital elevation model based on the Shuttle Radar Topography Mission (SRTM), a collaboration between NASA and the National Geospatial-Intelligence Agency (NGA), as well as participation from the German and Italian space agencies. You can read more about NASADEM at: https://cmr.earthdata.nasa.gov/search/concepts/C1546314436-LPDAAC_ECS.html
This is a first step forward stopping consider Earth as a constant plane better results when we are flying next to mountains or valleys
Initialization#
First of all, we import the Environment Class, which allows to set topographic profiles
[1]:
from rocketpy import Environment
For example, let’s set an Environment consider a fictional launch at Switzerland. First we need to set the basic information about our Environment object
[2]:
env = Environment(latitude=46.90479, longitude=8.07575, datum="WGS84")
Obs.: Notice that the datum
argument is used only for the converting from geodesic (i.e. lat/lon) to UTM coordinate system.
Set topography#
Now we finally set our topography
[3]:
env.set_topographic_profile(
type="NASADEM_HGT",
file="../../../data/sites/switzerland/NASADEM_NC_n46e008.nc",
dictionary="netCDF4",
crs=None,
)
Region covered by the Topographical file:
Latitude from 46.000000° to 47.000000°
Longitude from 8.000000° to 9.000000°
Find the launch site elevation#
Once we defined the topographic profile, we can find the launch site elevation
[4]:
elevation = env.get_elevation_from_topographic_profile(env.latitude, env.longitude)
And finally set the elevation to the Environment object:
[5]:
env.set_elevation(elevation)
Visualize information#
Now we can see the elevation that we’ve set, as well as other important attributes of our Environment object. We do that by running the .info()
method:
[6]:
env.info()
Gravity Details
Acceleration of Gravity at Lauch Site: 9.803093916992397 m/s²
Launch Site Details
Launch Site Latitude: 46.90479°
Launch Site Longitude: 8.07575°
Reference Datum: WGS84
Launch Site UTM coordinates: 886538.30 E 5207102.17 N
Launch Site UTM zone: 31T
Launch Site Surface Elevation: 1565.0 m
Atmospheric Model Details
Atmospheric Model Type: standard_atmosphere
standard_atmosphere Maximum Height: 80.000 km
Surface Atmospheric Conditions
Surface Wind Speed: 0.00 m/s
Surface Wind Direction: 0.00°
Surface Wind Heading: 0.00°
Surface Pressure: 838.88 hPa
Surface Temperature: 278.00 K
Surface Air Density: 1.051 kg/m³
Surface Speed of Sound: 333.87 m/s
Atmospheric Model Plots

Calculate Earth Radius at latitude#
If we want to, we can calculate the Earth radius based on the launch site latitude
[7]:
e_radius = env.calculate_earth_radius(env.latitude)
print(
"The Earth radius at latitude {:.6f}°: {:.2f} km".format(
env.latitude, e_radius / 1000
)
)
The Earth radius at latitude 46.904790°: 6366.78 km