def plot_events(self, plot_type="map"): """ Plots the domain and beachballs for all events on the map. :param plot_type: Determines the type of plot created. * ``map`` (default) - a map view of the events * ``depth`` - a depth distribution histogram * ``time`` - a time distribution histogram """ from lasif import visualization events = self.comm.events.get_all_events().values() if plot_type == "map": domain = self.comm.project.domain if domain == "global": map = visualization.plot_domain() else: bounds = domain["bounds"] map = visualization.plot_domain( bounds["minimum_latitude"], bounds["maximum_latitude"], bounds["minimum_longitude"], bounds["maximum_longitude"], bounds["boundary_width_in_degree"], rotation_axis=domain["rotation_axis"], rotation_angle_in_degree=domain["rotation_angle"], plot_simulation_domain=False, zoom=True) visualization.plot_events(events, map_object=map, project=self) elif plot_type == "depth": visualization.plot_event_histogram(events, "depth") elif plot_type == "time": visualization.plot_event_histogram(events, "time") else: msg = "Unknown plot_type" raise LASIFError(msg)
def plot_events( self, plot_type: str = "map", iteration: str = None, inner_boundary: bool = False, ): """ Plots the domain and beachballs for all events on the map. :param plot_type: Determines the type of plot created. * ``map`` (default) - a map view of the events * ``depth`` - a depth distribution histogram * ``time`` - a time distribution histogram :type plot_type: str, optional :param iteration: Name of iteration, if given only events from that iteration will be plotted, defaults to None :type iteration: str, optional :param inner_boundary: Should we plot inner boundary of domain? defaults to False :type inner_boundary: bool, optional """ from lasif import visualization if iteration: events_used = self.comm.events.list(iteration=iteration) events = {} for event in events_used: events[event] = self.comm.events.get(event) events = events.values() else: events = self.comm.events.get_all_events().values() if plot_type == "map": m, projection = self.plot_domain(inner_boundary=inner_boundary) visualization.plot_events( events, map_object=m, ) if iteration: title = f"Event distribution for iteration: {iteration}" else: title = "Event distribution" m.set_title(title) elif plot_type == "depth": visualization.plot_event_histogram(events, "depth") elif plot_type == "time": visualization.plot_event_histogram(events, "time") else: msg = "Unknown plot_type" raise LASIFError(msg)
def plot_events(self, plot_type="map"): """ Plots the domain and beachballs for all events on the map. :param plot_type: Determines the type of plot created. * ``map`` (default) - a map view of the events * ``depth`` - a depth distribution histogram * ``time`` - a time distribution histogram """ from lasif import visualization events = self.comm.events.get_all_events().values() if plot_type == "map": m = self.comm.project.domain.plot() visualization.plot_events(events, map_object=m) elif plot_type == "depth": visualization.plot_event_histogram(events, "depth") elif plot_type == "time": visualization.plot_event_histogram(events, "time") else: msg = "Unknown plot_type" raise LASIFError(msg)