[minor] various small fixes
This commit is contained in:
		
							parent
							
								
									9ae8e36061
								
							
						
					
					
						commit
						7bf3bb6835
					
				
							
								
								
									
										12
									
								
								PyLoT.py
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								PyLoT.py
									
									
									
									
									
								
							@ -2253,15 +2253,20 @@ class MainWindow(QMainWindow):
 | 
			
		||||
        plot_dict = self.getPlotWidget().getPlotDict()
 | 
			
		||||
        return plot_dict.get(wfID)
 | 
			
		||||
 | 
			
		||||
    def getNetworkName(self, wfID):
 | 
			
		||||
        plot_dict = self.getPlotWidget().getPlotDict()
 | 
			
		||||
        if wfID in plot_dict.keys():
 | 
			
		||||
            return plot_dict[wfID].split('.')[0]
 | 
			
		||||
 | 
			
		||||
    def getStationName(self, wfID):
 | 
			
		||||
        plot_dict = self.getPlotWidget().getPlotDict()
 | 
			
		||||
        if wfID in plot_dict.keys():
 | 
			
		||||
            return plot_dict[wfID].split('.')[1]
 | 
			
		||||
 | 
			
		||||
    def getNetworkName(self, wfID):
 | 
			
		||||
    def getLocationName(self, wfID):
 | 
			
		||||
        plot_dict = self.getPlotWidget().getPlotDict()
 | 
			
		||||
        if wfID in plot_dict.keys():
 | 
			
		||||
            return plot_dict[wfID].split('.')[0]
 | 
			
		||||
            return plot_dict[wfID].split('.')[2]
 | 
			
		||||
 | 
			
		||||
    def alterPhase(self):
 | 
			
		||||
        pass
 | 
			
		||||
@ -2328,11 +2333,12 @@ class MainWindow(QMainWindow):
 | 
			
		||||
 | 
			
		||||
        network = self.getNetworkName(wfID)
 | 
			
		||||
        station = self.getStationName(wfID)
 | 
			
		||||
        location = self.getLocationName(wfID)
 | 
			
		||||
        seed_id = self.getTraceID(wfID)
 | 
			
		||||
        if button == 1:
 | 
			
		||||
            self.pickDialog(wfID, seed_id)
 | 
			
		||||
        elif button == 4:
 | 
			
		||||
            self.toggle_station_color(wfID, network, station)
 | 
			
		||||
            self.toggle_station_color(wfID, network, station, location)
 | 
			
		||||
 | 
			
		||||
    def toggle_station_color(self, wfID, network, station, location):
 | 
			
		||||
        black_pen = pg.mkPen((0, 0, 0))
 | 
			
		||||
 | 
			
		||||
@ -189,7 +189,8 @@ class Metadata(object):
 | 
			
		||||
                if not station_name in self.stations_dict.keys():
 | 
			
		||||
                    st_id = '{}.{}'.format(network_name, station_name)
 | 
			
		||||
                    self.stations_dict[st_id] = {'latitude': station[0].latitude,
 | 
			
		||||
                                                 'longitude': station[0].longitude}
 | 
			
		||||
                                                 'longitude': station[0].longitude,
 | 
			
		||||
                                                 'elevation': station[0].elevation}
 | 
			
		||||
 | 
			
		||||
        def stat_info_from_inventory(inventory):
 | 
			
		||||
            for network in inventory.networks:
 | 
			
		||||
@ -199,8 +200,8 @@ class Metadata(object):
 | 
			
		||||
                    if not station_name in self.stations_dict.keys():
 | 
			
		||||
                        st_id = '{}.{}'.format(network_name, station_name)
 | 
			
		||||
                        self.stations_dict[st_id] = {'latitude': station[0].latitude,
 | 
			
		||||
                                                     'longitude': station[0].longitude}
 | 
			
		||||
 | 
			
		||||
                                                     'longitude': station[0].longitude,
 | 
			
		||||
                                                     'elevation': station[0].elevation}
 | 
			
		||||
        read_stat = {'xml': stat_info_from_inventory,
 | 
			
		||||
                     'dless': stat_info_from_parser}
 | 
			
		||||
 | 
			
		||||
@ -240,7 +241,7 @@ class Metadata(object):
 | 
			
		||||
        Search for metadata for a specific station iteratively.
 | 
			
		||||
        """
 | 
			
		||||
        station, network, location, channel = station_seed_id.split('.')
 | 
			
		||||
        # seach for station seed id in filenames in invetory
 | 
			
		||||
        # search for station seed id in filenames in inventory
 | 
			
		||||
        fnames = glob.glob(os.path.join(path_to_inventory, '*' + station_seed_id + '*'))
 | 
			
		||||
        if not fnames:
 | 
			
		||||
            # search for station name in filename
 | 
			
		||||
 | 
			
		||||
@ -35,7 +35,9 @@ def qml_from_obspyDMT(path):
 | 
			
		||||
    if not os.path.exists(path):
 | 
			
		||||
        return IOError('Could not find Event at {}'.format(path))
 | 
			
		||||
    infile = open(path, 'rb')
 | 
			
		||||
    event_dmt = pickle.load(infile)
 | 
			
		||||
    event_dmt = pickle.load(infile)#, fix_imports=True)
 | 
			
		||||
    event_dmt['origin_id'].id = str(event_dmt['origin_id'].id)
 | 
			
		||||
 | 
			
		||||
    ev = Event(resource_id=event_dmt['event_id'])
 | 
			
		||||
    origin = Origin(resource_id=event_dmt['origin_id'], time=event_dmt['datetime'], longitude=event_dmt['longitude'],
 | 
			
		||||
                    latitude=event_dmt['latitude'], depth=event_dmt['depth'])
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user