def __init__(self, key, colour: str = None, blocking=False, buffer_dist=0, ac: dict = AIRCRAFT_LIST['Default'], wind_vel: float = 0, wind_dir: float = 0): super().__init__(key, colour, blocking, buffer_dist) delattr(self, '_colour') self._layers = [ TemporalPopulationEstimateLayer(f'_strike_risk_tpe_{key}', buffer_dist=buffer_dist), RoadsLayer(f'_strike_risk_roads_{key}', buffer_dist=buffer_dist)] self.aircraft = casex.AircraftSpecs(casex.enums.AircraftType.FIXED_WING, ac['width'], ac['length'], ac['mass']) self.aircraft.set_ballistic_drag_coefficient(ac['bal_drag_coeff']) self.aircraft.set_ballistic_frontal_area(ac['frontal_area']) self.aircraft.set_glide_speed_ratio(ac['glide_speed'], ac['glide_ratio']) self.aircraft.set_glide_drag_coefficient(ac['glide_drag_coeff']) self.alt = ac['cruise_alt'] self.vel = ac['cruise_speed'] self.wind_vel = wind_vel # !! This is the direction the wind is COMING FROM !! # self.wind_dir = np.deg2rad( (((wind_dir - 180) % 360) - 90) % 360 ) self.event_prob = ac['failure_prob'] self.bm = BallisticModel(self.aircraft) self.gm = GlideDescentModel(self.aircraft)
def __init__(self, key, colour: str = None, blocking=False, buffer_dist=0, ac_width: float = 2, ac_length: float = 2, ac_mass: float = 2, ac_glide_ratio: float = 12, ac_glide_speed: float = 15, ac_glide_drag_coeff: float = 0.1, ac_ballistic_drag_coeff: float = 0.8, ac_ballistic_frontal_area: float = 0.2, ac_failure_prob: float = 5e-3, alt: float = 120, vel: float = 18, wind_vel: float = 5, wind_dir: float = 90): super().__init__(key, colour, blocking, buffer_dist) delattr(self, '_colour') self._layers = [ TemporalPopulationEstimateLayer(f'_strike_risk_tpe_{key}', buffer_dist=buffer_dist), RoadsLayer(f'_strike_risk_roads_{key}', buffer_dist=buffer_dist) ] self.aircraft = casex.AircraftSpecs( casex.enums.AircraftType.FIXED_WING, ac_width, ac_length, ac_mass) self.aircraft.set_ballistic_drag_coefficient(ac_ballistic_drag_coeff) self.aircraft.set_ballistic_frontal_area(ac_ballistic_frontal_area) self.aircraft.set_glide_speed_ratio(ac_glide_speed, ac_glide_ratio) self.aircraft.set_glide_drag_coefficient(ac_glide_drag_coeff) self.alt = alt self.vel = vel self.wind_vel = wind_vel # !! This is the direction the wind is COMING FROM !! # self.wind_dir = np.deg2rad((((wind_dir - 180) % 360) - 90) % 360) self.event_prob = ac_failure_prob self.bm = BallisticModel(self.aircraft) self.gm = GlideDescentModel(self.aircraft)
def __init__(self, tiles: str = 'Wikipedia', tools: Optional[Iterable[str]] = None, active_tools: Optional[Iterable[str]] = None, cmap: str = 'CET_L18', raster_resolution: float = 40, plot_size: Tuple[int, int] = (760, 735), progress_callback: Optional[Callable[[str], None]] = None, update_callback: Optional[Callable[[str], None]] = None, progress_bar_callback: Optional[Callable[[int], None]] = None): """ Initialise a Plot Server :param str tiles: a geoviews.tile_sources attribute string from http://geoviews.org/gallery/bokeh/tile_sources.html#bokeh-gallery-tile-sources :param List[str] tools: the bokeh tools to make available for the plot from https://docs.bokeh.org/en/latest/docs/user_guide/tools.html :param List[str] active_tools: the subset of `tools` that should be enabled by default :param cmap: a colorcet attribute string for the colourmap to use from https://colorcet.holoviz.org/user_guide/Continuous.html :param raster_resolution: resolution of a single square of the raster pixel grid in metres :param Tuple[int, int] plot_size: the plot size in (width, height) order :param progress_callback: an optional callable that takes a string updating progress :param update_callback: an optional callable that is called before an plot is rendered :param progress_bar_callback: an optional callback that takes an integer updating the progress bar """ self.tools = ['crosshair'] if tools is None else tools self.active_tools = ['wheel_zoom' ] if active_tools is None else active_tools import colorcet self.cmap = getattr(colorcet, cmap) from geoviews import tile_sources as gvts self._base_tiles = getattr(gvts, tiles) self._time_idx = 0 from seedpod_ground_risk.layers.roads_layer import RoadsLayer self._generated_data_layers = {} self.data_layer_order = [] self.data_layers = [ TemporalPopulationEstimateLayer('Temporal Pop. Est'), RoadsLayer('Road Traffic Population/Hour') ] self.annotation_layers = [] self.plot_size = plot_size self._progress_callback = progress_callback if progress_callback is not None else lambda *args: None self._update_callback = update_callback if update_callback is not None else lambda *args: None self._progress_bar_callback = progress_bar_callback if progress_bar_callback is not None else lambda *args: None self._x_range, self._y_range = [-1.45, -1.35], [50.85, 50.95] self.raster_resolution_m = raster_resolution self._epsg4326_to_epsg3857_proj = None self._epsg3857_to_epsg4326_proj = None self._preload_started = False self._preload_complete = False from bokeh.io import curdoc from bokeh.server.server import Server self._current_plot = curdoc() self._server_thread = None self.server = Server({'/': self.plot}, num_procs=1) self.server.io_loop.spawn_callback(self._preload_layers) self.url = 'http://localhost:{port}/{prefix}'.format(port=self.server.port, prefix=self.server.prefix) \ if self.server.address is None else self.server.address
def setUp(self) -> None: self.plot_title = 'Full Roads Population Transiting Density' self.layer = RoadsLayer('test') super().setUp()
def setUp(self) -> None: self.layer = RoadsLayer('test') super().setUp()
def setUp(self) -> None: self.layer = RoadsLayer('test', buffer_dist=10) super().setUp()