Skip to content

Commit

Permalink
Merge pull request #52 from ocefpaf/fix_pep8
Browse files Browse the repository at this point in the history
fix pep8
  • Loading branch information
ocefpaf authored Sep 28, 2017
2 parents d1413e4 + 1dc0dd7 commit bbf28d1
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 31 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ matrix:
env: TEST_TARGET=default
- python: 3.5
env: TEST_TARGET=default
- python: 3.5
env: TEST_TARGET=coding_standards
- python: 3.6
env: TEST_TARGET=default
allow_failures:
- python: 3.5
env: TEST_TARGET=coding_standards
allow_failures:
- python: 3.6
env: TEST_TARGET=coding_standards


before_install:
Expand Down
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import os
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand

import versioneer

Expand Down
2 changes: 1 addition & 1 deletion tests/test_harmonics.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from utide.harmonics import FUV
from utide.utilities import loadbunch
from utide import _base_dir
from utide._ut_constants import _base_dir

fname = os.path.join(_base_dir, 'FUV0.npz')

Expand Down
10 changes: 8 additions & 2 deletions tests/test_solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@

import numpy as np

from utide import ut_constants
from utide._ut_constants import ut_constants
from utide import solve
from utide import reconstruct
from utide.utilities import Bunch


def test_roundtrip():
Expand Down Expand Up @@ -63,7 +64,8 @@ def test_roundtrip():
htmp = reconstruct(time, elev_coef, min_PE=10)
vel = reconstruct(time, speed_coef, min_SNR=0)
htmp = reconstruct(time, elev_coef, min_SNR=0)

assert isinstance(vel, Bunch)
assert isinstance(htmp, Bunch)

# Now the round-trip check, just for the elevation.
err = np.sqrt(np.mean((time_series-ts_recon)**2))
Expand Down Expand Up @@ -119,10 +121,14 @@ def test_masked_input():
amp_err = amp - elev_coef['A'][0]
phase_err = phase - elev_coef['g'][0]
ts_recon = reconstruct(time, elev_coef).h
assert isinstance(ts_recon, np.ndarray)

# pure smoke testing of reconstruct
vel = reconstruct(time, speed_coef)
assert isinstance(vel, Bunch)

elev = reconstruct(time, elev_coef)
assert isinstance(elev, Bunch)

np.testing.assert_almost_equal(amp_err, 0)
np.testing.assert_almost_equal(phase_err, 0)
Expand Down
22 changes: 4 additions & 18 deletions utide/__init__.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
from __future__ import (absolute_import, division, print_function)

import os

from utide.utilities import loadbunch, convert_unicode_arrays

_base_dir = os.path.join(os.path.dirname(__file__), 'data')
_ut_constants_fname = os.path.join(_base_dir, 'ut_constants.npz')

# At least for now, use NaNs rather than masked arrays.
ut_constants = loadbunch(_ut_constants_fname, masked=False)
ut_constants = convert_unicode_arrays(ut_constants)

constit_names = list(ut_constants.const.name)

# Make a dictionary for index lookups.
constit_index_dict = dict([(name, i) for (i, name) in
enumerate(constit_names)])

from ._solve import solve
from ._reconstruct import reconstruct
from ._ut_constants import ut_constants, constit_index_dict

__all__ = ['solve',
'reconstruct']
'reconstruct',
'ut_constants',
'constit_index_dict']

from ._version import get_versions
__version__ = get_versions()['version']
Expand Down
2 changes: 1 addition & 1 deletion utide/_solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .constituent_selection import ut_cnstitsel
from .confidence import _confidence
from .utilities import Bunch
from . import constit_index_dict
from ._ut_constants import constit_index_dict
from .robustfit import robustfit
from ._time_conversion import _normalize_time

Expand Down
19 changes: 19 additions & 0 deletions utide/_ut_constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from __future__ import (absolute_import, division, print_function)

import os

from .utilities import convert_unicode_arrays, loadbunch


_base_dir = os.path.join(os.path.dirname(__file__), 'data')
_ut_constants_fname = os.path.join(_base_dir, 'ut_constants.npz')

# At least for now, use NaNs rather than masked arrays.
ut_constants = loadbunch(_ut_constants_fname, masked=False)
ut_constants = convert_unicode_arrays(ut_constants)

constit_names = list(ut_constants.const.name)

# Make a dictionary for index lookups.
constit_index_dict = dict([(name, i) for (i, name) in
enumerate(constit_names)])
3 changes: 1 addition & 2 deletions utide/constituent_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import numpy as np

from .astronomy import ut_astron
from . import ut_constants
from . import constit_index_dict
from ._ut_constants import ut_constants, constit_index_dict
from .utilities import Bunch


Expand Down
4 changes: 2 additions & 2 deletions utide/harmonics.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import numpy as np

from utide.astronomy import ut_astron
from utide import ut_constants
from .astronomy import ut_astron
from ._ut_constants import ut_constants


sat = ut_constants.sat
Expand Down

0 comments on commit bbf28d1

Please sign in to comment.