Topography with RocketPy#
Hello, along this jupyter notebook we will show how RocketPy can handle with the 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 flat and can get us much 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
[ ]:
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
[ ]:
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
[ ]:
env.set_topographic_profile(
type="NASADEM_HGT",
file="../../data/sites/switzerland/NASADEM_NC_n46e008.nc",
dictionary="netCDF4",
crs=None,
)
Find the launch site elevation#
Once we defined the topographic profile, we can find the launch site elevation
[ ]:
elevation = env.get_elevation_from_topographic_profile(env.latitude, env.longitude)
And finally set the elevation to the Environment object:
[ ]:
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:
[ ]:
env.info()
Calculate Earth Radius at latitude#
If we want to, we can calculate the Earth radius based on the launch site latitude
[ ]:
e_radius = env.calculate_earth_radius(env.latitude)
print(
"The Earth radius at latitude {:.6f}°: {:.2f} km".format(
env.latitude, e_radius / 1000
)
)