Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terrain elevation and associated functionalities added with TERRAIN plugin v1.0 #430

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
49 changes: 46 additions & 3 deletions bluesky/resources/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ navdata_path = 'navdata'
# Indicate the path for the aircraft performance data
perf_path = 'performance'

# Indicate the path for the BADA aircraft performance data (leave empty if BADA is not available)
# Indicate the path for the BADA aircraft performance data
# (leave empty if BADA is not available)
perf_path_bada = 'performance/BADA'

# Indicate the plugins path
Expand All @@ -37,7 +38,8 @@ plugin_path = 'plugins'
# Specify a list of plugins that need to be enabled by default
enabled_plugins = ['area', 'datafeed']

# Indicate the start location of the radar screen (e.g. [lat, lon], or airport ICAO code)
# Indicate the start location of the radar screen
# (e.g. [lat, lon], or airport ICAO code)
start_location = 'EHAM'

# Simulation timestep [seconds]
Expand Down Expand Up @@ -71,7 +73,8 @@ asas_pzr = 5.0
# ASAS vertical PZ margin [ft]
asas_pzh = 1000.0

# ASAS factors applied on protected zone for resolution horizontally and vertically [-]
# ASAS factors applied on protected zone for resolution
# horizontally and vertically [-]
asas_marh = 1.05
asas_marv = 1.05
#=============================================================================
Expand All @@ -96,3 +99,43 @@ stack_text_color = 0, 255, 0

# Stack and command line background color
stack_background_color = 102, 102, 102

#=============================================================================
#= terrain_and_skyline plugin specific settings below
#=============================================================================

# Open Topography API Key needed for the terrain_and_skyline plugin.
# The default value is ONLY A TEMPORARY KEY which may or may not work.
# For regular use, request a key at https://opentopography.org/ for free.
opentopography_api_key = 'demoapikeyot2022'

# Option of terrain resolution from Open Topography for the
# terrain_and_skyline plugin
# "SRTMGL1" = ~30 meter resolution
# "SRTMGL3" = ~90 meter resolution
DEM_resolution = "SRTMGL1"

# Re-download 3D terrain data from Open Topography for the
# terrain_and_skyline plugin even when the data is already abailable.
reset_terrain = False

# Bounding box of the interested area for the terrain_and_skyline plugin.
# The example values correspond to an area around Vienna

# New York City
# DEM_south = 40.2
# DEM_west = -74.5
# DEM_north = 41.5
# DEM_east = -73.1

# Vienna
DEM_south = 48.117119
DEM_north = 48.327582
DEM_west = 16.174955
DEM_east = 16.577566

# number of random (lat, lon) points used to draw elevation map.
num_points_drawn = 100000

# radar altimeter mute
agl_mute = False
69 changes: 69 additions & 0 deletions bluesky/tools/decorators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import functools
import time


def decorator(func):
"""This is a generic decorator template"""
@functools.wraps(func)
def wrapper_decorator(*args, **kwargs):
# Do something before
value = func(*args, **kwargs)
# Do something after
return value
return wrapper_decorator


def timer(func):
"""Print the runtime of the decorated function"""
@functools.wraps(func)
def wrapper_timer(*args, **kwargs):
start_time = time.perf_counter()
value = func(*args, **kwargs)
end_time = time.perf_counter()
run_time = end_time - start_time
print(f"Finished {func.__name__!r} in {run_time:.6f} sec.\n")
return value
return wrapper_timer


def debug(func):
"""This is a generic decorator template"""
@functools.wraps(func)
def wrapper_debug(*args, **kwargs):
args_repr = [repr(a) for a in args]
kwargs_repr = [f"{k} = {v!r}" for k, v in kwargs.items()]
signature = ", ".join(args_repr + kwargs_repr)
print(f"Calling {func.__name__}({signature})")
value = func(*args, **kwargs)
print(f"{func.__name__!r} returned {value!r}\n")
return value
return wrapper_debug


def slow_down(parameter):
"""Sleep given second(s) before calling the function
Also a template for decorator with a parameter
"""
def slow_down_inner(func):
@functools.wraps(func)
def wrapper_slow_down(*args, **kwargs):
time.sleep(parameter)
return func(*args, **kwargs)
return wrapper_slow_down
return slow_down_inner


def timer_with_message(message):
"""Print the runtime of the decorated function"""
def timer_inner(func):
@functools.wraps(func)
def wrapper_timer(*args, **kwargs):
start_time = time.perf_counter()
value = func(*args, **kwargs)
end_time = time.perf_counter()
run_time = end_time - start_time
print(f"{message}")
print(f"Finished {func.__name__!r} in {run_time:.6f} sec.\n")
return value
return wrapper_timer
return timer_inner
Loading