Esempio n. 1
0
# third party imports
import numpy as np
import pkg_resources

# local imports
from gmprocess.streamcollection import StreamCollection
from gmprocess.io.read import read_data
from gmprocess.processing import process_streams
from gmprocess.logging import setup_logger
from gmprocess.io.test_utils import read_data_dir
from gmprocess.io.fetch_utils import update_config

datapath = os.path.join('data', 'testdata')
datadir = pkg_resources.resource_filename('gmprocess', datapath)

setup_logger()


def test_process_streams():
    # Loma Prieta test station (nc216859)

    data_files, origin = read_data_dir('geonet', 'us1000778i', '*.V1A')
    streams = []
    for f in data_files:
        streams += read_data(f)

    sc = StreamCollection(streams)

    sc.describe()

    config = update_config(os.path.join(datadir, 'config_min_freq_0p2.yml'))
import os.path

import pkg_resources
import logging

from gmprocess.io.read_directory import directory_to_streams
from gmprocess.logging import setup_logger

setup_logger()


def test_directory_to_streams():
    dpath = os.path.join('data', 'testdata', 'read_directory', 'whittier87')
    directory = pkg_resources.resource_filename('gmprocess', dpath)

    streams, unprocessed_files, unprocessed_file_errors = directory_to_streams(
        directory)
    assert len(streams) == 7


if __name__ == '__main__':
    os.environ['CALLED_FROM_PYTEST'] = 'True'
    test_directory_to_streams()