Beispiel #1
0
def _test_download_data():
    """Test the example data installers."""
    temp_dir = TemporaryDirectory()

    try:
        download_pysteps_data(temp_dir.name, force=True)
        with pytest.raises(DirectoryNotEmpty):
            download_pysteps_data(temp_dir.name, force=False)

        params_file = create_default_pystepsrc(temp_dir.name,
                                               config_dir=temp_dir.name)

        pysteps.load_config_file(params_file)
    finally:
        temp_dir.cleanup()
        pysteps.load_config_file()
Beispiel #2
0
# -*- coding: utf-8 -*-
"""
Script used to install the pysteps data in a test environment and set a pystepsrc
configuration file that points to that data.

The test data is downloaded in the `PYSTEPS_DATA_DIR` environmental variable.

After this script is run, the `PYSTEPSRC` environmental variable should be set to
PYSTEPSRC=$PYSTEPS_DATA_DIR/pystepsrc for pysteps to use that configuration file.
"""

import os

from pysteps.datasets import create_default_pystepsrc, download_pysteps_data

tox_test_data_dir = os.environ['PYSTEPS_DATA_DIR']

download_pysteps_data(tox_test_data_dir, force=True)

create_default_pystepsrc(tox_test_data_dir,
                         config_dir=tox_test_data_dir,
                         file_name="pystepsrc")