Skip to content

Commit

Permalink
MNT: Standardize import ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
dopplershift committed Nov 24, 2016
1 parent d96d02c commit 0ec9340
Show file tree
Hide file tree
Showing 38 changed files with 104 additions and 107 deletions.
5 changes: 3 additions & 2 deletions metpy/calc/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
# SPDX-License-Identifier: BSD-3-Clause

from __future__ import division

import numpy as np
from numpy.ma import masked_array
from ..constants import g, Rd, omega

from ..constants import g, omega, Rd
from ..package_tools import Exporter
from ..units import atleast_1d, units


exporter = Exporter(globals())


Expand Down
4 changes: 3 additions & 1 deletion metpy/calc/kinematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
# SPDX-License-Identifier: BSD-3-Clause

from __future__ import division

import numpy as np
from ..package_tools import Exporter

from ..constants import g
from ..package_tools import Exporter
from ..units import atleast_2d, concatenate, units

exporter = Exporter(globals())
Expand Down
5 changes: 2 additions & 3 deletions metpy/calc/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
# SPDX-License-Identifier: BSD-3-Clause

import numpy as np
from numpy.testing import assert_array_equal

from metpy.units import units
from metpy.testing import assert_almost_equal, assert_array_almost_equal
from metpy.calc.basic import * # noqa: F403
from metpy.testing import assert_almost_equal, assert_array_almost_equal, assert_array_equal
from metpy.units import units


def test_wind_comps_basic():
Expand Down
7 changes: 4 additions & 3 deletions metpy/calc/tests/test_kinematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause

from metpy.testing import assert_array_equal, assert_almost_equal
import numpy as np

from metpy.calc.kinematics import * # noqa: F403
from metpy.constants import g, Re, omega
from metpy.units import units, concatenate
from metpy.constants import g, omega, Re
from metpy.testing import assert_almost_equal, assert_array_equal
from metpy.units import concatenate, units


class TestGradients(object):
Expand Down
3 changes: 2 additions & 1 deletion metpy/calc/tests/test_thermo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
# SPDX-License-Identifier: BSD-3-Clause

import numpy as np

from metpy.calc.thermo import * # noqa: F403
from metpy.units import units
from metpy.testing import assert_almost_equal, assert_array_almost_equal
from metpy.units import units


def test_potential_temperature():
Expand Down
3 changes: 1 addition & 2 deletions metpy/calc/tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
# SPDX-License-Identifier: BSD-3-Clause

import numpy as np
from numpy.testing import assert_array_equal
from metpy.testing import assert_array_almost_equal

from metpy.calc.tools import * # noqa: F403
from metpy.testing import assert_array_almost_equal, assert_array_equal


def test_resample_nn():
Expand Down
3 changes: 2 additions & 1 deletion metpy/calc/tests/test_turbulence.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# SPDX-License-Identifier: BSD-3-Clause

import numpy as np
from numpy.testing import assert_array_equal, assert_almost_equal
from numpy.testing import assert_almost_equal, assert_array_equal

from metpy.calc.turbulence import * # noqa: F403


Expand Down
4 changes: 3 additions & 1 deletion metpy/calc/thermo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
# SPDX-License-Identifier: BSD-3-Clause

from __future__ import division

import numpy as np
import scipy.integrate as si

from .tools import find_intersections
from ..constants import Cp_d, epsilon, kappa, Lv, P0, Rd
from ..package_tools import Exporter
from ..constants import epsilon, kappa, P0, Rd, Lv, Cp_d
from ..units import atleast_1d, concatenate, units

exporter = Exporter(globals())
Expand Down
1 change: 1 addition & 0 deletions metpy/calc/turbulence.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""

import numpy as np

from ..package_tools import Exporter

exporter = Exporter(globals())
Expand Down
6 changes: 3 additions & 3 deletions metpy/cbook.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'''Collection of generally useful utility code from the cookbook'''

# Copyright (c) 2008-2015 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
'''Collection of generally useful utility code from the cookbook'''

import os
import os.path
from matplotlib.cbook import iterable, is_string_like, Bunch

from matplotlib.cbook import Bunch, is_string_like, iterable


def get_test_data(fname, as_file_obj=True):
Expand Down
9 changes: 4 additions & 5 deletions metpy/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) 2008-2015 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
r'''
This is a collection of meteorologically significant constants.
Expand Down Expand Up @@ -67,12 +70,8 @@
======================== ======= ======== =====================================
'''

# Copyright (c) 2008-2015 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause

from .units import units
from .package_tools import Exporter
from .units import units

exporter = Exporter(globals())

Expand Down
5 changes: 1 addition & 4 deletions metpy/gridding/gridding_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
from __future__ import division

import numpy as np

from scipy.interpolate import griddata, Rbf
from scipy.spatial.distance import cdist

from metpy.gridding import interpolation
from metpy.gridding import points

from . import interpolation, points
from ..package_tools import Exporter

exporter = Exporter(globals())
Expand Down
8 changes: 3 additions & 5 deletions metpy/gridding/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@

from __future__ import division

import numpy as np

import warnings

from scipy.spatial import Delaunay, ConvexHull, cKDTree, qhull

from metpy.gridding import triangles, polygons, points
import numpy as np
from scipy.spatial import cKDTree, ConvexHull, Delaunay, qhull

from . import points, polygons, triangles
from ..package_tools import Exporter

exporter = Exporter(globals())
Expand Down
5 changes: 2 additions & 3 deletions metpy/gridding/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

from __future__ import division

import numpy as np
import warnings

import numpy as np
from scipy.spatial import cKDTree

import warnings


