示例#1
0
def main():
    """
    Main

    Returns
    -------
    None.

    """
    import pygmi.seis.iodefs as iodefs

    idir = os.path.dirname(os.path.realpath(__file__))
    tfile = os.path.join(idir, r'descriptions.txt')

    with open(tfile) as fno:
        tmp = fno.read()

    masterlist = tmp.split('\n')

    ifile = r'C:\WorkData\seismology\2000to2018.out'

    IO = iodefs.ImportSeisan(None)
    IO.settings(ifile)
    data = IO.outdata['Seis']

    nomatch = []
    correction = []

    for i in data:
        if '3' not in i:
            continue
        text = i['3'].region

        cmatch = difflib.get_close_matches(text, masterlist, 1, cutoff=0.7)
        if cmatch:
            cmatch = cmatch[0]
        else:
            nomatch.append(text)
            continue

        if cmatch != text:
            correction.append(text + ' to ' + cmatch)

    print('len nomatch', len(nomatch))
    print('len correction', len(correction))

    nomatch = list(set(nomatch))
    correction = list(set(correction))

    print('len nomatch', len(nomatch))
    print('len correction', len(correction))

    breakpoint()
示例#2
0
def import_for_plots(ifile, dind='R'):
    """Import data to plot."""
    iseis = iodefs.ImportSeisan()
    iseis.settings(ifile)

    dat = iseis.outdata['Seis']
    datd = {}

    for event in dat:
        if '1' not in event:
            continue
        if event['1'].distance_indicator not in dind:
            continue

        for rectype in event:
            if rectype not in datd:
                datd[rectype] = []
            datd[rectype].append(event[rectype])

            if rectype in ('1', 'E'):
                tmp = vars(event[rectype])
                for j in tmp:
                    newkey = rectype + '_' + j
                    if newkey not in datd:
                        datd[newkey] = []
                    datd[newkey].append(tmp[j])
                    # Custom
                    if 'type_of_magnitude' in j:
                        newkey = '1_M' + tmp[j]
                        if newkey not in datd:
                            datd[newkey] = []
                        datd[newkey].append(tmp[j.split('_of_')[1]])

                        #                        time = tmp['hour']+tmp['minutes']/60.+tmp['seconds']/3600.
                        #                        newkey = '1_M'+tmp[j]+'_time'
                        #                        if newkey not in datd:
                        #                            datd[newkey] = []
                        #                        datd[newkey].append(time)

                        newkey = '1_M' + tmp[j] + '_year'
                        if newkey not in datd:
                            datd[newkey] = []
                        datd[newkey].append(tmp['year'])

            if rectype == '4':
                for i in event[rectype]:
                    tmp = vars(i)
                    for j in tmp:
                        newkey = rectype + '_' + j
                        if newkey not in datd:
                            datd[newkey] = []
                        datd[newkey].append(tmp[j])
    return datd
示例#3
0
def main():
    """Routine for testing."""
    ifile = r'C:\Work\Programming\pygmi\data\seismology\pygmi.out'

    #    gearth_plot(ifile)
    #    test()

    quarry = Quarry()

    dat = iodefs.ImportSeisan()
    dat.settings(ifile)

    quarry.indata = dat.outdata
    quarry.settings()
示例#4
0
 def import_seisan(self):
     """Import Seisan."""
     fnc = iodefs.ImportSeisan(self.parent)
     self.parent.item_insert('Io', 'Import\nSeisan\nData', fnc)
示例#5
0
文件: menu.py 项目: LEONOB2014/pygmi
 def import_seisan(self):
     """ Imports Seisan"""
     fnc = iodefs.ImportSeisan(self.parent)
     self.parent.item_insert("Io", "Import\nSeisan\nData", fnc)