Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #31 from sidewalklabs/min-area
Browse files Browse the repository at this point in the history
fix min area
  • Loading branch information
svenkreiss authored Nov 16, 2017
2 parents 6ca8754 + 114d1f8 commit 0e3fd79
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 18 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ matrix:
compiler: clang

script:
- export PATH=$PATH:~/Library/Python/2.7/bin/
- git submodule update --init --recursive
- pip install --upgrade pip
- pip install numpy nose flake8 hacking
- pip install .
- pip install --user --upgrade pip
- pip install --user numpy nose flake8 hacking
- pip install --user .
- flake8
- nosetests-2.7 -vv
- |
Expand Down
5 changes: 1 addition & 4 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
machine:
environment:
TESTCMD: 'python -V && pip install .[tests] && flake8 && nosetests --with-coverage -vv'
TESTCMD: 'python -V && pip install --upgrade pip && pip install .[tests] && flake8 && nosetests -vv'

test:
override:
- deactivate && pyenv shell 2.7.11 && bash -c "$TESTCMD"
- deactivate && pyenv shell 3.4.4 && bash -c "$TESTCMD"
- deactivate && pyenv shell 3.5.1 && bash -c "$TESTCMD"

post:
- coveralls
6 changes: 6 additions & 0 deletions docs/sphinx/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ API
:members:
:undoc-members:

.. autodata:: s2sphere.MIN_AREA

.. autodata:: s2sphere.AVG_AREA

.. autodata:: s2sphere.MAX_AREA

.. autoclass:: s2sphere.Cap
:members:
:undoc-members:
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Sphinx>=1.4.1
Sphinx>=1.6.5
22 changes: 14 additions & 8 deletions s2sphere/sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -1655,21 +1655,27 @@ def __init__(self, deriv):


class AreaMetric(Metric):
"""Area metric. A 2D specialization of :class:`s2sphere.Metric`.
"""Area metric. A 2D specialization of `s2sphere.Metric` (check for API).
Preconfigured instances of this class are
:const:`s2sphere.AVG_AREA`, :const:`s2sphere.MIN_AREA`,
:const:`s2sphere.MAX_AREA`.
Preconfigured instances of this class are `s2sphere.AVG_AREA`,
`s2sphere.MIN_AREA`, `s2sphere.MAX_AREA`.
see :cpp:class:`S2::AreaMetric`
See C++ docs at :cpp:class:`S2::AreaMetric`.
"""
def __init__(self, deriv):
super(AreaMetric, self).__init__(deriv, 2)


AVG_AREA = AreaMetric(4 * math.pi / 6) # true for all projections
MIN_AREA = AreaMetric(8 * math.sqrt(2)) # quadratic projection
MAX_AREA = AreaMetric(2.635799256963161491) # quadratic projection
#: Average cell area for all projections.
AVG_AREA = AreaMetric(4 * math.pi / 6)


#: Minimum cell area for quadratic projections.
MIN_AREA = AreaMetric(8 * math.sqrt(2) / 9)


#: Maximum cell area for quadratic projections.
MAX_AREA = AreaMetric(2.635799256963161491)


def drem(x, y):
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@
'hacking>=0.11.0',
'nose>=1.3.4',
'numpy>=1.11.0',
'coveralls>=1.1',
],
'docs': [
'Sphinx>=1.4.1',
'Sphinx>=1.6.5',
'sphinx-rtd-theme>=0.1.9',
]
},
Expand Down

0 comments on commit 0e3fd79

Please sign in to comment.