def get_points_within_r(center_points, target_points, r, return_idx=False):
r"""Get all target_points within a specified radius
Expand Down
17 changes: 6 additions & 11 deletions metpy/gridding/tests/test_gridding_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,16 @@

from __future__ import division

import pytest

from metpy.gridding.gridding_functions import (calc_kappa,
remove_observations_below_value,
remove_nan_observations,
remove_repeat_coordinates,
interpolate)

import numpy as np

from numpy.testing import assert_almost_equal, assert_array_almost_equal
import pytest
from scipy.spatial.distance import cdist

from numpy.testing import assert_array_almost_equal, assert_almost_equal

from metpy.cbook import get_test_data
from metpy.gridding.gridding_functions import (calc_kappa, interpolate,
remove_nan_observations,
remove_observations_below_value,
remove_repeat_coordinates)


@pytest.fixture()
Expand Down
23 changes: 9 additions & 14 deletions metpy/gridding/tests/test_interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,19 @@

from __future__ import division

import numpy as np
from numpy.testing import assert_almost_equal, assert_array_almost_equal
import pytest

from metpy.gridding.interpolation import (barnes_weights, nn_point, cressman_weights,
cressman_point, barnes_point, natural_neighbor,
inverse_distance)

from metpy.gridding.triangles import find_natural_neighbors, dist_2
from metpy.gridding.gridding_functions import calc_kappa
from metpy.cbook import get_test_data
from scipy.spatial import cKDTree, Delaunay

import numpy as np

from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_almost_equal

from scipy.spatial.distance import cdist

from metpy.cbook import get_test_data
from metpy.gridding.gridding_functions import calc_kappa
from metpy.gridding.interpolation import (barnes_point, barnes_weights, cressman_point,
cressman_weights, inverse_distance,
natural_neighbor, nn_point)
from metpy.gridding.triangles import dist_2, find_natural_neighbors


@pytest.fixture()
def test_data():
Expand Down
9 changes: 4 additions & 5 deletions metpy/gridding/tests/test_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

from __future__ import division

from metpy.gridding.points import (get_points_within_r, get_point_count_within_r,
get_boundary_coords, get_xy_steps, get_xy_range,
generate_grid, generate_grid_coords)

import numpy as np
from numpy.testing import assert_array_almost_equal

import numpy as np
from metpy.gridding.points import (generate_grid, generate_grid_coords, get_boundary_coords,
get_point_count_within_r, get_points_within_r,
get_xy_range, get_xy_steps)


def test_get_points_within_r():
Expand Down
7 changes: 3 additions & 4 deletions metpy/gridding/tests/test_polygons.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

from __future__ import division

from metpy.gridding.polygons import (area, order_edges)
from numpy.testing import assert_almost_equal, assert_array_equal

from numpy import isclose
from numpy.testing import assert_array_equal
from metpy.gridding.polygons import (area, order_edges)


def test_area():
Expand All @@ -19,7 +18,7 @@ def test_area():

truth = 12.5

assert isclose(truth, area([pt0, pt1, pt2]))
assert_almost_equal(area([pt0, pt1, pt2]), truth)


def test_order_edges():
Expand Down
14 changes: 6 additions & 8 deletions metpy/gridding/tests/test_triangles.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@

from __future__ import division

from metpy.gridding.triangles import (dist_2, distance, circumcircle_radius_2,
circumcircle_radius, circumcenter,
find_natural_neighbors, find_nn_triangles_point,
find_local_boundary, triangle_area)

from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_almost_equal
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_almost_equal
from scipy.spatial import Delaunay

import numpy as np
from metpy.gridding.triangles import (circumcenter, circumcircle_radius, circumcircle_radius_2,
dist_2, distance, find_local_boundary,
find_natural_neighbors, find_nn_triangles_point,
triangle_area)


def test_triangle_area():
Expand Down
7 changes: 4 additions & 3 deletions metpy/io/gini.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause

import logging
import re
from datetime import datetime
try:
from enum import Enum
except ImportError:
from enum34 import Enum
from itertools import repeat
import logging
import re

import numpy as np

from .cdm import cf_to_proj, Dataset
from .tools import Bits, IOBuffer, NamedStruct, zlib_decompress_all_frames
from .cdm import Dataset, cf_to_proj
from ..cbook import is_string_like
from ..package_tools import Exporter

Expand Down
8 changes: 5 additions & 3 deletions metpy/io/nexrad.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
# SPDX-License-Identifier: BSD-3-Clause

from __future__ import print_function

import bz2
from collections import defaultdict, namedtuple, OrderedDict
import datetime
import gzip
import logging
import re
import struct
from collections import defaultdict, namedtuple, OrderedDict
from struct import Struct
from xdrlib import Unpacker

import numpy as np
from scipy.constants import day, milli

from .tools import (Array, BitField, Bits, bits_to_code, DictStruct, Enum, IOBuffer,
NamedStruct, zlib_decompress_all_frames)
from ..cbook import is_string_like
from ..package_tools import Exporter
from .tools import (Array, BitField, Bits, DictStruct, Enum, IOBuffer, NamedStruct,
bits_to_code, zlib_decompress_all_frames)

exporter = Exporter(globals())

Expand Down
4 changes: 2 additions & 2 deletions metpy/io/tests/test_gini.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause

import logging
from datetime import datetime
import logging

from numpy.testing import assert_almost_equal
import pytest

from metpy.io.gini import GiniFile, GiniProjection
from metpy.cbook import get_test_data
from metpy.io.gini import GiniFile, GiniProjection

log = logging.getLogger('metpy.io.gini')
log.setLevel(logging.ERROR)
Expand Down
Loading

0 comments on commit 0ec9340

Please sign in to comment.