Topography#

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.

See also

You can understand more about NASADEM by reading their documentation at NASA’s Earth data Search.

Including the topography provides more accurate results when flying next to mountains or valleys.

Initialization#

Let us consider a fictional launch in Switzerland. First, we set the basic information about our Environment object

from rocketpy import Environment
env = Environment(latitude=46.90479, longitude=8.07575, datum="WGS84")

Note

The datum argument is used only for converting from geodesic (i.e. lat/lon) to the UTM coordinate system.

Set the topographic profile#

Now we 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°

Find the launch site elevation#

Once the topographic profile is defined, we can find the launch site elevation

elevation = env.get_elevation_from_topographic_profile(env.latitude, env.longitude)
print(f"The elevation at latitude {env.latitude} and longitude {env.longitude} is {elevation} meters.")
The elevation at latitude 46.90479 and longitude 8.07575 is 1565 meters.

And finally set the elevation to the Environment object:

env.set_elevation(elevation)

Visualize information#

To check the elevation we have set, as well as other important attributes of our Environment object, we run the rocketpy.Environment.info() method:

env.prints.launch_site_details()

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