A package that supports working with spatial data in python teaching.
To install, use pip. --upgrade
is optional but it ensures that the package overwrites
when you install and you have the current version. If you don't have the package
yet you can still use the --upgrade
argument.
$ pip install --upgrade git+https://github.com/earthlab/earthpy.git
Then import it into python.
>>> import earthpy as et
- Leah Wasser
- Max Joseph
- Joe McGlinchy
- Tim Head
- Chris Holdgraf
- Jenny Palomino
This package uses pytest for tests.
To run tests locally, execute the command pytest
from the command line:
$ pytest --doctest-modules
The --doctest-modules
syntax allows pytest to check examples in
docstrings contained in modules (e.g., if a function has an example section),
in addition to the normal tests that pytest would discover.
To locally test examples in the docs
directory (e.g., examples contained in
.rst
files), you can run the following command from the top-level
earthpy
directory:
$ make -C docs doctest
If a test requires a data object such as a GeoDataFrame or numpy array, and copies of that data object are required by multiple tests, we can use pytest fixtures to cleanly create and tear down those objects independently for each test.
See earthpy/tests/conftest.py
for fixture
definitions, and earthpy/tests/test_clip.py
for example usage of fixtures in tests.