def plot_event(self, event_name): """ Plots information about one event on the map. """ from lasif import visualization import matplotlib.pyplot as plt # Plot the domain. bounds = self.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=self.domain["rotation_axis"], rotation_angle_in_degree=self.domain["rotation_angle"], plot_simulation_domain=False, show_plot=False, zoom=True) all_events = self.get_event_dict() if event_name not in all_events: msg = "Event '%s' not found in project." % event_name raise ValueError(msg) event = self.get_event(event_name) event_info = self.get_event_info(event_name) stations = self.get_stations_for_event(event_name) visualization.plot_stations_for_event(map_object=map, station_dict=stations, event_info=event_info) # Plot the beachball for one event. visualization.plot_events([event], map_object=map) plt.show()
def plot_event(self, event_name): """ Plots information about one event on the map. """ if not self.comm.events.has_event(event_name): msg = "Event '%s' not found in project." % event_name raise ValueError(msg) map_object = self.comm.project.domain.plot() from lasif import visualization # Get the event and extract information from it. event_info = self.comm.events.get(event_name) # Get a dictionary containing all stations that have data for the # current event. try: stations = self.comm.query.get_all_stations_for_event(event_name) except LASIFNotFoundError: pass else: # Plot the stations if it has some. This will also plot raypaths. visualization.plot_stations_for_event( map_object=map_object, station_dict=stations, event_info=event_info) # Plot the beachball for one event. visualization.plot_events(events=[event_info], map_object=map_object)
def plot_event(self, event_name): """ Plots information about one event on the map. """ if not self.comm.events.has_event(event_name): msg = "Event '%s' not found in project." % event_name raise ValueError(msg) map_object = self.comm.project.domain.plot() from lasif import visualization # Get the event and extract information from it. event_info = self.comm.events.get(event_name) # Get a dictionary containing all stations that have data for the # current event. try: stations = self.comm.query.get_all_stations_for_event(event_name) except LASIFNotFoundError: pass else: # Plot the stations if it has some. This will also plot raypaths. visualization.plot_stations_for_event(map_object=map_object, station_dict=stations, event_info=event_info) # Plot the beachball for one event. visualization.plot_events(events=[event_info], map_object=map_object)
def plot_station_misfits( self, event_name: str, iteration: str, intersection_override=None, ): """ Plot a map of the stations where misfit was computed for a specific event. The stations are colour coded by misfit. :param event_name: Name of event :type event_name: str :param iteration: Name of iteration :type iteration: str :param intersection_override: boolean to require to have the same stations recording all events, i.e. the intersection of receiver sets. The intersection will consider two stations equal i.f.f. the station codes AND coordinates (LAT, LON, Z) are equal. If None is passed, the value use_only_intersection from the projects' configuration file is used, defaults to None :type intersection_override: bool, optional """ from lasif import visualization map_object, projection = self.plot_domain() event_info = self.comm.events.get(event_name) stations = self.comm.query.get_all_stations_for_event( event_name, intersection_override=intersection_override) long_iter = self.comm.iterations.get_long_iteration_name(iteration) misfit_toml = (self.comm.project.paths["iterations"] / long_iter / "misfits.toml") iteration_misfits = toml.load(misfit_toml) station_misfits = iteration_misfits[ event_info["event_name"]]["stations"] misfitted_stations = {k: stations[k] for k in station_misfits.keys()} for k in misfitted_stations.keys(): misfitted_stations[k]["misfit"] = station_misfits[k] visualization.plot_stations_for_event( map_object=map_object, station_dict=misfitted_stations, event_info=event_info, plot_misfits=True, raypaths=False, print_title=True, ) visualization.plot_events( events=[event_info], map_object=map_object, )
def plot_event(self, event_name): """ Plots information about one event on the map. """ if not self.comm.events.has_event(event_name): msg = "Event '%s' not found in project." % event_name raise ValueError(msg) from lasif import visualization # Plot the domain. domain = self.comm.project.domain if domain == "global": map_object = visualization.plot_domain() else: bounds = domain["bounds"] map_object = 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) # Get the event and extract information from it. event_info = self.comm.events.get(event_name) # Get a dictionary containing all stations that have data for the # current event. stations = self.comm.query.get_all_stations_for_event(event_name) # Plot the stations. This will also plot raypaths. visualization.plot_stations_for_event( map_object=map_object, station_dict=stations, event_info=event_info, project=self) # Plot the beachball for one event. visualization.plot_events([event_info], map_object=map_object)
def plot_event(self, event_name): """ Plots information about one event on the map. """ from lasif import visualization import matplotlib.pyplot as plt # Plot the domain. bounds = self.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=self.domain["rotation_axis"], rotation_angle_in_degree=self.domain["rotation_angle"], plot_simulation_domain=False, show_plot=False, zoom=True) all_events = self.get_event_dict() if event_name not in all_events: msg = "Event '%s' not found in project." % event_name raise ValueError(msg) event = self.get_event(event_name) event_info = self.get_event_info(event_name) stations = self.get_stations_for_event(event_name) visualization.plot_stations_for_event(map_object=map, station_dict=stations, event_info=event_info) # Plot the beachball for one event. visualization.plot_events([event], map_object=map) plt.show()
def plot_event( self, event_name: str, weight_set: str = None, intersection_override: bool = None, inner_boundary: bool = False, ): """ Plots information about one event on the map. :param event_name: Name of event :type event_name: str :param weight_set: Name of station weights set, defaults to None :type weight_set: str, optional :param intersection_override: boolean to require to have the same stations recording all events, i.e. the intersection of receiver sets. The intersection will consider two stations equal i.f.f. the station codes AND coordinates (LAT, LON, Z) are equal. If None is passed, the value use_only_intersection from the projects' configuration file is used, defaults to None :type intersection_override: bool, optional :param inner_boundary: binary whether the inner boundary should be drawn Only works well for convex domains, defaults to False :type inner_boundary: bool, optional """ if not self.comm.events.has_event(event_name): msg = "Event '%s' not found in project." % event_name raise ValueError(msg) if weight_set: if not self.comm.weights.has_weight_set(weight_set): msg = f"Weight set {weight_set} not found in project." raise ValueError(msg) weight_set = self.comm.weights.get(weight_set) map_object, projection = self.plot_domain( inner_boundary=inner_boundary) from lasif import visualization # Get the event and extract information from it. event_info = self.comm.events.get(event_name) # Get a dictionary containing all stations that have data for the # current event. try: stations = self.comm.query.get_all_stations_for_event( event_name, intersection_override=intersection_override) except LASIFNotFoundError: pass else: # Plot the stations if it has some. This will also plot raypaths. visualization.plot_stations_for_event( map_object=map_object, station_dict=stations, event_info=event_info, weight_set=weight_set, print_title=True, ) # Plot the earthquake star for one event. visualization.plot_events( events=[event_info], map_object=map_object, )