Skip to content

Commit

Permalink
Merge pull request #12 from sgrieve/import
Browse files Browse the repository at this point in the history
Import
  • Loading branch information
sgrieve authored Jun 29, 2018
2 parents 45fb4ef + 6a37564 commit ed49d97
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ Install ``spatial_efd`` by running:
Dependencies
------------

This package supports Python 2.7 and Python 3 and is tested on Linux and Windows environments, using both the standard python interpreter and [pypy](https://pypy.org). It requires ``matplotlib``, ``numpy``, ``future`` and ``pyshp``. These packages will all install automatically if ``spatial_efd`` is installed using ``pip``.
This package supports Python 2.7 and Python 3 and is tested on Linux and Windows environments, using both the standard python interpreter and `pypy <https://pypy.org>`_. It requires ``matplotlib``, ``numpy``, ``future`` and ``pyshp``. These packages will all install automatically if ``spatial_efd`` is installed using ``pip``.

Dependencies can be tracked by visiting `requires.io <https://requires.io/github/sgrieve/spatial_efd/requirements/?branch=master>`_

Tests
----------

A range of unit tests are included in the `/tests/` directory. These can
A range of unit tests are included in the `/test/` directory. These can
be run using `pytest`:

.. code-block:: bash
Expand All @@ -84,7 +84,7 @@ The first step in using ``spatial_efd`` is always to load a shapefile:
.. code-block:: python
import spatial_efd
shp = spatial_efd.LoadGeometries('tests/fixtures/example_data.shp')
shp = spatial_efd.LoadGeometries('test/fixtures/example_data.shp')
This creates a shapefile object ``shp`` which contains the polygon geometries we want to analyze. As in most cases more than one polygon will be stored in an individual file, a single polygon can be selected for processing using python's list notation:

Expand Down Expand Up @@ -162,7 +162,7 @@ All of the above examples have focused on processing a single polygon from a mul

.. code-block:: python
shp = spatial_efd.LoadGeometries('tests/fixtures/example_data.shp')
shp = spatial_efd.LoadGeometries('test/fixtures/example_data.shp')
coeffsList = []
Expand Down Expand Up @@ -251,7 +251,7 @@ In the case of the non-normalized data plotted above, these ellipses can also be
shape_id = 1
shpinstance = spatial_efd.generateShapefile()
shpinstance = spatial_efd.writeGeometry(coeffs, x, y, harmonic, shpinstance, shape_id)
spatial_efd.saveShapefile('myShapefile', shpinstance, prj='tests/fixtures/example_data.prj')
spatial_efd.saveShapefile('myShapefile', shpinstance, prj='test/fixtures/example_data.prj')
The first method called creates a blank shapefile object in memory, ready to be populated with Fourier ellipses. The second method can be wrapped in a loop to write as many ellipses as required to a single file. ``shape_id`` is written into the attribute table of the output shapefile and can be set to any integer as a means of identifying the Fourier ellipses. By passing in the existing ``example.prj`` file to the save method, a new projection file will be generated for the saved shapefile, ensuring that it has the correct spatial reference information for when it is loaded into a GIS package. Note that no reprojection is performed as the aim is for the input and output coordinate systems to match. If this parameter is excluded, the output shapefile will have no defined spatial reference system.

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def readme():


setup(name='spatial_efd',
version='1.1.0',
version='1.1.1',
description='Spatial elliptical fourier analysis',
url='http://github.com/sgrieve/spatial-efd',
long_description=readme(),
Expand Down
6 changes: 5 additions & 1 deletion spatial_efd/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from spatial_efd import *
import sys
if(sys.version[0] == 2):
from spatial_efd import *
else:
from .spatial_efd import *

0 comments on commit ed49d97

Please sign in to comment.