Skip to content

Commit

Permalink
pyflakes cleanups, tag 0.8b1
Browse files Browse the repository at this point in the history
  • Loading branch information
njwilson23 committed Jan 15, 2017
1 parent d037f79 commit 07ecfc1
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 34 deletions.
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
# The short X.Y version.
version = '0.8'
# The full version, including alpha/beta/rc tags.
release = '0.8dev0'
release = '0.8b1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
14 changes: 12 additions & 2 deletions karta/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,24 @@
"""

__all__ = ["vector", "raster", "crs", "tile", "errors"]

from .version import __version__

from . import vector
from . import raster
from . import crs
from . import tile
from . import errors
from .vector import *
from .raster import *

from .vector import (Point, Line, Polygon, Multipoint, Multiline, Multipolygon,
from_shape, read_geojson,
read_gpx_waypts, read_gpx_tracks,
read_shapefile, write_shapefile,
geometry)

from .raster import (RegularGrid, SimpleBand, CompressedBand,
read_aai, read_geotiff, read_gtiff, from_geotiffs,
grid, misc)

# from .tile import tile_bbox, tile_nw_corner, tile_tuple

2 changes: 1 addition & 1 deletion karta/examples.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .vector import Point, Multipoint, Line, Polygon
from .vector import Point, Polygon
from .crs import LonLatWGS84, NSIDCNorth

us_capitols = [Point((-112.1, 33.57), properties={"n": "Phoenix, Arizona, United States"}, crs=LonLatWGS84),
Expand Down
4 changes: 2 additions & 2 deletions karta/geodesy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
def recurse_iterables(f, *args, **kwargs):
def func(*args, **kwargs):
if hasattr(args[0], "__iter__"):
return np.array([f(*argsset, **kwargs) for argset in zip(*args)])
return np.array([f(*argset, **kwargs) for argset in zip(*args)])
else:
return f(*args, **kwargs)
return func
Expand Down Expand Up @@ -93,7 +93,7 @@ def plane_azimuth(x1, y1, x2, y2):
# ---------------------------------

@recurse_iterables
def sphere_distance(lons1, lats1, lons2, lats2, radius=1.0):
def sphere_distance(lon1, lat1, lon2, lat2, radius=1.0):
dx = abs(lon1-lon2)
dy = abs(lat1-lat2)

Expand Down
2 changes: 1 addition & 1 deletion karta/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.8dev0"
__version__ = "0.8b1"
53 changes: 26 additions & 27 deletions tests/crs_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,33 +291,6 @@ def proj4_asdict(s):
for key in ("+proj", "+lat_0", "+lon_0", "+lat_ts", "+datum"):
self.assertEqual(crsdict1[key], crsdict2[key])

def test_brent1(self):
def forsythe(x):
return x**3 - 2*x - 5
self.assertAlmostEqual(2.094551482,
geodesy.fzero_brent(2, 3, forsythe, 1e-12))
return

def test_brent2(self):
self.assertAlmostEqual(0.7390851332,
geodesy.fzero_brent(0, 1, lambda x: math.cos(x)-x, 1e-12))
return

def test_brent3(self):
self.assertAlmostEqual(0.0,
geodesy.fzero_brent(-1, 1, lambda x: math.sin(x)-x, 1e-12))
return

def test_brent4(self):
self.assertAlmostEqual(0.0,
geodesy.fzero_brent(0, 1, lambda x: math.sin(x)-x, 1e-12))
return

def test_brent_bracket_error(self):
self.assertRaises(ValueError,
geodesy.fzero_brent, 0.2, 2, lambda x: math.sin(x)-x, 1e-12)
return

def test_datum_transform(self):
lng, lat = crs.LonLatNAD27.transform(crs.LonLatNAD83, -107.5, 43.14)
self.assertAlmostEqual(lng, -107.50062798611111, places=3)
Expand Down Expand Up @@ -395,6 +368,32 @@ def test_EllipsoidalNearAntipodalInverse(self):
self.assertAlmostEqual(d, d_, places=4)
return

def test_brent1(self):
def forsythe(x):
return x**3 - 2*x - 5
self.assertAlmostEqual(2.094551482,
geodesy.fzero_brent(2, 3, forsythe, 1e-12))
return

def test_brent2(self):
self.assertAlmostEqual(0.7390851332,
geodesy.fzero_brent(0, 1, lambda x: math.cos(x)-x, 1e-12))
return

def test_brent3(self):
self.assertAlmostEqual(0.0,
geodesy.fzero_brent(-1, 1, lambda x: math.sin(x)-x, 1e-12))
return

def test_brent4(self):
self.assertAlmostEqual(0.0,
geodesy.fzero_brent(0, 1, lambda x: math.sin(x)-x, 1e-12))
return

def test_brent_bracket_error(self):
self.assertRaises(ValueError,
geodesy.fzero_brent, 0.2, 2, lambda x: math.sin(x)-x, 1e-12)
return

if __name__ == "__main__":
unittest.main()
Expand Down

0 comments on commit 07ecfc1

Please sign in to comment.