示例#1
0
文件: pile.py 项目: lucasc15/mt3py
def make_pile( paths=None, selector=None, regex=None,
        fileformat = 'mseed',
        cachedirname=config.cache_dir, show_progress=True ):
    
    '''Create pile from given file and directory names.
    
    :param paths: filenames and/or directories to look for traces. If paths is 
        ``None`` ``sys.argv[1:]`` is used.
    :param selector: lambda expression taking group dict of regex match object as
        a single argument and which returns true or false to keep or reject
        a file
    :param regex: regular expression which filenames have to match
    :param fileformat: format of the files ('mseed', 'sac', 'kan', 
        'from_extension', 'try')
    :param cachedirname: loader cache is stored under this directory. It is
        created as neccessary.
    :param show_progress: show progress bar and other progress information
    '''
    if isinstance(paths, str):
        paths = [ paths ]
        
    if paths is None:
        paths = sys.argv[1:]
    
    fns = util.select_files(paths, selector, regex, show_progress=show_progress)

    cache = get_cache(cachedirname)
    p = Pile()
    p.load_files( sorted(fns), cache=cache, fileformat=fileformat, show_progress=show_progress)
    return p
示例#2
0
文件: rdseed.py 项目: carinaj/pyrocko
 def get_pile(self):
     if self._pile is None:
         #fns = io.save( io.load(pjoin(self.tempdir, 'mini.seed')), pjoin(self.tempdir,
         #         'raw-%(network)s-%(station)s-%(location)s-%(channel)s.mseed'))
         fns = util.select_files( [ self.tempdir ], regex=r'\.SAC$')
         self._pile = pile.Pile()
         self._pile.load_files(fns, fileformat='sac')
         
     return self._pile
示例#3
0
    def get_pile(self):
        if self._pile is None:
            #fns = io.save( io.load(pjoin(self.tempdir, 'mini.seed')), pjoin(self.tempdir,
            #         'raw-%(network)s-%(station)s-%(location)s-%(channel)s.mseed'))
            fns = util.select_files([self.tempdir], regex=r'\.SAC$')
            self._pile = pile.Pile()
            self._pile.load_files(fns, fileformat='sac')

        return self._pile
示例#4
0
def make_pile(paths=None,
              selector=None,
              regex=None,
              fileformat='mseed',
              cachedirname=config.cache_dir,
              show_progress=True):
    '''Create pile from given file and directory names.

    :param paths: filenames and/or directories to look for traces. If paths is
        ``None`` ``sys.argv[1:]`` is used.
    :param selector: lambda expression taking group dict of regex match object as
        a single argument and which returns true or false to keep or reject
        a file
    :param regex: regular expression which filenames have to match
    :param fileformat: format of the files ('mseed', 'sac', 'kan',
        'from_extension', 'try')
    :param cachedirname: loader cache is stored under this directory. It is
        created as neccessary.
    :param show_progress: show progress bar and other progress information
    '''
    if isinstance(paths, str):
        paths = [paths]

    if paths is None:
        paths = sys.argv[1:]

    fns = util.select_files(paths,
                            selector,
                            regex,
                            show_progress=show_progress)

    cache = get_cache(cachedirname)
    p = Pile()
    p.load_files(sorted(fns),
                 cache=cache,
                 fileformat=fileformat,
                 show_progress=show_progress)
    return p