コード例 #1
0
import pytest

from .common import TESTDATA

import os.path
import tempfile
import tarfile
import zipfile
from netCDF4 import Dataset

import flyingpigeon as fp
from flyingpigeon import utils
from flyingpigeon.utils import local_path
from eggshell.config import Paths
paths = Paths(fp)


def test_local_path():
    assert local_path('file:///tmp/test.nc') == '/tmp/test.nc'
    assert local_path('/tmp/test.nc') == '/tmp/test.nc'


@pytest.mark.skip(reason="no way of currently testing this")
def test_download_with_cache():
    filename = utils.download(TESTDATA['cmip5_tasmax_2006_nc'], cache=paths.cache)
    assert os.path.basename(filename) == 'tasmax_Amon_MPI-ESM-MR_rcp45_r1i1p1_200601-200612.nc'


def test_archive_tar():
    result = utils.archive(
        [local_path(TESTDATA['cmip5_tasmax_2007_nc'])],
コード例 #2
0
ファイル: wps_output_formats.py プロジェクト: davidcaron/emu
"""
Process returning a variety of output file formats to help test clients.

Author: David Huard
"""
import os
from pywps import Process, ComplexOutput
from pywps import FORMATS
from eggshell.config import Paths
import emu
import logging
LOGGER = logging.getLogger("PYWPS")
paths = Paths(emu)


class OutputFormats(Process):
    def __init__(self):
        inputs = []
        outputs = [
            ComplexOutput('netcdf',
                          'netCDF dummy output file.',
                          abstract="A very small test netCDF file. ",
                          as_reference=True,
                          supported_formats=[
                              FORMATS.NETCDF,
                          ]),
            ComplexOutput('json',
                          'json dummy output file.',
                          abstract="A very small test json file. ",
                          as_reference=True,
                          supported_formats=[
コード例 #3
0
from eggshell import utils
from datetime import datetime as dt
from datetime import timedelta

from eggshell.utils import download
from eggshell.config import Paths
import eggshell as eg
paths = Paths(eg)

# import logging
# logger = logging.getLogger(__name__)

import logging
LOGGER = logging.getLogger("PYWPS")

_PRESSUREDATA_ = [
    'NCEP_slp',
    'NCEP_z1000',
    'NCEP_z925',
    'NCEP_z850',
    'NCEP_z700',
    'NCEP_z600',
    'NCEP_z500',
    'NCEP_z400',
    'NCEP_z300',
    'NCEP_z250',
    'NCEP_z200',
    'NCEP_z150',
    'NCEP_z100',
    'NCEP_z70',
    'NCEP_z50',
コード例 #4
0
ファイル: test_eggshell.py プロジェクト: bird-house/eggshell
from .common import TESTDATA

from os.path import basename, join
import tempfile
import tarfile
import zipfile
from netCDF4 import Dataset

from eggshell import utils
from eggshell.utils import local_path
from eggshell.nc import ocg_utils
from eggshell.nc import nc_utils
from eggshell.config import Paths
import eggshell as es
paths = Paths(es)


def test_Paths():
    assert "eggshell/tests/testdata" in paths.testdata
    assert 'eggshell/data' in paths.data
    assert 'eggshell/data/shapefiles' in paths.shapefiles


def test_local_path():
    assert local_path('file:///tmp/test.nc') == '/tmp/test.nc'
    assert local_path('/tmp/test.nc') == '/tmp/test.nc'


def test_ocgis_import():
    from ocgis import constants