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
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.
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,
)
Region covered by the Topographical file: Latitude from 46.000000° to 47.000000° Longitude from 8.000000° to 9.000000°
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)
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()
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
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
)
)
The Earth radius at latitude 46.904790°: 6366.78 km